chore(servers): remove "udp": true for Wireguard

This commit is contained in:
Quentin McGaw
2022-08-25 13:24:22 +00:00
parent d1c5e00df8
commit 4ace99f318
7 changed files with 30 additions and 939 deletions

View File

@@ -39,7 +39,8 @@ var (
ErrVPNFieldEmpty = errors.New("vpn field is empty")
ErrHostnameFieldEmpty = errors.New("hostname field is empty")
ErrIPsFieldEmpty = errors.New("ips field is empty")
ErrNoNetworkProtocol = errors.New("both TCP and UDP fields are false")
ErrNoNetworkProtocol = errors.New("both TCP and UDP fields are false for OpenVPN")
ErrNetworkProtocolSet = errors.New("no network protocol should be set")
ErrWireguardPublicKeyEmpty = errors.New("wireguard public key field is empty")
)
@@ -51,7 +52,9 @@ func (s *Server) HasMinimumInformation() (err error) {
return ErrHostnameFieldEmpty
case len(s.IPs) == 0:
return ErrIPsFieldEmpty
case !s.TCP && !s.UDP:
case s.VPN == vpn.Wireguard && (s.TCP || s.UDP):
return ErrNetworkProtocolSet
case s.VPN == vpn.OpenVPN && !s.TCP && !s.UDP:
return ErrNoNetworkProtocol
case s.VPN == vpn.Wireguard && s.WgPubKey == "":
return ErrWireguardPublicKeyEmpty