|
@@ -1,11 +1,12 @@
|
|
package models
|
|
package models
|
|
|
|
|
|
import (
|
|
import (
|
|
- "github.com/google/uuid"
|
|
|
|
- "golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
|
|
"net"
|
|
"net"
|
|
"net/netip"
|
|
"net/netip"
|
|
"time"
|
|
"time"
|
|
|
|
+
|
|
|
|
+ "github.com/google/uuid"
|
|
|
|
+ "golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
)
|
|
)
|
|
|
|
|
|
// OS_Types - list of OS types Netmaker cares about
|
|
// OS_Types - list of OS types Netmaker cares about
|
|
@@ -33,39 +34,42 @@ var NAT_Types = struct {
|
|
}
|
|
}
|
|
|
|
|
|
// WIREGUARD_INTERFACE name of wireguard interface
|
|
// WIREGUARD_INTERFACE name of wireguard interface
|
|
-const WIREGUARD_INTERFACE = "netmaker"
|
|
|
|
|
|
+const (
|
|
|
|
+ WIREGUARD_INTERFACE = "netmaker"
|
|
|
|
+ DefaultPersistentKeepAlive = 20 * time.Second
|
|
|
|
+)
|
|
|
|
|
|
// Host - represents a host on the network
|
|
// Host - represents a host on the network
|
|
type Host struct {
|
|
type Host struct {
|
|
- ID uuid.UUID `json:"id" yaml:"id"`
|
|
|
|
- Verbosity int `json:"verbosity" yaml:"verbosity"`
|
|
|
|
- FirewallInUse string `json:"firewallinuse" yaml:"firewallinuse"`
|
|
|
|
- Version string `json:"version" yaml:"version"`
|
|
|
|
- IPForwarding bool `json:"ipforwarding" yaml:"ipforwarding"`
|
|
|
|
- DaemonInstalled bool `json:"daemoninstalled" yaml:"daemoninstalled"`
|
|
|
|
- AutoUpdate bool `json:"autoupdate" yaml:"autoupdate"`
|
|
|
|
- HostPass string `json:"hostpass" yaml:"hostpass"`
|
|
|
|
- Name string `json:"name" yaml:"name"`
|
|
|
|
- OS string `json:"os" yaml:"os"`
|
|
|
|
- Interface string `json:"interface" yaml:"interface"`
|
|
|
|
- Debug bool `json:"debug" yaml:"debug"`
|
|
|
|
- ListenPort int `json:"listenport" yaml:"listenport"`
|
|
|
|
- WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"`
|
|
|
|
- MTU int `json:"mtu" yaml:"mtu"`
|
|
|
|
- PublicKey wgtypes.Key `json:"publickey" yaml:"publickey"`
|
|
|
|
- MacAddress net.HardwareAddr `json:"macaddress" yaml:"macaddress"`
|
|
|
|
- TrafficKeyPublic []byte `json:"traffickeypublic" yaml:"traffickeypublic"`
|
|
|
|
- Nodes []string `json:"nodes" yaml:"nodes"`
|
|
|
|
- Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
|
|
|
|
- DefaultInterface string `json:"defaultinterface" yaml:"defaultinterface"`
|
|
|
|
- EndpointIP net.IP `json:"endpointip" yaml:"endpointip"`
|
|
|
|
- IsDocker bool `json:"isdocker" yaml:"isdocker"`
|
|
|
|
- IsK8S bool `json:"isk8s" yaml:"isk8s"`
|
|
|
|
- IsStatic bool `json:"isstatic" yaml:"isstatic"`
|
|
|
|
- IsDefault bool `json:"isdefault" yaml:"isdefault"`
|
|
|
|
- NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"`
|
|
|
|
|
|
+ ID uuid.UUID `json:"id" yaml:"id"`
|
|
|
|
+ Verbosity int `json:"verbosity" yaml:"verbosity"`
|
|
|
|
+ FirewallInUse string `json:"firewallinuse" yaml:"firewallinuse"`
|
|
|
|
+ Version string `json:"version" yaml:"version"`
|
|
|
|
+ IPForwarding bool `json:"ipforwarding" yaml:"ipforwarding"`
|
|
|
|
+ DaemonInstalled bool `json:"daemoninstalled" yaml:"daemoninstalled"`
|
|
|
|
+ AutoUpdate bool `json:"autoupdate" yaml:"autoupdate"`
|
|
|
|
+ HostPass string `json:"hostpass" yaml:"hostpass"`
|
|
|
|
+ Name string `json:"name" yaml:"name"`
|
|
|
|
+ OS string `json:"os" yaml:"os"`
|
|
|
|
+ Interface string `json:"interface" yaml:"interface"`
|
|
|
|
+ Debug bool `json:"debug" yaml:"debug"`
|
|
|
|
+ ListenPort int `json:"listenport" yaml:"listenport"`
|
|
|
|
+ WgPublicListenPort int `json:"wg_public_listen_port" yaml:"wg_public_listen_port"`
|
|
|
|
+ MTU int `json:"mtu" yaml:"mtu"`
|
|
|
|
+ PublicKey wgtypes.Key `json:"publickey" yaml:"publickey"`
|
|
|
|
+ MacAddress net.HardwareAddr `json:"macaddress" yaml:"macaddress"`
|
|
|
|
+ TrafficKeyPublic []byte `json:"traffickeypublic" yaml:"traffickeypublic"`
|
|
|
|
+ Nodes []string `json:"nodes" yaml:"nodes"`
|
|
|
|
+ Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
|
|
|
|
+ DefaultInterface string `json:"defaultinterface" yaml:"defaultinterface"`
|
|
|
|
+ EndpointIP net.IP `json:"endpointip" yaml:"endpointip"`
|
|
|
|
+ IsDocker bool `json:"isdocker" yaml:"isdocker"`
|
|
|
|
+ IsK8S bool `json:"isk8s" yaml:"isk8s"`
|
|
|
|
+ IsStatic bool `json:"isstatic" yaml:"isstatic"`
|
|
|
|
+ IsDefault bool `json:"isdefault" yaml:"isdefault"`
|
|
|
|
+ NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"`
|
|
TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"`
|
|
TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"`
|
|
- PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"`
|
|
|
|
|
|
+ PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"`
|
|
}
|
|
}
|
|
|
|
|
|
// FormatBool converts a boolean to a [yes|no] string
|
|
// FormatBool converts a boolean to a [yes|no] string
|