diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-12-18 15:21:56 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-12-18 15:21:56 +0100 |
| commit | 2f3a9d0c1687e6f591ccdb7d44a36cdc09359321 (patch) | |
| tree | fcd98ab20f38852004289c2e798bda0d2473e04f | |
| parent | 64e0957cfb5e3d0b6478be2052b03f0810db2567 (diff) | |
Exports: Document ProxyGuard functions
| -rw-r--r-- | docs/md/apidocs.md | 14 | ||||
| -rw-r--r-- | exports/exports.go | 13 |
2 files changed, 21 insertions, 6 deletions
diff --git a/docs/md/apidocs.md b/docs/md/apidocs.md index a6f8b16..9fb7808 100644 --- a/docs/md/apidocs.md +++ b/docs/md/apidocs.md @@ -624,9 +624,8 @@ Signature: func NewProxyguard(c C.uintptr_t, lp C.int, tcpsp C.int, peer *C.char, proxySetup C.ProxySetup) (C.uintptr_t, *C.char) ``` -NewProxyguard creates the 'proxyguard' procedure in eduvpn-common. -eduvpn-common currently also cleans up the running ProxyGuard process in -`cleanup`. If the proxy cannot be created it returns an error. +NewProxyguard creates the 'proxyguard' procedure in eduvpn-common. If the +proxy cannot be created it returns an error. This function proxies WireGuard UDP connections over HTTP: [ProxyGuard on Codeberg](https://codeberg.org/eduvpn/proxyguard). @@ -647,7 +646,7 @@ using the `proxy` JSON key two arguments: the file descriptor (integer) and a JSON list of IPs the client connects to -Example Input: ```StartProxyGuard(myCookie, 1337, 0, "5.5.5.5:51820", +Example Input: ```NewProxyguard(myCookie, 1337, 0, "5.5.5.5:51820", proxySetupCB)``` Example Output: ```null``` @@ -659,6 +658,10 @@ Signature: func ProxyguardPeerIPs(proxyH C.uintptr_t) (*C.char, *C.char) ``` +ProxyguardPeerIPs gets the Peer IPs configured by ProxyGuard Example Input: +```ProxyguardPeerIPs(handle)``` + +Example Output: ```["1.1.1.1"], null``` ## ProxyguardTunnel Signature: @@ -667,6 +670,9 @@ Signature: func ProxyguardTunnel(c C.uintptr_t, proxyH C.uintptr_t, wglisten C.int) *C.char ``` +ProxyguardTunnel starts the tunneling for ProxyGuard `c` is the cookie +`proxyH` is the proxy handle `wglisten` is the port WireGuard is listening +on ## Register Signature: diff --git a/exports/exports.go b/exports/exports.go index 552025f..f2fa75e 100644 --- a/exports/exports.go +++ b/exports/exports.go @@ -878,7 +878,6 @@ func StartFailover(c C.uintptr_t, gateway *C.char, mtu C.int, readRxBytes C.Read } // NewProxyguard creates the 'proxyguard' procedure in eduvpn-common. -// eduvpn-common currently also cleans up the running ProxyGuard process in `cleanup`. // If the proxy cannot be created it returns an error. // // This function proxies WireGuard UDP connections over HTTP: [ProxyGuard on Codeberg](https://codeberg.org/eduvpn/proxyguard). @@ -891,7 +890,7 @@ func StartFailover(c C.uintptr_t, gateway *C.char, mtu C.int, readRxBytes C.Read // - `peer` is the `ip:port` of the remote server // - `proxySetup` is a callback which is called when the socket is setting up, this can be used for configuring routing in the client. It takes two arguments: the file descriptor (integer) and a JSON list of IPs the client connects to // -// Example Input: ```StartProxyGuard(myCookie, 1337, 0, "5.5.5.5:51820", proxySetupCB)``` +// Example Input: ```NewProxyguard(myCookie, 1337, 0, "5.5.5.5:51820", proxySetupCB)``` // // Example Output: ```null``` // @@ -922,6 +921,11 @@ func getProxy(proxyH C.uintptr_t) (*proxy.Proxy, error) { return v, nil } +// ProxyguardTunnel starts the tunneling for ProxyGuard +// `c` is the cookie +// `proxyH` is the proxy handle +// `wglisten` is the port WireGuard is listening on +// //export ProxyguardTunnel func ProxyguardTunnel(c C.uintptr_t, proxyH C.uintptr_t, wglisten C.int) *C.char { ck, err := getCookie(c) @@ -939,6 +943,11 @@ func ProxyguardTunnel(c C.uintptr_t, proxyH C.uintptr_t, wglisten C.int) *C.char return getCError(tunnelErr) } +// ProxyguardPeerIPs gets the Peer IPs configured by ProxyGuard +// Example Input: ```ProxyguardPeerIPs(handle)``` +// +// Example Output: ```["1.1.1.1"], null``` +// //export ProxyguardPeerIPs func ProxyguardPeerIPs(proxyH C.uintptr_t) (*C.char, *C.char) { pr, err := getProxy(proxyH) |
