-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into userspace-router
- Loading branch information
Showing
20 changed files
with
280 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package configs | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
) | ||
|
||
var StateDir string | ||
|
||
func init() { | ||
StateDir = os.Getenv("NB_STATE_DIR") | ||
if StateDir != "" { | ||
return | ||
} | ||
switch runtime.GOOS { | ||
case "windows": | ||
StateDir = filepath.Join(os.Getenv("PROGRAMDATA"), "Netbird") | ||
case "darwin", "linux": | ||
StateDir = "/var/lib/netbird" | ||
case "freebsd", "openbsd", "netbsd", "dragonfly": | ||
StateDir = "/var/db/netbird" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//go:build !android | ||
|
||
package dns | ||
|
||
import ( | ||
"github.com/netbirdio/netbird/client/configs" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
var fileUncleanShutdownResolvConfLocation string | ||
|
||
func init() { | ||
fileUncleanShutdownResolvConfLocation = os.Getenv("NB_UNCLEAN_SHUTDOWN_RESOLV_FILE") | ||
if fileUncleanShutdownResolvConfLocation == "" { | ||
fileUncleanShutdownResolvConfLocation = filepath.Join(configs.StateDir, "resolv.conf") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
package statemanager | ||
|
||
import ( | ||
"github.com/netbirdio/netbird/client/configs" | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
) | ||
|
||
// GetDefaultStatePath returns the path to the state file based on the operating system | ||
// It returns an empty string if the path cannot be determined. | ||
func GetDefaultStatePath() string { | ||
switch runtime.GOOS { | ||
case "windows": | ||
return filepath.Join(os.Getenv("PROGRAMDATA"), "Netbird", "state.json") | ||
case "darwin", "linux": | ||
return "/var/lib/netbird/state.json" | ||
case "freebsd", "openbsd", "netbsd", "dragonfly": | ||
return "/var/db/netbird/state.json" | ||
if path := os.Getenv("NB_DNS_STATE_FILE"); path != "" { | ||
return path | ||
} | ||
|
||
return "" | ||
|
||
return filepath.Join(configs.StateDir, "state.json") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.