diff options
-rw-r--r-- | tunnel/tools/libwg-go/api-android.go | 22 | ||||
-rw-r--r-- | tunnel/tools/libwg-go/go.mod | 2 | ||||
-rw-r--r-- | tunnel/tools/libwg-go/go.sum | 4 |
3 files changed, 19 insertions, 9 deletions
diff --git a/tunnel/tools/libwg-go/api-android.go b/tunnel/tools/libwg-go/api-android.go index 7a393cae..70c1c0c9 100644 --- a/tunnel/tools/libwg-go/api-android.go +++ b/tunnel/tools/libwg-go/api-android.go @@ -11,10 +11,6 @@ import "C" import ( "bufio" - "golang.org/x/sys/unix" - "golang.zx2c4.com/wireguard/device" - "golang.zx2c4.com/wireguard/ipc" - "golang.zx2c4.com/wireguard/tun" "bytes" "log" "math" @@ -24,6 +20,12 @@ import ( "runtime" "strings" "unsafe" + + "golang.org/x/sys/unix" + "golang.zx2c4.com/wireguard/conn" + "golang.zx2c4.com/wireguard/device" + "golang.zx2c4.com/wireguard/ipc" + "golang.zx2c4.com/wireguard/tun" ) type AndroidLogger struct { @@ -149,7 +151,11 @@ func wgGetSocketV4(tunnelHandle int32) int32 { if !ok { return -1 } - fd, err := handle.device.PeekLookAtSocketFd4() + bind, _ := handle.device.Bind().(conn.PeekLookAtSocketFd) + if bind == nil { + return -1 + } + fd, err := bind.PeekLookAtSocketFd4() if err != nil { return -1 } @@ -162,7 +168,11 @@ func wgGetSocketV6(tunnelHandle int32) int32 { if !ok { return -1 } - fd, err := handle.device.PeekLookAtSocketFd6() + bind, _ := handle.device.Bind().(conn.PeekLookAtSocketFd) + if bind == nil { + return -1 + } + fd, err := bind.PeekLookAtSocketFd4() if err != nil { return -1 } diff --git a/tunnel/tools/libwg-go/go.mod b/tunnel/tools/libwg-go/go.mod index ee3000e0..83339628 100644 --- a/tunnel/tools/libwg-go/go.mod +++ b/tunnel/tools/libwg-go/go.mod @@ -6,5 +6,5 @@ require ( golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 // indirect golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 - golang.zx2c4.com/wireguard v0.0.20200321-0.20200607075020-f28a6d244b51 + golang.zx2c4.com/wireguard v0.0.20200321-0.20200622004228-b84f1d4db25e ) diff --git a/tunnel/tools/libwg-go/go.sum b/tunnel/tools/libwg-go/go.sum index 5052c1c5..2ad39e3c 100644 --- a/tunnel/tools/libwg-go/go.sum +++ b/tunnel/tools/libwg-go/go.sum @@ -16,5 +16,5 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.zx2c4.com/wireguard v0.0.20200321-0.20200607075020-f28a6d244b51 h1:ugWU6UlpjJ5V6lbaiFQwTEBpyZZiW3t66huDFuMXAc0= -golang.zx2c4.com/wireguard v0.0.20200321-0.20200607075020-f28a6d244b51/go.mod h1:GJvYs5O24/ASlwPiRklVnjMx2xQzrOic0DuU6GvYJL4= +golang.zx2c4.com/wireguard v0.0.20200321-0.20200622004228-b84f1d4db25e h1:f8BS3yEMeIGx/zzJfihxDRedx6lT7EiJlfih4j6LY98= +golang.zx2c4.com/wireguard v0.0.20200321-0.20200622004228-b84f1d4db25e/go.mod h1:GJvYs5O24/ASlwPiRklVnjMx2xQzrOic0DuU6GvYJL4= |