linter fixes

This commit is contained in:
ston1th 2021-11-07 13:30:22 +01:00
commit df5babf6c8
15 changed files with 49 additions and 55 deletions

View file

@ -27,7 +27,7 @@ func DefaultInterface() (iface string, err error) {
}
type Network struct {
sync.Mutex
mu sync.Mutex
m map[string]struct{}
iface string
label string
@ -76,8 +76,8 @@ func (n *Network) HasIP(a *netlink.Addr) bool {
}
func (n *Network) AddIP(cidr string) error {
n.Lock()
defer n.Unlock()
n.mu.Lock()
defer n.mu.Unlock()
addr, err := netlink.ParseAddr(cidr)
if err != nil {
return err
@ -97,8 +97,8 @@ func (n *Network) AddIP(cidr string) error {
}
func (n *Network) DeleteIP(cidr string) error {
n.Lock()
defer n.Unlock()
n.mu.Lock()
defer n.mu.Unlock()
addr, err := netlink.ParseAddr(cidr)
if err != nil {
return err
@ -115,8 +115,8 @@ func (n *Network) DeleteIP(cidr string) error {
}
func (n *Network) GetIPs() (cidrs []string) {
n.Lock()
defer n.Unlock()
n.mu.Lock()
defer n.mu.Unlock()
cidrs = make([]string, len(n.m))
c := 0
for k := range n.m {