Skip to content

Commit

Permalink
prune(NET-483): remove defunct host.internetgateway field (#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceix authored Aug 2, 2023
1 parent 0c70c4d commit 91859c2
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion logic/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func UpdateHost(newHost, currentHost *models.Host) {
newHost.Debug = currentHost.Debug
newHost.Nodes = currentHost.Nodes
newHost.PublicKey = currentHost.PublicKey
newHost.InternetGateway = currentHost.InternetGateway
newHost.TrafficKeyPublic = currentHost.TrafficKeyPublic

// changeable fields
Expand Down
6 changes: 0 additions & 6 deletions models/api_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type ApiHost struct {
EndpointIP string `json:"endpointip" yaml:"endpointip"`
PublicKey string `json:"publickey"`
MacAddress string `json:"macaddress"`
InternetGateway string `json:"internetgateway"`
Nodes []string `json:"nodes"`
IsDefault bool `json:"isdefault" yaml:"isdefault"`
IsRelayed bool `json:"isrelayed" bson:"isrelayed" yaml:"isrelayed"`
Expand All @@ -45,10 +44,6 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost {
a.Interfaces[i].AddressString = a.Interfaces[i].Address.String()
}
a.DefaultInterface = h.DefaultInterface
a.InternetGateway = h.InternetGateway.String()
if isEmptyAddr(a.InternetGateway) {
a.InternetGateway = ""
}
a.IsStatic = h.IsStatic
a.ListenPort = h.ListenPort
a.MTU = h.MTU
Expand Down Expand Up @@ -83,7 +78,6 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
h.Interface = currentHost.Interface
h.Interfaces = currentHost.Interfaces
h.DefaultInterface = currentHost.DefaultInterface
h.InternetGateway = currentHost.InternetGateway
h.IsDocker = currentHost.IsDocker
h.IsK8S = currentHost.IsK8S
h.IsStatic = a.IsStatic
Expand Down
1 change: 0 additions & 1 deletion models/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ type Host struct {
PublicKey wgtypes.Key `json:"publickey" yaml:"publickey"`
MacAddress net.HardwareAddr `json:"macaddress" yaml:"macaddress"`
TrafficKeyPublic []byte `json:"traffickeypublic" yaml:"traffickeypublic"`
InternetGateway net.UDPAddr `json:"internetgateway" yaml:"internetgateway"`
Nodes []string `json:"nodes" yaml:"nodes"`
Interfaces []Iface `json:"interfaces" yaml:"interfaces"`
DefaultInterface string `json:"defaultinterface" yaml:"defaultinterface"`
Expand Down
5 changes: 0 additions & 5 deletions models/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,6 @@ func (ln *LegacyNode) ConvertToNewNode() (*Host, *Node) {
host.PublicKey, _ = wgtypes.ParseKey(ln.PublicKey)
host.MacAddress, _ = net.ParseMAC(ln.MacAddress)
host.TrafficKeyPublic = ln.TrafficKeys.Mine
gateway, err := net.ResolveUDPAddr("udp", ln.InternetGateway)
if err == nil {
host.InternetGateway = *gateway
}
id, _ := uuid.Parse(ln.ID)
host.Nodes = append(host.Nodes, id.String())
host.Interfaces = ln.Interfaces
Expand Down Expand Up @@ -572,7 +568,6 @@ func (n *Node) Legacy(h *Host, s *ServerConfig, net *Network) *LegacyNode {
l.TrafficKeys.Mine = h.TrafficKeyPublic
l.TrafficKeys.Server = s.TrafficKey
l.FirewallInUse = h.FirewallInUse
l.InternetGateway = h.InternetGateway.String()
l.Connected = formatBool(n.Connected)
//l.PendingDelete = formatBool(n.PendingDelete)
l.DefaultACL = n.DefaultACL
Expand Down

0 comments on commit 91859c2

Please sign in to comment.