summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-22 16:03:28 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-23 10:40:50 +0100
commit84d3ab740d0637a88537e54110b8a6486c3bd118 (patch)
treeed2596e811b1c685d61c5e715f3e5db47e53fe8f /exports
parentecd4b03aa7d2902e954115a4e1b6648464c77796 (diff)
Client + Exports: Update to latest proxyguard API
- Add a ClientProxyReady callback - do a DNS request for the IPs
Diffstat (limited to 'exports')
-rw-r--r--exports/exports.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/exports/exports.go b/exports/exports.go
index 63f57f3..b5f9042 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -24,6 +24,7 @@ typedef int (*StateCB)(int oldstate, int newstate, void* data);
typedef void (*TokenGetter)(const char* server_id, int server_type, char* out, size_t len);
typedef void (*TokenSetter)(const char* server_id, int server_type, const char* tokens);
typedef void (*ProxyFD)(int fd);
+typedef void (*ProxyReady)();
static long long int get_read_rx_bytes(ReadRxBytes read)
{
@@ -45,6 +46,10 @@ static void call_proxy_fd(ProxyFD proxyfd, int fd)
{
proxyfd(fd);
}
+static void call_proxy_ready(ProxyReady ready)
+{
+ ready();
+}
*/
import "C"
@@ -907,11 +912,12 @@ func StartFailover(c C.uintptr_t, gateway *C.char, mtu C.int, readRxBytes C.Read
// - `peer` is the ip:port of the remote server
// - `proxyFD` is a callback with the file descriptor as only argument. It can be used to set certain
// socket option, e.g. to exclude the proxy connection from going over the VPN
+// - `proxyReady` is a callback when the proxy is ready to be used
//
// If the proxy cannot be started it returns an error
//
//export StartProxyguard
-func StartProxyguard(c C.uintptr_t, listen *C.char, tcpsp C.int, peer *C.char, proxyFD C.ProxyFD) *C.char {
+func StartProxyguard(c C.uintptr_t, listen *C.char, tcpsp C.int, peer *C.char, proxyFD C.ProxyFD, proxyReady C.ProxyReady) *C.char {
state, stateErr := getVPNState()
if stateErr != nil {
return getCError(stateErr)
@@ -926,6 +932,8 @@ func StartProxyguard(c C.uintptr_t, listen *C.char, tcpsp C.int, peer *C.char, p
return
}
C.call_proxy_fd(proxyFD, C.int(fd))
+ }, func() {
+ C.call_proxy_ready(proxyReady)
})
return getCError(proxyErr)
}