diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-11-14 14:59:20 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-12-19 10:50:36 +0100 |
| commit | 4de4d76ad1ef1dc52b6e2e03c4fc81d4ea8d467e (patch) | |
| tree | f09aadb416c61c94eb703d950b1689645aad4c4c /exports/exports.go | |
| parent | 2f3a9d0c1687e6f591ccdb7d44a36cdc09359321 (diff) | |
ProxyGuard: Add a restart function
Diffstat (limited to 'exports/exports.go')
| -rw-r--r-- | exports/exports.go | 16 |
1 files changed, 16 insertions, 0 deletions
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) |
