chore(storage): runtime defaults on servers data
- `openvpn` default VPN protocol for servers - True UDP if VPN protocol is Wireguard
This commit is contained in:
@@ -2,6 +2,8 @@ package models
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
@@ -26,3 +28,15 @@ type Server struct {
|
||||
PortForward bool `json:"port_forward,omitempty"`
|
||||
IPs []net.IP `json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
func (s *Server) setDefaults() {
|
||||
// TODO v4 precise these in servers.json rather than here
|
||||
if s.VPN == "" {
|
||||
s.VPN = vpn.OpenVPN
|
||||
}
|
||||
|
||||
if s.VPN == vpn.Wireguard {
|
||||
s.UDP = true
|
||||
s.TCP = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user