From 4de4d76ad1ef1dc52b6e2e03c4fc81d4ea8d467e Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 14 Nov 2024 14:59:20 +0100 Subject: ProxyGuard: Add a restart function --- exports/exports.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'exports/exports.go') diff --git a/exports/exports.go b/exports/exports.go index f2fa75e..3c9c59a 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -912,6 +912,22 @@ func NewProxyguard(c C.uintptr_t, lp C.int, tcpsp C.int, peer *C.char, proxySetu return C.uintptr_t(cgo.NewHandle(proxy)), nil } +// ProxyguardRestart restarts ProxyGuard, call this when a network change happens +// +// Example Input: ```ProxyguardRestart(proxyHandle)``` +// +// Example Output: ```"failed restarting ProxyGuard"``` +// +//export ProxyguardRestart +func ProxyguardRestart(proxyH C.uintptr_t) *C.char { + pr, err := getProxy(proxyH) + if err != nil { + return getCError(err) + } + pr.Restart() + return nil +} + func getProxy(proxyH C.uintptr_t) (*proxy.Proxy, error) { h := cgo.Handle(proxyH) v, ok := h.Value().(*proxy.Proxy) -- cgit v1.2.3