aboutsummaryrefslogtreecommitdiffstats
path: root/wireguard-go-bridge
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-12 00:45:50 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-12 01:11:43 +0100
commit034a1a12f7849276823546f369b00507dc8029ce (patch)
tree47ad6263978713be38e331c877602ba622e6d9d1 /wireguard-go-bridge
parentFixed a potential race condition, better naming on PacketTunnelSettingsGenerator methods (diff)
downloadwireguard-apple-034a1a12f7849276823546f369b00507dc8029ce.tar.xz
wireguard-apple-034a1a12f7849276823546f369b00507dc8029ce.zip
Supply missing pieces of path change
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wireguard-go-bridge')
-rw-r--r--wireguard-go-bridge/src/api-ios.go15
-rw-r--r--wireguard-go-bridge/wireguard.h3
2 files changed, 15 insertions, 3 deletions
diff --git a/wireguard-go-bridge/src/api-ios.go b/wireguard-go-bridge/src/api-ios.go
index ff7aab2d..3d35d1e3 100644
--- a/wireguard-go-bridge/src/api-ios.go
+++ b/wireguard-go-bridge/src/api-ios.go
@@ -128,16 +128,27 @@ func wgTurnOff(tunnelHandle int32) {
}
//export wgSetConfig
-func wgSetConfig(tunnelHandle int32, settings string) {
+func wgSetConfig(tunnelHandle int32, settings string) int64 {
device, ok := tunnelHandles[tunnelHandle]
if !ok {
- return
+ return 0
}
bufferedSettings := bufio.NewReadWriter(bufio.NewReader(strings.NewReader(settings)), bufio.NewWriter(ioutil.Discard))
err := ipcSetOperation(device, bufferedSettings)
if err != nil {
device.log.Error.Println(err)
+ return err.Code
+ }
+ return 0
+}
+
+//export wgGetListenPort
+func wgGetListenPort(tunnelHandle int32) uint16 {
+ device, ok := tunnelHandles[tunnelHandle]
+ if !ok {
+ return 0
}
+ return device.net.port
}
//export wgVersion
diff --git a/wireguard-go-bridge/wireguard.h b/wireguard-go-bridge/wireguard.h
index 54cb9289..fec352d5 100644
--- a/wireguard-go-bridge/wireguard.h
+++ b/wireguard-go-bridge/wireguard.h
@@ -14,7 +14,8 @@ typedef void(*logger_fn_t)(int level, const char *msg);
extern void wgSetLogger(logger_fn_t logger_fn);
extern int wgTurnOn(gostring_t ifname, gostring_t settings, int32_t tun_fd);
extern void wgTurnOff(int handle);
-extern void wgSetConfig(int handle, gostring_t settings);
+extern int64_t wgSetConfig(int handle, gostring_t settings);
+extern uint16_t wgGetListenPort(int handle);
extern char *wgVersion();
#endif