-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from FokiDoki/CustomPeerCreateParameters
Create peer with custom parameters
- Loading branch information
Showing
21 changed files
with
282 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/com/wireguard/external/network/AlreadyUsedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wireguard.external.network; | ||
|
||
public class AlreadyUsedException extends RuntimeException{ | ||
public AlreadyUsedException(String message){ | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/wireguard/external/network/SubnetFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.wireguard.external.network; | ||
import org.springframework.format.Formatter; | ||
import org.springframework.stereotype.Component; | ||
import java.util.Locale; | ||
|
||
@Component | ||
public class SubnetFormatter implements Formatter<Subnet> { | ||
|
||
|
||
@Override | ||
public Subnet parse(String text, Locale locale) { | ||
return Subnet.valueOf(text); | ||
} | ||
|
||
@Override | ||
public String print(Subnet object, Locale locale) { | ||
return object.toString(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/wireguard/external/shell/CommandExecutionException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package com.wireguard.external.shell; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class CommandExecutionException extends RuntimeException { | ||
private final String stderr; | ||
private final String stdout; | ||
private final int exitCode; | ||
public CommandExecutionException(String command, int exitCode, String stdout, String stderr) { | ||
super("Error executing command: %s, exit code: %d, stdout: %s, stderr: %s".formatted( | ||
command, | ||
exitCode, | ||
stdout, | ||
stderr)); | ||
this.exitCode = exitCode; | ||
this.stderr = stderr; | ||
this.stdout = stdout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...d/converters/StreamToStringConverter.java → ...ternal/shell/StreamToStringConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/wireguard/external/wireguard/WgPeerBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.wireguard.external.wireguard; | ||
|
||
import com.wireguard.external.network.IpResolver; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class WgPeerBuilder { | ||
|
||
@Value("${wg.interface.new_client_subnet_mask}") | ||
private static int DEFAULT_MASK; | ||
private IpResolver wgIpResolver; | ||
|
||
public WgPeerBuilder(IpResolver wgIpResolver) { | ||
this.wgIpResolver = wgIpResolver; | ||
} | ||
} |
Oops, something went wrong.