mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-04 14:03:35 +01:00
9203690033
Code cleaning around the util/net package. The goal was to write a more understandable source code but modify nothing on the logic. Protect the WireGuard UDP listeners with marks. The implementation can support the VPN permission revocation events in thread safe way. It will be important if we start to support the running time route and DNS update features. - uniformize the file name convention: [struct_name] _ [functions] _ [os].go - code cleaning in net_linux.go - move env variables to env.go file
30 lines
583 B
Go
30 lines
583 B
Go
package net
|
|
|
|
import (
|
|
"os"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/netbirdio/netbird/client/iface/netstack"
|
|
)
|
|
|
|
const (
|
|
envDisableCustomRouting = "NB_DISABLE_CUSTOM_ROUTING"
|
|
envSkipSocketMark = "NB_SKIP_SOCKET_MARK"
|
|
)
|
|
|
|
func CustomRoutingDisabled() bool {
|
|
if netstack.IsEnabled() {
|
|
return true
|
|
}
|
|
return os.Getenv(envDisableCustomRouting) == "true"
|
|
}
|
|
|
|
func SkipSocketMark() bool {
|
|
if skipSocketMark := os.Getenv(envSkipSocketMark); skipSocketMark == "true" {
|
|
log.Infof("%s is set to true, skipping SO_MARK", envSkipSocketMark)
|
|
return true
|
|
}
|
|
return false
|
|
}
|