From 8b0123042f54d843301fbef458b249fcf12466d2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 20 Nov 2019 11:44:34 +0100 Subject: Implement statistics Signed-off-by: Jason A. Donenfeld --- app/tools/libwg-go/api-android.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/tools/libwg-go/api-android.go') diff --git a/app/tools/libwg-go/api-android.go b/app/tools/libwg-go/api-android.go index 7e951b9c..7a393cae 100644 --- a/app/tools/libwg-go/api-android.go +++ b/app/tools/libwg-go/api-android.go @@ -15,6 +15,7 @@ import ( "golang.zx2c4.com/wireguard/device" "golang.zx2c4.com/wireguard/ipc" "golang.zx2c4.com/wireguard/tun" + "bytes" "log" "math" "net" @@ -168,6 +169,22 @@ func wgGetSocketV6(tunnelHandle int32) int32 { return int32(fd) } +//export wgGetConfig +func wgGetConfig(tunnelHandle int32) *C.char { + handle, ok := tunnelHandles[tunnelHandle] + if !ok { + return nil + } + settings := new(bytes.Buffer) + writer := bufio.NewWriter(settings) + err := handle.device.IpcGetOperation(writer) + if err != nil { + return nil + } + writer.Flush() + return C.CString(settings.String()) +} + //export wgVersion func wgVersion() *C.char { return C.CString(device.WireGuardGoVersion) -- cgit v1.2.3