mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
Fix netenv linter errors
This commit is contained in:
parent
fd4f059ebb
commit
881c269c1b
4 changed files with 20 additions and 35 deletions
|
@ -1,12 +0,0 @@
|
|||
// +build !linux
|
||||
|
||||
package netenv
|
||||
|
||||
func getNameserversFromDbus() ([]Nameserver, error) {
|
||||
var nameservers []Nameserver
|
||||
return nameservers, nil
|
||||
}
|
||||
|
||||
func getConnectivityStateFromDbus() (OnlineStatus, error) {
|
||||
return StatusUnknown, nil
|
||||
}
|
|
@ -2,8 +2,6 @@ package netenv
|
|||
|
||||
import (
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TODO: find a good way to identify a network
|
||||
|
@ -15,25 +13,6 @@ import (
|
|||
// windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917
|
||||
// this info might already be included in the interfaces api provided by golang!
|
||||
|
||||
const (
|
||||
gatewaysRecheck = 2 * time.Second
|
||||
nameserversRecheck = 2 * time.Second
|
||||
)
|
||||
|
||||
var (
|
||||
// interfaces = make(map[*net.IP]net.Flags)
|
||||
// interfacesLock sync.Mutex
|
||||
// interfacesExpires = time.Now()
|
||||
|
||||
gateways = make([]*net.IP, 0)
|
||||
gatewaysLock sync.Mutex
|
||||
gatewaysExpires = time.Now()
|
||||
|
||||
nameservers = make([]Nameserver, 0)
|
||||
nameserversLock sync.Mutex
|
||||
nameserversExpires = time.Now()
|
||||
)
|
||||
|
||||
// Nameserver describes a system assigned namserver.
|
||||
type Nameserver struct {
|
||||
IP net.IP
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
|
@ -14,7 +15,22 @@ import (
|
|||
"github.com/safing/portmaster/network/netutils"
|
||||
)
|
||||
|
||||
// Gateways returns the currently active gateways
|
||||
const (
|
||||
gatewaysRecheck = 2 * time.Second
|
||||
nameserversRecheck = 2 * time.Second
|
||||
)
|
||||
|
||||
var (
|
||||
gateways = make([]*net.IP, 0)
|
||||
gatewaysLock sync.Mutex
|
||||
gatewaysExpires = time.Now()
|
||||
|
||||
nameservers = make([]Nameserver, 0)
|
||||
nameserversLock sync.Mutex
|
||||
nameserversExpires = time.Now()
|
||||
)
|
||||
|
||||
// Gateways returns the currently active gateways.
|
||||
func Gateways() []*net.IP {
|
||||
// locking
|
||||
gatewaysLock.Lock()
|
||||
|
@ -101,7 +117,7 @@ func Gateways() []*net.IP {
|
|||
return newGateways
|
||||
}
|
||||
|
||||
// Nameservers returns the currently active nameservers
|
||||
// Nameservers returns the currently active nameservers.
|
||||
func Nameservers() []Nameserver {
|
||||
// locking
|
||||
nameserversLock.Lock()
|
||||
|
|
|
@ -2,10 +2,12 @@ package netenv
|
|||
|
||||
import "net"
|
||||
|
||||
// Nameservers returns the currently active nameservers.
|
||||
func Nameservers() []Nameserver {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Gateways returns the currently active gateways.
|
||||
func Gateways() []*net.IP {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue