aboutsummaryrefslogtreecommitdiffstats
path: root/wireguard-go-bridge
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-21 22:05:47 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-21 22:05:47 +0100
commitaccf60b82f29b3af930b372a2f401c299ceeb5c2 (patch)
treeab13c9a95ac167738c415f0732385564de42622f /wireguard-go-bridge
parentAll migration stuff moved to one gross file (diff)
downloadwireguard-apple-accf60b82f29b3af930b372a2f401c299ceeb5c2.tar.xz
wireguard-apple-accf60b82f29b3af930b372a2f401c299ceeb5c2.zip
Do not require NetworkExtension to know its own name
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wireguard-go-bridge')
-rw-r--r--wireguard-go-bridge/src/api-ios.go17
-rw-r--r--wireguard-go-bridge/wireguard.h2
2 files changed, 7 insertions, 12 deletions
diff --git a/wireguard-go-bridge/src/api-ios.go b/wireguard-go-bridge/src/api-ios.go
index 3d35d1e3..902cfac9 100644
--- a/wireguard-go-bridge/src/api-ios.go
+++ b/wireguard-go-bridge/src/api-ios.go
@@ -32,15 +32,14 @@ var loggerFunc unsafe.Pointer
var versionString *C.char
type CLogger struct {
- level C.int
- interfaceName string
+ level C.int
}
func (l *CLogger) Write(p []byte) (int, error) {
if uintptr(loggerFunc) == 0 {
return 0, errors.New("No logger initialized")
}
- message := C.CString(l.interfaceName + ": " + string(p))
+ message := C.CString(string(p))
C.callLogger(loggerFunc, l.level, message)
C.free(unsafe.Pointer(message))
return len(p), nil
@@ -75,17 +74,13 @@ func wgSetLogger(loggerFn uintptr) {
}
//export wgTurnOn
-func wgTurnOn(ifnameRef string, settings string, tunFd int32) int32 {
- interfaceName := string([]byte(ifnameRef))
-
+func wgTurnOn(settings string, tunFd int32) int32 {
logger := &Logger{
- Debug: log.New(&CLogger{level: 0, interfaceName: interfaceName}, "", 0),
- Info: log.New(&CLogger{level: 1, interfaceName: interfaceName}, "", 0),
- Error: log.New(&CLogger{level: 2, interfaceName: interfaceName}, "", 0),
+ Debug: log.New(&CLogger{level: 0}, "", 0),
+ Info: log.New(&CLogger{level: 1}, "", 0),
+ Error: log.New(&CLogger{level: 2}, "", 0),
}
- logger.Debug.Println("Debug log enabled")
-
tun, _, err := tun.CreateTUNFromFD(int(tunFd))
if err != nil {
logger.Error.Println(err)
diff --git a/wireguard-go-bridge/wireguard.h b/wireguard-go-bridge/wireguard.h
index fec352d5..d7183c97 100644
--- a/wireguard-go-bridge/wireguard.h
+++ b/wireguard-go-bridge/wireguard.h
@@ -12,7 +12,7 @@
typedef struct { const char *p; size_t n; } gostring_t;
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 int wgTurnOn(gostring_t settings, int32_t tun_fd);
extern void wgTurnOff(int handle);
extern int64_t wgSetConfig(int handle, gostring_t settings);
extern uint16_t wgGetListenPort(int handle);