mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-01 04:32:40 +08:00
adding freebsd logic for static config
This commit is contained in:
@@ -91,12 +91,18 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ncutils.IsFreeBSD() {
|
||||||
|
cfg.Node.UDPHolePunch = "no"
|
||||||
|
cfg.Node.IsStatic = "yes"
|
||||||
|
}
|
||||||
|
|
||||||
// differentiate between client/server here
|
// differentiate between client/server here
|
||||||
var node models.Node // fill this node with appropriate calls
|
var node models.Node // fill this node with appropriate calls
|
||||||
postnode := &models.Node{
|
postnode := &models.Node{
|
||||||
Password: cfg.Node.Password,
|
Password: cfg.Node.Password,
|
||||||
MacAddress: cfg.Node.MacAddress,
|
MacAddress: cfg.Node.MacAddress,
|
||||||
AccessKey: cfg.Server.AccessKey,
|
AccessKey: cfg.Server.AccessKey,
|
||||||
|
IsStatic: cfg.Node.IsStatic,
|
||||||
Network: cfg.Network,
|
Network: cfg.Network,
|
||||||
ListenPort: cfg.Node.ListenPort,
|
ListenPort: cfg.Node.ListenPort,
|
||||||
PostUp: cfg.Node.PostUp,
|
PostUp: cfg.Node.PostUp,
|
||||||
@@ -165,6 +171,11 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
|
|||||||
}
|
}
|
||||||
node.Endpoint = node.LocalAddress
|
node.Endpoint = node.LocalAddress
|
||||||
}
|
}
|
||||||
|
if ncutils.IsFreeBSD() {
|
||||||
|
node.UDPHolePunch = "no"
|
||||||
|
cfg.Node.IsStatic = "yes"
|
||||||
|
}
|
||||||
|
|
||||||
if node.IsServer != "yes" { // == handle client side ==
|
if node.IsServer != "yes" { // == handle client side ==
|
||||||
err = config.ModConfig(&node)
|
err = config.ModConfig(&node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ func IsLinux() bool {
|
|||||||
return runtime.GOOS == "linux"
|
return runtime.GOOS == "linux"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsLinux - checks if is linux
|
||||||
|
func IsFreeBSD() bool {
|
||||||
|
return runtime.GOOS == "freebsd"
|
||||||
|
}
|
||||||
|
|
||||||
// GetWireGuard - checks if wg is installed
|
// GetWireGuard - checks if wg is installed
|
||||||
func GetWireGuard() string {
|
func GetWireGuard() string {
|
||||||
userspace := os.Getenv("WG_QUICK_USERSPACE_IMPLEMENTATION")
|
userspace := os.Getenv("WG_QUICK_USERSPACE_IMPLEMENTATION")
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ func SetWGConfig(network string, peerupdate bool) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if peerupdate && runtime.GOOS != "freebsd"{
|
if peerupdate {
|
||||||
var iface string
|
var iface string
|
||||||
iface = nodecfg.Interface
|
iface = nodecfg.Interface
|
||||||
if ncutils.IsMac() {
|
if ncutils.IsMac() {
|
||||||
|
|||||||
Reference in New Issue
Block a user