2020-08-25 19:38:50 -04:00
|
|
|
package models
|
|
|
|
|
|
2020-08-28 08:17:04 -04:00
|
|
|
import (
|
|
|
|
|
"net"
|
2022-04-18 11:59:15 +00:00
|
|
|
|
|
|
|
|
"github.com/qdm12/gluetun/internal/constants/vpn"
|
2020-08-28 08:17:04 -04:00
|
|
|
)
|
|
|
|
|
|
2022-04-16 22:25:36 +02:00
|
|
|
type Server struct {
|
|
|
|
|
VPN string `json:"vpn,omitempty"`
|
|
|
|
|
// Surfshark: country is also used for multi-hop
|
|
|
|
|
Country string `json:"country,omitempty"`
|
2022-03-16 09:43:47 +00:00
|
|
|
Region string `json:"region,omitempty"`
|
2022-04-16 22:25:36 +02:00
|
|
|
City string `json:"city,omitempty"`
|
|
|
|
|
ISP string `json:"isp,omitempty"`
|
|
|
|
|
Owned bool `json:"owned,omitempty"`
|
|
|
|
|
Number uint16 `json:"number,omitempty"`
|
2022-03-16 09:43:47 +00:00
|
|
|
ServerName string `json:"server_name,omitempty"`
|
2022-04-16 22:25:36 +02:00
|
|
|
Hostname string `json:"hostname,omitempty"`
|
2022-03-16 09:43:47 +00:00
|
|
|
TCP bool `json:"tcp,omitempty"`
|
|
|
|
|
UDP bool `json:"udp,omitempty"`
|
2022-04-16 22:25:36 +02:00
|
|
|
OvpnX509 string `json:"x509,omitempty"`
|
|
|
|
|
RetroLoc string `json:"retroloc,omitempty"` // TODO remove in v4
|
|
|
|
|
MultiHop bool `json:"multihop,omitempty"`
|
|
|
|
|
WgPubKey string `json:"wgpubkey,omitempty"`
|
|
|
|
|
Free bool `json:"free,omitempty"`
|
|
|
|
|
Stream bool `json:"stream,omitempty"`
|
2022-03-16 09:43:47 +00:00
|
|
|
PortForward bool `json:"port_forward,omitempty"`
|
|
|
|
|
IPs []net.IP `json:"ips,omitempty"`
|
2021-02-26 12:58:58 +00:00
|
|
|
}
|
2022-04-18 11:59:15 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
}
|