summaryrefslogtreecommitdiff
path: root/internal/wireguard
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-10-23 11:31:39 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-10-29 12:08:36 +0100
commite85070a3fb601e1872d121ce3c1c9d39f8f41036 (patch)
tree96d57bf647f2cdc3408ad5c3163ca91ed571cb63 /internal/wireguard
parent0076386bca8b1e49673f50323cd147ac080cfc2f (diff)
All: Refactor to latest ProxyGuard
Diffstat (limited to 'internal/wireguard')
-rw-r--r--internal/wireguard/wireguard.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go
index a70f21a..9239835 100644
--- a/internal/wireguard/wireguard.go
+++ b/internal/wireguard/wireguard.go
@@ -40,8 +40,8 @@ func availableUDPPort() (int, error) {
type Proxy struct {
// SourcePort is the source port of the TCP socket
SourcePort int
- // Listen is the IP:PORT of the udp listener
- Listen string
+ // ListenPort is the PORT of the udp listener
+ ListenPort int
// Peer is the hostname/ip:port of the WireGuard peer
Peer string
}
@@ -54,22 +54,23 @@ func Config(cfg string, key *wgtypes.Key, proxy bool) (string, *Proxy, error) {
}
var tcpp int
- var plisten string
+ var udpp int
var err error
+ var udpl string
if proxy {
tcpp, err = availableTCPPort()
if err != nil {
return "", nil, err
}
- udpp, err := availableUDPPort()
+ udpp, err = availableUDPPort()
if err != nil {
return "", nil, err
}
- plisten = fmt.Sprintf("127.0.0.1:%d", udpp)
+ udpl = fmt.Sprintf("127.0.0.1:%d", udpp)
}
- rcfg, peer, err := configReplace(cfg, *key, plisten)
+ rcfg, peer, err := configReplace(cfg, *key, udpl)
if err != nil {
return "", nil, err
}
@@ -77,7 +78,7 @@ func Config(cfg string, key *wgtypes.Key, proxy bool) (string, *Proxy, error) {
if proxy {
retP = &Proxy{
SourcePort: tcpp,
- Listen: plisten,
+ ListenPort: udpp,
Peer: peer,
}
}