EndpointExternalIP

This commit is contained in:
Kusakabe Si 2021-12-16 02:56:02 +00:00
parent ca697b4822
commit 7e53dab4b7
29 changed files with 262 additions and 191 deletions

View File

@ -157,6 +157,9 @@ func LookupIP(host_port string, af int) (net.Addr, string, error) {
} else if af == 6 {
network = "udp6"
}
if host_port == "" {
return nil, "", fmt.Errorf("error lookup ip from empty string")
}
conn, err := net.Dial(network, host_port)
if err != nil {
return nil, "", err

View File

@ -83,13 +83,13 @@ type Device struct {
SuperConfigPath string
SuperConfig *mtypes.SuperConfig
Chan_server_register chan mtypes.RegisterMsg
Chan_server_pong chan mtypes.PongMsg
Chan_save_config chan struct{}
Chan_Edge_Initialized chan struct{}
Chan_SendPingStart chan struct{}
Chan_SendRegisterStart chan struct{}
Chan_HttpPostStart chan struct{}
Chan_server_register chan mtypes.RegisterMsg
Chan_server_pong chan mtypes.PongMsg
Chan_save_config chan struct{}
Chan_Device_Initialized chan struct{}
Chan_SendPingStart chan struct{}
Chan_SendRegisterStart chan struct{}
Chan_HttpPostStart chan struct{}
indexTable IndexTable
cookieChecker CookieChecker
@ -367,30 +367,34 @@ func NewDevice(tapDevice tap.Device, id mtypes.Vertex, bind conn.Bind, logger *L
device.DupData = *fixed_time_cache.NewCache(mtypes.S2TD(econfig.DynamicRoute.DupCheckTimeout), false, mtypes.S2TD(60))
device.event_tryendpoint = make(chan struct{}, 1<<6)
device.Chan_save_config = make(chan struct{}, 1<<5)
device.Chan_Edge_Initialized = make(chan struct{}, 1<<5)
device.Chan_Device_Initialized = make(chan struct{}, 1<<5)
device.Chan_SendPingStart = make(chan struct{}, 1<<5)
device.Chan_SendRegisterStart = make(chan struct{}, 1<<5)
device.Chan_HttpPostStart = make(chan struct{}, 1<<5)
device.LogLevel = econfig.LogLevel
device.SuperConfig.DampingResistance = device.EdgeConfig.DynamicRoute.DampingResistance
go func() {
<-device.Chan_Edge_Initialized
if device.LogLevel.LogInternal {
fmt.Printf("Internal: Edge initialized, start background loops\n")
}
go device.RoutineSetEndpoint()
}
go func() {
<-device.Chan_Device_Initialized
if device.LogLevel.LogInternal {
fmt.Printf("Internal: initialized, start background loops\n")
}
if IsSuperNode {
go device.RoutineResetEndpoint()
} else {
go device.RoutineTryReceivedEndpoint()
go device.RoutineDetectOfflineAndTryNextEndpoint()
go device.RoutineRegister(device.Chan_SendRegisterStart)
go device.RoutineSendPing(device.Chan_SendPingStart)
go device.RoutineSpreadAllMyNeighbor()
go device.RoutineResetConn()
go device.RoutineResetEndpoint()
go device.RoutineClearL2FIB()
go device.RoutineRecalculateNhTable()
go device.RoutinePostPeerInfo(device.Chan_HttpPostStart)
}()
}
}
}()
// create queues

View File

@ -463,10 +463,6 @@ func (peer *Peer) SetPSK(psk NoisePresharedKey) {
}
func (peer *Peer) SetEndpointFromConnURL(connurl string, af int, static bool) error {
peer.StaticConn = static
peer.ConnURL = connurl
peer.ConnAF = af
if peer.device.LogLevel.LogInternal {
fmt.Println("Internal: Set endpoint to " + connurl + " for NodeID:" + peer.ID.ToString())
}
@ -475,13 +471,18 @@ func (peer *Peer) SetEndpointFromConnURL(connurl string, af int, static bool) er
if err != nil {
return err
}
if peer.GetEndpointDstStr() == connurl {
if peer.device.LogLevel.LogInternal {
fmt.Printf("Internal: Same as original endpoint:%v, skip for NodeID:%v\n", connurl, peer.ID.ToString())
}
}
endpoint, err := peer.device.net.bind.ParseEndpoint(connurl)
if err != nil {
return err
}
peer.StaticConn = static
peer.ConnURL = connurl
peer.ConnAF = af
peer.SetEndpointFromPacket(endpoint)
return nil
}
@ -516,6 +517,8 @@ func (peer *Peer) SetEndpointFromPacket(endpoint conn.Endpoint) {
}
func (peer *Peer) GetEndpointSrcStr() string {
peer.RLock()
defer peer.RUnlock()
if peer.endpoint == nil {
return ""
}
@ -523,6 +526,8 @@ func (peer *Peer) GetEndpointSrcStr() string {
}
func (peer *Peer) GetEndpointDstStr() string {
peer.RLock()
defer peer.RUnlock()
if peer.endpoint == nil {
return ""
}

View File

@ -748,7 +748,7 @@ func (device *Device) process_BoardcastPeerMsg(peer *Peer, content mtypes.Boardc
return nil
}
func (device *Device) RoutineSetEndpoint() {
func (device *Device) RoutineTryReceivedEndpoint() {
if !(device.EdgeConfig.DynamicRoute.P2P.UseP2P || device.EdgeConfig.DynamicRoute.SuperNode.UseSuperNode) {
return
}
@ -1042,11 +1042,17 @@ func (device *Device) RoutineSpreadAllMyNeighbor() {
}
}
func (device *Device) RoutineResetConn() {
if device.EdgeConfig.ResetConnInterval <= 0.01 {
func (device *Device) RoutineResetEndpoint() {
var ResetEndPointInterval float64
if device.IsSuperNode {
ResetEndPointInterval = device.SuperConfig.ResetEndPointInterval
} else {
ResetEndPointInterval = device.EdgeConfig.ResetEndPointInterval
}
if ResetEndPointInterval <= 0.01 {
return
}
timeout := mtypes.S2TD(device.EdgeConfig.ResetConnInterval)
timeout := mtypes.S2TD(ResetEndPointInterval)
for {
for _, peer := range device.peers.keyMap {
if !peer.StaticConn { //Do not reset connecton for dynamic peer
@ -1055,6 +1061,9 @@ func (device *Device) RoutineResetConn() {
if peer.ConnURL == "" {
continue
}
if peer.IsPeerAlive() {
continue
}
err := peer.SetEndpointFromConnURL(peer.ConnURL, peer.ConnAF, peer.StaticConn)
if err != nil {
device.log.Errorf("Failed to bind "+peer.ConnURL, err)

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet1
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: x63jMG2oFSznZqwtCO2rW4ox7n+ljpP+1gIPyL/a5sI=
PrivKey: kkKXE1uFha84Yd8YIDUI02OsjVi2v7CM60rIUgC7zP4=
ListenPort: 3001
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,11 +62,11 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: x1A7t6DdG4XSLAud3yeEyEJ1eJVQ4QVhielSKbxptDM=
PSKey: TFIU3FbTQE/1Tiv8GnAsE/vxV9LDAD8zNqlzE2/FyJU=
PubKey: 5bKEWuXXY78d54pWOWiuE39g14qmkEvUyuE4MeiXf3k=
PSKey: m3/mX6xoT3a/2wkHYO7YPpMfBr+W0Z+51fPTx2p0+FU=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet2
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: u7jv20ZmBtWYexIV8Bv8pmjwyxzeVCaikYl4P+CDkwc=
PrivKey: cK6/KorPQRK2o8w+upCr77XHK9/Mwvab59evSz/Jg0I=
ListenPort: 3002
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,23 +62,23 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 1
PubKey: ixuv4jI0H95Ym1+lmLh4TLrq/a/f+EEXuaYzWVIRbGs=
PSKey: TFIU3FbTQE/1Tiv8GnAsE/vxV9LDAD8zNqlzE2/FyJU=
PubKey: LJmpHBR1h4iLb/K4Dw2LYoQhOleYds2lDiJsuTg4cHg=
PSKey: m3/mX6xoT3a/2wkHYO7YPpMfBr+W0Z+51fPTx2p0+FU=
EndPoint: 127.0.0.1:3001
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: FlNRAKQu/X3H4k03tmfIAbw3yoGOVJt59Ff5lBAqRhE=
PSKey: ac1v88xBD14viltWV2/lfSk2ODvu4yiZ0GjgIn2PCMQ=
PubKey: mWUbdaAllwwOB9GZyj9KYGWX8MPkohJhMJQedz9IUCE=
PSKey: pBV5ETd1ynGBW4KzLh1q5FO9ukpomosMzR7Q2lKCke4=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: XCHI8Nza874YfCQAMVp7qtsd1GjOH7LbcDLg58NYli4=
PSKey: BV14aWGhnC3ZBWGGazT+6Mk4RQ7PzY/+c3e4vN2OBNQ=
PubKey: PFGgDAqIpdenrhfOKqY1ixOIKwCMXd+nHS1KFGpcZFI=
PSKey: Ak0pZQ3jd1Q+x4rh3bhu+yjzE1gML7Ovy9abIrqmiQ0=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet3
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 4HjyHIBHzF1DDP6FwzgWWf3/mvuyCBKE2l0m0otZ6/w=
PrivKey: qaSOwMzr7nC7Vcphd7w6q9k6bz1eCVhe9uEt+803lvk=
ListenPort: 3003
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,23 +62,23 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: x1A7t6DdG4XSLAud3yeEyEJ1eJVQ4QVhielSKbxptDM=
PSKey: ac1v88xBD14viltWV2/lfSk2ODvu4yiZ0GjgIn2PCMQ=
PubKey: 5bKEWuXXY78d54pWOWiuE39g14qmkEvUyuE4MeiXf3k=
PSKey: pBV5ETd1ynGBW4KzLh1q5FO9ukpomosMzR7Q2lKCke4=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: XCHI8Nza874YfCQAMVp7qtsd1GjOH7LbcDLg58NYli4=
PSKey: XN6RwX2w7VIUKao7Qmp+Q+ltF5S2fFuphsyxyeTS1v8=
PubKey: PFGgDAqIpdenrhfOKqY1ixOIKwCMXd+nHS1KFGpcZFI=
PSKey: 8q4dn5UpRcir2coFHwWr4ojfRPJ/a6IYjYcb3VvRtaA=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 5
PubKey: C0YMktiJW0g1pa22D2ES6nu5ikXoD2PhC437t3VWXTc=
PSKey: 67h6hs+l6FfZCi8sVHcvZlcVxFPRjFIX8qKlXQphWs4=
PubKey: n7Ze44JW/39AQ0PVVhiTWSoyOwctRPJB55B9fkSZ0l4=
PSKey: Cvb9of0CO9Fivw+cjUaIJVSnAnYD9Hs1wCpHHNNSTpA=
EndPoint: 127.0.0.1:3005
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet4
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: aPe9FxqEPtMT5AYVmGx2aQmog0GJvXjzJoty+3ztbzs=
PrivKey: GL9GrJCeptF8+iiT8Nrem9qMaiQScu6tGjQ4CvEskn0=
ListenPort: 3004
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,23 +62,23 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: x1A7t6DdG4XSLAud3yeEyEJ1eJVQ4QVhielSKbxptDM=
PSKey: BV14aWGhnC3ZBWGGazT+6Mk4RQ7PzY/+c3e4vN2OBNQ=
PubKey: 5bKEWuXXY78d54pWOWiuE39g14qmkEvUyuE4MeiXf3k=
PSKey: Ak0pZQ3jd1Q+x4rh3bhu+yjzE1gML7Ovy9abIrqmiQ0=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: FlNRAKQu/X3H4k03tmfIAbw3yoGOVJt59Ff5lBAqRhE=
PSKey: XN6RwX2w7VIUKao7Qmp+Q+ltF5S2fFuphsyxyeTS1v8=
PubKey: mWUbdaAllwwOB9GZyj9KYGWX8MPkohJhMJQedz9IUCE=
PSKey: 8q4dn5UpRcir2coFHwWr4ojfRPJ/a6IYjYcb3VvRtaA=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 6
PubKey: 7b9o5yZuebAZVjlvLvJzLH20lg4mCfMTSPXe0iJPjiA=
PSKey: RYwSBskLDa4pW2TiBDAmXIAW2Cs1LOiA/J/FfKAGmDY=
PubKey: 8z7QoiMFMrk6jElZzJqQgO7bcf7YxMVnvkOebLvatks=
PSKey: tQ4dtvzj2W35K7GchFStIwPQkOjmDhDgdZhUcv++nV4=
EndPoint: 127.0.0.1:3006
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet5
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 83XsoCxkCbDF4lx6KlyybL5qJZWR/Tn7nHmABsLh2Fo=
PrivKey: 5zWmtAW/NipYIZU1wWM6gWiYGPpz/yPslF3TEdNvUzw=
ListenPort: 3005
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,11 +62,11 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 3
PubKey: FlNRAKQu/X3H4k03tmfIAbw3yoGOVJt59Ff5lBAqRhE=
PSKey: 67h6hs+l6FfZCi8sVHcvZlcVxFPRjFIX8qKlXQphWs4=
PubKey: mWUbdaAllwwOB9GZyj9KYGWX8MPkohJhMJQedz9IUCE=
PSKey: Cvb9of0CO9Fivw+cjUaIJVSnAnYD9Hs1wCpHHNNSTpA=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: B2:D1:AB:85
MacAddrPrefix: 6A:43:0F:04
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet6
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: s07iDqaZ/rw21A3QxX/MPcv8Tm5Xkv1D+WEg1SreMSs=
PrivKey: FxdP9nKi0YLvhMvwYV3NcUixDjb3Q7gBGtmFLPjqLZs=
ListenPort: 3006
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
@ -61,11 +62,11 @@ DynamicRoute:
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 4
PubKey: XCHI8Nza874YfCQAMVp7qtsd1GjOH7LbcDLg58NYli4=
PSKey: RYwSBskLDa4pW2TiBDAmXIAW2Cs1LOiA/J/FfKAGmDY=
PubKey: PFGgDAqIpdenrhfOKqY1ixOIKwCMXd+nHS1KFGpcZFI=
PSKey: tQ4dtvzj2W35K7GchFStIwPQkOjmDhDgdZhUcv++nV4=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -8,15 +8,15 @@ Edge Node:
IPv6 LL range: fe80::a3df:0/112
Edge Nodes:
1:
Endpoint(optional): 127.0.0.1:3001
Endpoint(optional): ""
2:
Endpoint(optional): 127.0.0.1:3002
Endpoint(optional): ""
3:
Endpoint(optional): 127.0.0.1:3003
Endpoint(optional): 127.0.0.1:3003 # Provide at least 1 endpoint for others
4:
Endpoint(optional): 127.0.0.1:3004
5:
Endpoint(optional): 127.0.0.1:3005
Endpoint(optional): ""
6:
Endpoint(optional): 127.0.0.1:3006
Endpoint(optional): ""
Distance matrix for all nodes: ""

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet1
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: wEo/Y73+zu/OwhdV6pfwJHaUlhPhQJFk5scQYAWHdcI=
PrivKey: u1U5zImQ0lByFcJXTysUq9ZSTg3ZLIKMDYn/RAXEtKI=
ListenPort: 3001
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,11 +98,11 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: viLcvMWwVR2P+ojtc2psl5CFhmziiet5aquG3KFQDrs=
PubKey: 8RSl6sMj1jjkHt/OO+hOKpaxvo1ISaqc6eMXx7jheRY=
PSKey: ymMmOXRxdEVv/LQe4V2H5aUjYribOf7EXg4WOrLdoRU=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet2
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: RYPUQ3ne0AxLKF6T800B/bqiF0L6kIA5aP6E2MUYoKw=
PrivKey: Gn3hwOAtlKeBldzr6Jmu+aeoXR/TAcT7RzITZGMYfek=
ListenPort: 3002
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,23 +98,23 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 4
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: VVzfkmJBGdjphL0Ccs0Ka04rgsOlZkhuO308u4yK5Wc=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 1
PubKey: 4J8epTkbMnIiSQRM1BAzLMSjTN2OdcuXqIfH74IeQh0=
PSKey: viLcvMWwVR2P+ojtc2psl5CFhmziiet5aquG3KFQDrs=
PubKey: jC9YvJ0fsxaWlcC23a/zjgO9W+2soYzwL35SXx/Kk1s=
PSKey: ymMmOXRxdEVv/LQe4V2H5aUjYribOf7EXg4WOrLdoRU=
EndPoint: 127.0.0.1:3001
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: LBGuT44cTMEFe03LIpG3ze8GF+ZFmQ7/90ZdQUm/Stw=
PubKey: qPvElhtbEz9OwRtwQDoYye1QERPqeerSGSOluCL95mE=
PSKey: nSAtHiq2H4bYwFmQk8uI8dM1xepdBewBXJnKoJF+h28=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: 3p6wwfZcDfVKjRyoq7vtr86oplWx+Y3ua0rj+EZTyxE=
PSKey: 4gok+3nuckAx48r4hf2DkK3wFEosyXwJRUeBLKeN0Co=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet3
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: f1B5y7rG0+ci4SM3myrPgUZdMsKfytqS1tC9V07mTrc=
PrivKey: odbxmbr0GhcsZSpyrVLooMixeSg0t1WpL1BYwb8EJWw=
ListenPort: 3003
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,23 +98,23 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: LBGuT44cTMEFe03LIpG3ze8GF+ZFmQ7/90ZdQUm/Stw=
PubKey: 8RSl6sMj1jjkHt/OO+hOKpaxvo1ISaqc6eMXx7jheRY=
PSKey: nSAtHiq2H4bYwFmQk8uI8dM1xepdBewBXJnKoJF+h28=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: Kpd1FKPEj+NFgq69+t5xDely7Yp5tU+fvlkeRVNCb2I=
PubKey: 3p6wwfZcDfVKjRyoq7vtr86oplWx+Y3ua0rj+EZTyxE=
PSKey: UZgFXKNnnt5J3MSfCS7tAd3Xe/blgvWrOXWS3sjBEZo=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 5
PubKey: raPJ4aW930QQMko5khFGnFB9TcVv+iHNJpnjdCm6Wwo=
PSKey: pd+roM0C5CqSii7NPZkgK3EWdx0PS2zXEiUHycdIPts=
PubKey: 16od5gzI7SCiQxigJGV1R26J2Qv3ewLQVzIggunrfD0=
PSKey: xytrvUMkCNIWqRHY7OwO/r0flUo/O+YEOGrsv2jIGkk=
EndPoint: 127.0.0.1:3005
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet4
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: GwPv8hvKV5YP6TdSc9Bn4lJirmyapU/4iHb6NhgUueI=
PrivKey: t5DUQqA4/G7ONUVroXuYx94iC8ZEOGW/LH7GT3MfL/8=
ListenPort: 3004
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,23 +98,23 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 2
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: VVzfkmJBGdjphL0Ccs0Ka04rgsOlZkhuO308u4yK5Wc=
PubKey: 8RSl6sMj1jjkHt/OO+hOKpaxvo1ISaqc6eMXx7jheRY=
PSKey: 4gok+3nuckAx48r4hf2DkK3wFEosyXwJRUeBLKeN0Co=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: Kpd1FKPEj+NFgq69+t5xDely7Yp5tU+fvlkeRVNCb2I=
PubKey: qPvElhtbEz9OwRtwQDoYye1QERPqeerSGSOluCL95mE=
PSKey: UZgFXKNnnt5J3MSfCS7tAd3Xe/blgvWrOXWS3sjBEZo=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 6
PubKey: jY7Uj9s2UXTiiNjZlTuUagIYz5YzAnelfrp4YT8+5So=
PSKey: zd3zB1QWk26a7IOCJSx031TPly3nv7P3QIxk845zsXA=
PubKey: RaHC+RMt/9EUDaueRCiw7McOYjKzVemOFxtGmDYRCEc=
PSKey: rdS/i+Ubu8IyMqEbIaJThtcTZNfOx8/8PG7GDHu3XD4=
EndPoint: 127.0.0.1:3006
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet5
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: jK3oL4WfEPphp+2jra5/uVZwbhI6wqPAXYStOGwGJqQ=
PrivKey: MxAk/kCWlBRBpSJqdJImIlG7ic2drOPxEqUr/cyevx4=
ListenPort: 3005
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,11 +98,11 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 3
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: pd+roM0C5CqSii7NPZkgK3EWdx0PS2zXEiUHycdIPts=
PubKey: qPvElhtbEz9OwRtwQDoYye1QERPqeerSGSOluCL95mE=
PSKey: xytrvUMkCNIWqRHY7OwO/r0flUo/O+YEOGrsv2jIGkk=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: EA:C9:BC:0F
MacAddrPrefix: 6E:B8:1B:68
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet6
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: Hn6v3HRWZW63P44qocWQm+hydkZPqCwSSVv7N8aVBBo=
PrivKey: zlcpGbnXXtTuaB+XDKtWQpXqxvwzhee2qdMcTI1k3cA=
ListenPort: 3006
LogLevel:
LogLevel: error
@ -43,6 +43,7 @@ DynamicRoute:
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -97,11 +98,11 @@ NextHopTable:
3: 4
4: 4
5: 4
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers:
- NodeID: 4
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: zd3zB1QWk26a7IOCJSx031TPly3nv7P3QIxk845zsXA=
PubKey: 3p6wwfZcDfVKjRyoq7vtr86oplWx+Y3ua0rj+EZTyxE=
PSKey: rdS/i+Ubu8IyMqEbIaJThtcTZNfOx8/8PG7GDHu3XD4=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -128,20 +128,20 @@ X 1 2 3 4 5 6
### EdgeNode Config Parameter
<a name="EdgeConfig"></a>EdgeConfig | Description
-------------- |:-----
---------------------|:-----
[Interface](#Interface)| 接口相關設定。VPN有兩端一端是VPN網路另一端則是本地接口
NodeID | 節點ID。節點之間辨識身分用的同一網路內節點ID不能重複
NodeName | 節點名稱
PostScript | 初始化完畢之後要跑的腳本
DefaultTTL | TTLetherguard層使用和乙太層不共通
L2FIBTimeout | MacAddr-> NodeID 查找表的 timeout(秒) 類似ARP table
PrivKey | 私鑰和wireguard規格一樣
ListenPort | 監聽的udp埠
NodeID | 節點ID。節點之間辨識身分用的同一網路內節點ID不能重複
NodeName | 節點名稱
PostScript | 初始化完畢之後要跑的腳本
DefaultTTL | TTLetherguard層使用和乙太層不共通
L2FIBTimeout | MacAddr-> NodeID 查找表的 timeout(秒) 類似ARP table
PrivKey | 私鑰和wireguard規格一樣
ListenPort | 監聽的udp埠
[LogLevel](#LogLevel)| 紀錄log
[DynamicRoute](../super_mode/README_zh.md#DynamicRoute) | 動態路由相關設定<br>StaticMode用不到
NextHopTable | 轉發表, 下一跳 = `NhTable[起點][終點]`<br>SuperMode以及P2PMode用不到
ResetConnInterval | 如果對方是動態ip就要用這個。每隔一段時間就會重置連線,重新解析域名
[Peers](#Peers) | 鄰居節點。<br>SuperMode用不到從SuperNode接收
NextHopTable | 轉發表, 下一跳 = `NhTable[起點][終點]`<br>SuperMode以及P2PMode用不到
ResetEndPointInterval | 每隔一段時間就會重置連線,重新解析域名<br>只對標記為Static的Peer生效<br>如果有Endpoint是動態ip就要用這個
[Peers](#Peers) | 鄰居節點。<br>SuperMode用不到從SuperNode接收
<a name="Interface"></a>Interface | Description
---------------|:-----

View File

@ -3,7 +3,7 @@ Interface:
Name: EgNet001
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 62:A6:A3:6D
MacAddrPrefix: F6:C6:D6:39
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -16,7 +16,7 @@ NodeName: EgNet001
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 12CRJpzWOTRQDOdtROtwwWb68B4HHjSbrS1WySAkWYI=
PrivKey: nFleKaROzsjbtWtClWEhSXtU/chEyftua3RYEFtJmrk=
ListenPort: 0
LogLevel:
LogLevel: error
@ -36,15 +36,14 @@ DynamicRoute:
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: 2eOq1sJlEs3No80xYOaKJ059ElgRaSveyMu9IyQG3X8=
PSKey: aqGxI+K8SAV5U+v1ig4TN9JjI0FGlJgPEbB1juVIbr0=
EndpointV4: 127.0.0.1:3456
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
PubKeyV4: k90vb67heqcN2GHwY5X9kbn6owjJbbVuVB+P1DD4AEU=
EndpointV6: ""
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
PubKeyV6: z26JJATeF3jqcjsoY+82WkrSj6xvEBGFEth5v/u3Eiw=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
AdditionalLocalIP:
- 136.243.28.150:56238
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -83,5 +82,5 @@ DynamicRoute:
- 2.pool.ntp.org
- 3.pool.ntp.org
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers: []

View File

@ -3,20 +3,20 @@ Interface:
Name: EgNet002
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 62:A6:A3:6D
MacAddrPrefix: F6:C6:D6:39
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1404
RecvAddr: 127.0.0.1:4002
SendAddr: 127.0.0.1:5002
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 2
NodeName: EgNet002
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 2swvwMtyuOKd2HsrfSY1eEYKRjhS4dCr2Cwtj9or0us=
PrivKey: DbtUTgAt0363z1wAAbQrQ+qd6rUf2Gw7AOlPWVBYwjw=
ListenPort: 0
LogLevel:
LogLevel: error
@ -36,13 +36,14 @@ DynamicRoute:
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: Ye1vd4P8vZWCLmuhYq8yiu1ziB84AGwuO+/cexQObqc=
PSKey: HuhEMcywAlFzvdNCGdBvNFxXMxTHE5nf1qS7njLS9o0=
EndpointV4: 127.0.0.1:3456
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
PubKeyV4: k90vb67heqcN2GHwY5X9kbn6owjJbbVuVB+P1DD4AEU=
EndpointV6: ""
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
PubKeyV6: z26JJATeF3jqcjsoY+82WkrSj6xvEBGFEth5v/u3Eiw=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -81,5 +82,5 @@ DynamicRoute:
- 2.pool.ntp.org
- 3.pool.ntp.org
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers: []

View File

@ -3,20 +3,20 @@ Interface:
Name: EgNet100
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 62:A6:A3:6D
MacAddrPrefix: F6:C6:D6:39
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1404
RecvAddr: 127.0.0.1:4100
SendAddr: 127.0.0.1:5100
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 100
NodeName: EgNet100
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: iquaLyD+YLzW3zvI0JGSed9GfDqHYMh/vUaU0PYVAbQ=
PrivKey: szziqqL7hZcd5uw4hpPdhhYtDajuuJYJIKowwCBr3Mo=
ListenPort: 0
LogLevel:
LogLevel: error
@ -36,13 +36,14 @@ DynamicRoute:
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: w5t64vFEoyNk/iKJP3oeSi9eiGEiPteZmf2o0oI2q2U=
PSKey: 201zPcenuIVoQtCQHPjjw7RRjzVHSGTcgBIDeqZV1Ss=
EndpointV4: 127.0.0.1:3456
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
EndpointV6: :3456
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
PubKeyV4: k90vb67heqcN2GHwY5X9kbn6owjJbbVuVB+P1DD4AEU=
EndpointV6: ""
PubKeyV6: z26JJATeF3jqcjsoY+82WkrSj6xvEBGFEth5v/u3Eiw=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
AdditionalLocalIP: []
SuperNodeInfoTimeout: 50
P2P:
UseP2P: false
@ -81,5 +82,5 @@ DynamicRoute:
- 2.pool.ntp.org
- 3.pool.ntp.org
NextHopTable: {}
ResetConnInterval: 86400
ResetEndPointInterval: 600
Peers: []

View File

@ -1,7 +1,7 @@
NodeName: EgNetSP
PostScript: ""
PrivKeyV4: xJiK1UiWpZyygZUlZWR+nmGU9PrweCIPDcCRRXNvHLI=
PrivKeyV6: 8AEBC4hRAKhAWd2F5kR7xJZJi8GIp7K8hEjo2cDn8kE=
PrivKeyV4: qbvcWSMxBpXaaluU8hS4jTqPnDCD29Ndticp4GgrmfI=
PrivKeyV6: CfzKBRoBkY5qd8OnizhRCYqx1bJSU7Ql9US09bUq1UY=
ListenPort: 3456
ListenPort_EdgeAPI: "3456"
ListenPort_ManageAPI: "3456"
@ -34,22 +34,29 @@ GraphRecalculateSetting:
NextHopTable: {}
EdgeTemplate: EgNet_edge001.yaml
UsePSKForInterEdge: true
ResetEndPointInterval: 600
Peers:
- NodeID: 1
Name: EgNet001
PubKey: SlRqHTbVz976aBbR06DFDFXG8yKjSvMdrrWeKuvePgw=
PSKey: 2eOq1sJlEs3No80xYOaKJ059ElgRaSveyMu9IyQG3X8=
PubKey: dkjawveX+UGqcCEgThjLcgowWTY1fA89eY+mQicD3AI=
PSKey: aqGxI+K8SAV5U+v1ig4TN9JjI0FGlJgPEbB1juVIbr0=
AdditionalCost: 10
SkipLocalIP: false
EndPoint: ""
ExternalIP: "google.com"
- NodeID: 2
Name: EgNet002
PubKey: TlxC+ZHej2RkitN1o2tnFT8pO6WUFulitF4RzMlMFlk=
PSKey: Ye1vd4P8vZWCLmuhYq8yiu1ziB84AGwuO+/cexQObqc=
PubKey: iKWT8Sk+uQHB6KOSEBF7oILhkl78x1KKlE8scg4k3jc=
PSKey: HuhEMcywAlFzvdNCGdBvNFxXMxTHE5nf1qS7njLS9o0=
AdditionalCost: 10
SkipLocalIP: false
EndPoint: ""
ExternalIP: ""
- NodeID: 100
Name: EgNet100
PubKey: DG/Lq1bFpE/6109emAoO3iaC+shgWtdRaGBhW3soiSI=
PSKey: w5t64vFEoyNk/iKJP3oeSi9eiGEiPteZmf2o0oI2q2U=
PubKey: 7HTSE5ofjFbicCmFay8Xn5THlI9yrBLhT0gXL4t+Rws=
PSKey: 201zPcenuIVoQtCQHPjjw7RRjzVHSGTcgBIDeqZV1Ss=
AdditionalCost: 10
SkipLocalIP: false
EndPoint: ""
ExternalIP: ""

View File

@ -335,6 +335,8 @@ PubKey | 公鑰
PSKey | 預共享金鑰
[AdditionalCost](#AdditionalCost) | 繞路成本(單位: 毫秒)<br>設定-1代表使用EdgeNode自身設定
SkipLocalIP | 打洞時不使用EdgeNode回報的本地IP僅使用SuperNode蒐集到的外部IP
EndPoint | SuperNode啟動時主動向Edge連線的Endpoint
ExternalIP | 針對沒開Nat Reflection又要把SuperNode和EdgeNode跑在同一内網的情境使用<br>沒有Nat ReflectionSuperNode無法讀取內網EdgeNode的外部IP只能手動指定了
### EdgeNode Config Parameter

View File

@ -1,6 +1,6 @@
Config output dir: /tmp/eg_gen_super
ConfigTemplate for super node: "" # "EgNet_super.yaml"
ConfigTemplate for edge node: "" # "EgNet_edge001.yaml"
ConfigTemplate for super node: "EgNet_super.yaml"
ConfigTemplate for edge node: "EgNet_edge001.yaml"
Network name: EgNet
Super Node:
Listen port: 3456

View File

@ -95,7 +95,7 @@ func GetExampleEdgeConf(templatePath string, getDemo bool) (mtypes.EdgeConfig, e
NTPConfig: mtypes.NTPInfo{
UseNTP: true,
MaxServerUse: 8,
SyncTimeInterval: 3600,
SyncTimeInterval: 604800,
NTPTimeout: 3,
Servers: []string{
"time.google.com",
@ -129,7 +129,7 @@ func GetExampleEdgeConf(templatePath string, getDemo bool) (mtypes.EdgeConfig, e
mtypes.Vertex(1): v1,
},
},
ResetConnInterval: 86400,
ResetEndPointInterval: 600,
Peers: []mtypes.PeerInfo{
{
NodeID: 2,
@ -201,11 +201,12 @@ func GetExampleSuperConf(templatePath string, getDemo bool) (mtypes.SuperConfig,
LogInternal: true,
LogNTP: true,
},
RePushConfigInterval: 30,
PeerAliveTimeout: 70,
DampingResistance: 0.9,
HttpPostInterval: 50,
SendPingInterval: 15,
RePushConfigInterval: 30,
PeerAliveTimeout: 70,
DampingResistance: 0.9,
HttpPostInterval: 50,
SendPingInterval: 15,
ResetEndPointInterval: 600,
Passwords: mtypes.Passwords{
ShowState: random_passwd + "_showstate",
AddPeer: random_passwd + "_addpeer",

View File

@ -169,7 +169,7 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
return err
}
peer.SetPSK(psk)
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV4, 4, false)
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV4, 4, true)
if err != nil {
logger.Errorf("Failed to set endpoint for supernode v4 %v: %v", econfig.DynamicRoute.SuperNode.EndpointV4, err)
S4 = false
@ -190,7 +190,7 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
return err
}
peer.SetPSK(psk)
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV6, 6, false)
err = peer.SetEndpointFromConnURL(econfig.DynamicRoute.SuperNode.EndpointV6, 6, true)
if err != nil {
logger.Errorf("Failed to set endpoint for supernode v6 %v: %v", econfig.DynamicRoute.SuperNode.EndpointV6, err)
S6 = false
@ -255,7 +255,7 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
signal.Notify(term, syscall.SIGTERM)
signal.Notify(term, os.Interrupt)
the_device.Chan_Edge_Initialized <- struct{}{}
the_device.Chan_Device_Initialized <- struct{}{}
mtypes.SdNotify(false, mtypes.SdNotifyReady)
SdNotify, err := mtypes.SdNotify(false, mtypes.SdNotifyReady)
if econfig.LogLevel.LogInternal {

View File

@ -24,6 +24,7 @@ import (
"github.com/golang-jwt/jwt"
"golang.org/x/crypto/sha3"
"github.com/KusakabeSi/EtherGuard-VPN/conn"
"github.com/KusakabeSi/EtherGuard-VPN/device"
"github.com/KusakabeSi/EtherGuard-VPN/mtypes"
"github.com/KusakabeSi/EtherGuard-VPN/path"
@ -152,6 +153,30 @@ func get_api_peers(old_State_hash string) (api_peerinfo mtypes.API_Peers, StateH
for _, peerinfo := range httpobj.http_sconfig.Peers {
connV4 := httpobj.http_device4.GetConnurl(peerinfo.NodeID)
connV6 := httpobj.http_device6.GetConnurl(peerinfo.NodeID)
if peerinfo.ExternalIP != "" {
ExternalIP := peerinfo.ExternalIP
if strings.Contains(ExternalIP, ":") {
ExternalIP = fmt.Sprintf("[%v]", ExternalIP)
}
if strings.Contains(connV4, ":") {
hostport := strings.Split(connV4, ":")
ExternalIP = ExternalIP + ":" + hostport[len(hostport)-1]
_, ExternalEndPoint_v4, err := conn.LookupIP(ExternalIP, 4)
if err == nil {
connV4 = ExternalEndPoint_v4
}
}
if strings.Contains(connV6, ":") {
hostport := strings.Split(connV6, ":")
ExternalIP = ExternalIP + ":" + hostport[len(hostport)-1]
_, ExternalEndPoint_v6, err := conn.LookupIP(ExternalIP, 6)
if err == nil {
connV6 = ExternalEndPoint_v6
}
}
}
if len(connV4)+len(connV6) == 0 {
continue
}

View File

@ -267,7 +267,7 @@ func super_peeradd(peerconf mtypes.SuperPeerInfo) error {
peer4.SetPSK(psk)
}
if peerconf.EndPoint != "" {
err = peer4.SetEndpointFromConnURL(peerconf.EndPoint, 4, false)
err = peer4.SetEndpointFromConnURL(peerconf.EndPoint, 4, true)
if err != nil {
if httpobj.http_sconfig.LogLevel.LogInternal {
fmt.Printf("Internal: Set endpoint failed:%v\n", err)
@ -292,7 +292,7 @@ func super_peeradd(peerconf mtypes.SuperPeerInfo) error {
peer6.SetPSK(psk)
}
if peerconf.EndPoint != "" {
err = peer6.SetEndpointFromConnURL(peerconf.EndPoint, 6, false)
err = peer6.SetEndpointFromConnURL(peerconf.EndPoint, 6, true)
if err != nil {
if httpobj.http_sconfig.LogLevel.LogInternal {
fmt.Printf("Internal: Set endpoint failed:%v\n", err)

View File

@ -18,19 +18,19 @@ const (
)
type EdgeConfig struct {
Interface InterfaceConf `yaml:"Interface"`
NodeID Vertex `yaml:"NodeID"`
NodeName string `yaml:"NodeName"`
PostScript string `yaml:"PostScript"`
DefaultTTL uint8 `yaml:"DefaultTTL"`
L2FIBTimeout float64 `yaml:"L2FIBTimeout"`
PrivKey string `yaml:"PrivKey"`
ListenPort int `yaml:"ListenPort"`
LogLevel LoggerInfo `yaml:"LogLevel"`
DynamicRoute DynamicRouteInfo `yaml:"DynamicRoute"`
NextHopTable NextHopTable `yaml:"NextHopTable"`
ResetConnInterval float64 `yaml:"ResetConnInterval"`
Peers []PeerInfo `yaml:"Peers"`
Interface InterfaceConf `yaml:"Interface"`
NodeID Vertex `yaml:"NodeID"`
NodeName string `yaml:"NodeName"`
PostScript string `yaml:"PostScript"`
DefaultTTL uint8 `yaml:"DefaultTTL"`
L2FIBTimeout float64 `yaml:"L2FIBTimeout"`
PrivKey string `yaml:"PrivKey"`
ListenPort int `yaml:"ListenPort"`
LogLevel LoggerInfo `yaml:"LogLevel"`
DynamicRoute DynamicRouteInfo `yaml:"DynamicRoute"`
NextHopTable NextHopTable `yaml:"NextHopTable"`
ResetEndPointInterval float64 `yaml:"ResetEndPointInterval"`
Peers []PeerInfo `yaml:"Peers"`
}
type SuperConfig struct {
@ -53,6 +53,7 @@ type SuperConfig struct {
NextHopTable NextHopTable `yaml:"NextHopTable"`
EdgeTemplate string `yaml:"EdgeTemplate"`
UsePSKForInterEdge bool `yaml:"UsePSKForInterEdge"`
ResetEndPointInterval float64 `yaml:"ResetEndPointInterval"`
Peers []SuperPeerInfo `yaml:"Peers"`
}
@ -96,6 +97,7 @@ type SuperPeerInfo struct {
AdditionalCost float64 `yaml:"AdditionalCost"`
SkipLocalIP bool `yaml:"SkipLocalIP"`
EndPoint string `yaml:"EndPoint"`
ExternalIP string `yaml:"ExternalIP"`
}
type LoggerInfo struct {