diff options
Diffstat (limited to 'internal/wireguard')
| -rw-r--r-- | internal/wireguard/ini/ini.go | 2 | ||||
| -rw-r--r-- | internal/wireguard/wireguard.go | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/internal/wireguard/ini/ini.go b/internal/wireguard/ini/ini.go index 6791336..597fd83 100644 --- a/internal/wireguard/ini/ini.go +++ b/internal/wireguard/ini/ini.go @@ -1,4 +1,4 @@ -// package ini implements an opinionated ini parser that only implements what we exactly need for WireGuard configs +// Package ini implements an opinionated ini parser that only implements what we exactly need for WireGuard configs // - key/values MUST live under a section // - empty section names are NOT allowed // - comments are indicated with a # diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go index af290ea..e94a485 100644 --- a/internal/wireguard/wireguard.go +++ b/internal/wireguard/wireguard.go @@ -36,12 +36,17 @@ func availableUDPPort() (int, error) { return ludp.LocalAddr().(*net.UDPAddr).Port, nil } +// Proxy is the proxyguard information type Proxy struct { + // SourcePort is the source port of the TCP socket SourcePort int - Listen string - Peer string + // Listen is the IP:PORT of the udp listener + Listen string + // Peer is the hostname/ip:port of the WireGuard peer + Peer string } +// Config gets a wireguard config with API config `cfg`, wg key `key` and prefer tcp `tcp` func Config(cfg string, key *wgtypes.Key, tcp bool) (string, *Proxy, error) { // the key is nil if the client does not accept WireGuard if key == nil { |
