Maint: WIREGUARD_PORT to WIREGUARD_ENDPOINT_PORT

This commit is contained in:
Quentin McGaw (desktop)
2021-09-13 20:06:47 +00:00
parent 8645d978ba
commit 2cf7f7b268
6 changed files with 30 additions and 15 deletions

View File

@@ -180,11 +180,15 @@ func readOpenVPNCustomPort(env params.Interface, tcp bool,
// note: set allowed to an empty slice to allow all valid ports
func readWireguardCustomPort(env params.Interface, allowed []uint16) (port uint16, err error) {
port, err = readPortOrZero(env, "WIREGUARD_PORT")
port, err = readPortOrZero(env, "WIREGUARD_ENDPOINT_PORT")
if err != nil {
return 0, fmt.Errorf("environment variable WIREGUARD_PORT: %w", err)
return 0, fmt.Errorf("environment variable WIREGUARD_ENDPOINT_PORT: %w", err)
} else if port == 0 {
return 0, nil
port, _ = readPortOrZero(env, "WIREGUARD_PORT")
if err == nil {
return port, nil // 0 or WIREGUARD_PORT value
}
return 0, nil // default 0
}
if len(allowed) == 0 {