From 74e36f0ead717105f26087c2cab08b41ba5a7ce8 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 12 Feb 2024 19:18:05 +0100 Subject: All: Document everything to pass revive lint --- internal/wireguard/ini/ini.go | 2 +- internal/wireguard/wireguard.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'internal/wireguard') 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 { -- cgit v1.2.3