From dd80fd6ab42a573707f76451a1e36c6b62f0b11a Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Mon, 19 Dec 2022 10:41:55 -0500 Subject: [PATCH 1/2] new host model --- models/host.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 models/host.go diff --git a/models/host.go b/models/host.go new file mode 100644 index 00000000..f618f8b9 --- /dev/null +++ b/models/host.go @@ -0,0 +1,33 @@ +package models + +import ( + "net" + + "github.com/google/uuid" + "golang.zx2c4.com/wireguard/wgctrl/wgtypes" +) + +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"` + HostPass string `json:"hostpass" yaml:"hostpass"` + Name string `json:"name" yaml:"name"` + OS string `json:"os" yaml:"os"` + Debug bool `json:"debug" yaml:"debug"` + NodePassword string `json:"nodepassword" yaml:"nodepassword"` + ListenPort int `json:"listenport" yaml:"listenport"` + LocalAddress net.IPNet `json:"localaddress" yaml:"localaddress"` + LocalRange net.IPNet `json:"localrange" yaml:"localrange"` + LocalListenPort int `json:"locallistenport" yaml:"locallistenport"` + ProxyListenPort int `json:"proxy_listen_port" yaml:"proxy_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:"trafficekeypublic"` + InternetGateway net.UDPAddr `json:"internetgateway" yaml:"internetgateway"` + Nodes []Node `json:"nodes" yaml:"nodes"` +} From 4f303dd4c5749f335841b3aee96034fb89f46bf1 Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Mon, 19 Dec 2022 11:03:14 -0500 Subject: [PATCH 2/2] add comment for public type --- models/host.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/host.go b/models/host.go index f618f8b9..10b9ae80 100644 --- a/models/host.go +++ b/models/host.go @@ -7,6 +7,7 @@ import ( "golang.zx2c4.com/wireguard/wgctrl/wgtypes" ) +// Host - represents a host on the network type Host struct { ID uuid.UUID `json:"id" yaml:"id"` Verbosity int `json:"verbosity" yaml:"verbosity"`