mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-21 14:53:08 +01:00
Ignore static setting for localhost supernode
This commit is contained in:
parent
d90fcdbd25
commit
d9cccdd96b
@ -476,7 +476,7 @@ func (peer *Peer) SetPSK(psk NoisePresharedKey) {
|
||||
|
||||
func (peer *Peer) SetEndpointFromConnURL(connurl string, af int, af_perfer int, static bool) error {
|
||||
if peer.device.LogLevel.LogInternal {
|
||||
fmt.Println("Internal: Set endpoint to " + connurl + " for NodeID:" + peer.ID.ToString())
|
||||
fmt.Printf("Internal: Set endpoint to %v for NodeID: %v static:%v\n", connurl, peer.ID.ToString(), static)
|
||||
}
|
||||
var err error
|
||||
_, connIP, err := conn.LookupIP(connurl, af, af_perfer)
|
||||
|
@ -40,7 +40,7 @@ DynamicRoute:
|
||||
PSKey: yl/4SNFee7+kNekajVCrK0toqXJ4mlT4IN0klyAgyqU=
|
||||
EndpointV4: 127.0.0.1:3456
|
||||
PubKeyV4: 1NS6MxL2LUIlMsppJ5JfHnlofQfCxDUzaItBGwz+jBo=
|
||||
EndpointV6: ""
|
||||
EndpointV6: "[::1]:12345"
|
||||
PubKeyV6: gSBwlJH4aUPRfSP4ZHKAnXIkPZuVaEhsLBispLYFiwo=
|
||||
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
|
||||
SkipLocalIP: false
|
||||
|
23
main_edge.go
23
main_edge.go
@ -13,6 +13,7 @@ import (
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/google/shlex"
|
||||
@ -169,7 +170,16 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
|
||||
return err
|
||||
}
|
||||
peer.SetPSK(psk)
|
||||
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV4, 4, 0, true)
|
||||
StaticSuper := true
|
||||
sc := econfig.DynamicRoute.SuperNode.EndpointV4
|
||||
if strings.Contains(sc, ":") {
|
||||
i := strings.LastIndex(sc, ":")
|
||||
sch := sc[:i]
|
||||
if sch == "127.0.0.1" {
|
||||
StaticSuper = false
|
||||
}
|
||||
}
|
||||
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV4, 4, 0, StaticSuper)
|
||||
if err != nil {
|
||||
logger.Errorf("Failed to set endpoint for supernode v4 %v: %v", econfig.DynamicRoute.SuperNode.EndpointV4, err)
|
||||
S4 = false
|
||||
@ -190,7 +200,16 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
|
||||
return err
|
||||
}
|
||||
peer.SetPSK(psk)
|
||||
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV6, 6, 0, true)
|
||||
StaticSuper := true
|
||||
sc := econfig.DynamicRoute.SuperNode.EndpointV6
|
||||
if strings.Contains(sc, ":") {
|
||||
i := strings.LastIndex(sc, ":")
|
||||
sch := sc[:i]
|
||||
if sch == "[::1]" {
|
||||
StaticSuper = false
|
||||
}
|
||||
}
|
||||
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV6, 6, 0, StaticSuper)
|
||||
if err != nil {
|
||||
logger.Errorf("Failed to set endpoint for supernode v6 %v: %v", econfig.DynamicRoute.SuperNode.EndpointV6, err)
|
||||
S6 = false
|
||||
|
Loading…
Reference in New Issue
Block a user