Skip to content

Commit

Permalink
util: replace net.IPNet with pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Jan 20, 2021
1 parent 680126d commit 5b9d33f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/util/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (

// NetInterface represents a list of network interfaces
type NetInterface struct {
Name string // Network interface name
MTU int // MTU
HardwareAddr string // Hardware address
Addresses []net.IP // Array with the network interface addresses
Subnets []net.IPNet // Array with CIDR addresses of this network interface
Flags string // Network interface flags (up, broadcast, etc)
Name string // Network interface name
MTU int // MTU
HardwareAddr string // Hardware address
Addresses []net.IP // Array with the network interface addresses
Subnets []*net.IPNet // Array with CIDR addresses of this network interface
Flags string // Network interface flags (up, broadcast, etc)
}

// GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
Expand Down Expand Up @@ -79,7 +79,7 @@ func GetValidNetInterfacesForWeb() ([]NetInterface, error) {
continue
}
netIface.Addresses = append(netIface.Addresses, ipNet.IP)
netIface.Subnets = append(netIface.Subnets, *ipNet)
netIface.Subnets = append(netIface.Subnets, ipNet)
}

// Discard interfaces with no addresses
Expand Down Expand Up @@ -120,7 +120,7 @@ func GetSubnet(ifaceName string) *net.IPNet {

for _, netIface := range netIfaces {
if netIface.Name == ifaceName && len(netIface.Subnets) > 0 {
return &netIface.Subnets[0]
return netIface.Subnets[0]
}
}

Expand Down

0 comments on commit 5b9d33f

Please sign in to comment.