mirror of
https://github.com/safing/portmaster
synced 2025-09-04 11:39:29 +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 (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: find a good way to identify a network
|
// 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
|
// windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917
|
||||||
// this info might already be included in the interfaces api provided by golang!
|
// 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.
|
// Nameserver describes a system assigned namserver.
|
||||||
type Nameserver struct {
|
type Nameserver struct {
|
||||||
IP net.IP
|
IP net.IP
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
|
@ -14,7 +15,22 @@ import (
|
||||||
"github.com/safing/portmaster/network/netutils"
|
"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 {
|
func Gateways() []*net.IP {
|
||||||
// locking
|
// locking
|
||||||
gatewaysLock.Lock()
|
gatewaysLock.Lock()
|
||||||
|
@ -101,7 +117,7 @@ func Gateways() []*net.IP {
|
||||||
return newGateways
|
return newGateways
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nameservers returns the currently active nameservers
|
// Nameservers returns the currently active nameservers.
|
||||||
func Nameservers() []Nameserver {
|
func Nameservers() []Nameserver {
|
||||||
// locking
|
// locking
|
||||||
nameserversLock.Lock()
|
nameserversLock.Lock()
|
||||||
|
|
|
@ -2,10 +2,12 @@ package netenv
|
||||||
|
|
||||||
import "net"
|
import "net"
|
||||||
|
|
||||||
|
// Nameservers returns the currently active nameservers.
|
||||||
func Nameservers() []Nameserver {
|
func Nameservers() []Nameserver {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gateways returns the currently active gateways.
|
||||||
func Gateways() []*net.IP {
|
func Gateways() []*net.IP {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue