summaryrefslogtreecommitdiff
path: root/client/proxy.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-02-07 13:48:30 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-02-19 14:15:07 +0100
commit16ac79c9de0dcdc2be7f5bf1c337c514ec2b757c (patch)
tree82693fa6f55168eb3957f3d683009d8195306714 /client/proxy.go
parent27a3ffe6d065ffe53c11f7629ba29987e39b8aeb (diff)
Client: Refactor to newest internal API
Diffstat (limited to 'client/proxy.go')
-rw-r--r--client/proxy.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/proxy.go b/client/proxy.go
new file mode 100644
index 0000000..0e78792
--- /dev/null
+++ b/client/proxy.go
@@ -0,0 +1,28 @@
+package client
+
+import (
+ "codeberg.org/eduVPN/proxyguard"
+ "github.com/eduvpn/eduvpn-common/i18nerr"
+ "github.com/eduvpn/eduvpn-common/internal/log"
+ "github.com/eduvpn/eduvpn-common/types/cookie"
+)
+
+type ProxyLogger struct{}
+
+func (pl *ProxyLogger) Logf(msg string, params ...interface{}) {
+ log.Logger.Debugf(msg, params...)
+}
+
+func (pl *ProxyLogger) Log(msg string) {
+ log.Logger.Debugf("%s", msg)
+}
+
+func (c *Client) StartProxyguard(ck *cookie.Cookie, listen string, tcpsp int, peer string) error {
+ var err error
+ proxyguard.UpdateLogger(&ProxyLogger{})
+ err = proxyguard.Client(ck.Context(), listen, tcpsp, peer, -1)
+ if err != nil {
+ return i18nerr.Wrap(err, "The VPN proxy exited")
+ }
+ return err
+}