reorder config, 3.3, genp2p

This commit is contained in:
Kusakabe Si 2021-12-09 22:39:37 +00:00
parent 7ef762b6b0
commit db8cf4710a
43 changed files with 854 additions and 968 deletions

6
.vscode/launch.json vendored
View File

@ -12,7 +12,7 @@
"program": "${workspaceFolder}",
"buildFlags": "-tags 'novpp'",
"env": {"CGO_CFLAGS":"-I/usr/include/memif"},
"args":["-config","example_config/super_mode/s1.yaml","-mode","super"/*,"-example"*/],
"args":["-config","example_config/super_mode/EgNet_super.yaml","-mode","super"/*,"-example"*/],
},
{
"name": "Launch Edge",
@ -22,8 +22,8 @@
"program": "${workspaceFolder}",
"buildFlags": "-tags 'novpp'",
"env": {"CGO_CFLAGS":"-I/usr/include/memif"},
"args":["-config","example_config/super_mode/n1.yaml","-mode","edge"/*,"-example"*/],
}
"args":["-config","example_config/p2p_mode/EgNet_edge1.yaml","-mode","edge"/*,"-example"*/],
},
{
"name": "Launch GenCfg",
"type": "go",

View File

@ -371,6 +371,7 @@ func NewDevice(tapDevice tap.Device, id mtypes.Vertex, bind conn.Bind, logger *L
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 device.RoutineSetEndpoint()
go device.RoutineDetectOfflineAndTryNextEndpoint()

View File

@ -126,7 +126,7 @@ func (et *endpoint_trylist) GetNextTry() (bool, string) {
}
delete(et.trymap_p2p, url)
}
if smallest.lastTry.After(v.lastTry) {
if smallest == nil || smallest.lastTry.After(v.lastTry) {
smallest = v
}
}

View File

@ -581,7 +581,7 @@ func (peer *Peer) RoutineSequentialReceiver() {
if packet_type != path.NormalPacket {
if device.LogLevel.LogControl {
if peer.GetEndpointDstStr() != "" {
fmt.Println("Control: Received From:" + peer.GetEndpointDstStr() + " " + device.sprint_received(packet_type, elem.packet[path.EgHeaderLen:]))
fmt.Printf("Control: Received S:%v D:%v %v From:%v\n", src_nodeID.ToString(), dst_nodeID.ToString(), device.sprint_received(packet_type, elem.packet[path.EgHeaderLen:]), peer.ID.ToString())
}
}
err = device.process_received(packet_type, peer, elem.packet[path.EgHeaderLen:])

View File

@ -52,9 +52,11 @@ func (device *Device) SendPacket(peer *Peer, usage path.Usage, packet []byte, of
}
}
if device.LogLevel.LogControl {
EgHeader, _ := path.NewEgHeader(packet[:path.EgHeaderLen])
if usage != path.NormalPacket {
if peer.GetEndpointDstStr() != "" {
fmt.Println("Control: Send To:" + peer.GetEndpointDstStr() + " " + device.sprint_received(usage, packet[path.EgHeaderLen:]))
dst_nodeID := EgHeader.GetDst()
fmt.Printf("Control: Send D:%v %v To:%v\n", dst_nodeID.ToString(), device.sprint_received(usage, packet[path.EgHeaderLen:]), peer.GetEndpointDstStr())
}
}
}
@ -146,10 +148,14 @@ func (device *Device) process_received(msg_type path.Usage, peer *Peer, body []b
case path.Register:
if content, err := mtypes.ParseRegisterMsg(body); err == nil {
return device.server_process_RegisterMsg(peer, content)
} else {
return err
}
case path.PongPacket:
if content, err := mtypes.ParsePongMsg(body); err == nil {
return device.server_process_Pong(peer, content)
} else {
return err
}
default:
err = errors.New("not a valid msg_type")
@ -159,22 +165,32 @@ func (device *Device) process_received(msg_type path.Usage, peer *Peer, body []b
case path.ServerUpdate:
if content, err := mtypes.ParseServerUpdateMsg(body); err == nil {
device.process_ServerUpdateMsg(peer, content)
} else {
return err
}
case path.PingPacket:
if content, err := mtypes.ParsePingMsg(body); err == nil {
return device.process_ping(peer, content)
} else {
return err
}
case path.PongPacket:
if content, err := mtypes.ParsePongMsg(body); err == nil {
return device.process_pong(peer, content)
} else {
return err
}
case path.QueryPeer:
if content, err := mtypes.ParseQueryPeerMsg(body); err == nil {
return device.process_RequestPeerMsg(content)
} else {
return err
}
case path.BroadcastPeer:
if content, err := mtypes.ParseBoardcastPeerMsg(body); err == nil {
return device.process_BoardcastPeerMsg(peer, content)
} else {
return err
}
default:
err = errors.New("not a valid msg_type")
@ -311,8 +327,8 @@ func (device *Device) process_ping(peer *Peer, content mtypes.PingMsg) error {
Timediff := device.graph.GetCurrentTime().Sub(content.Time).Seconds()
OldTimediff := peer.SingleWayLatency.Load().(float64)
NewTimediff := Timediff
if OldTimediff <= mtypes.Infinity {
DR := device.EdgeConfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance
if (OldTimediff < mtypes.Infinity) == (NewTimediff < mtypes.Infinity) {
DR := device.SuperConfig.DampingResistance
NewTimediff = OldTimediff*DR + Timediff*(1-DR)
}
peer.SingleWayLatency.Store(NewTimediff)
@ -612,6 +628,9 @@ func (device *Device) process_UpdateSuperParamsMsg(peer *Peer, State_hash string
device.EdgeConfig.DynamicRoute.PeerAliveTimeout = SuperParams.PeerAliveTimeout
device.EdgeConfig.DynamicRoute.SendPingInterval = SuperParams.SendPingInterval
device.SuperConfig.HttpPostInterval = SuperParams.HttpPostInterval
if SuperParams.DampingResistance > 0 && SuperParams.DampingResistance <= 1 {
device.SuperConfig.DampingResistance = SuperParams.DampingResistance
}
device.Chan_SendPingStart <- struct{}{}
device.Chan_HttpPostStart <- struct{}{}
if SuperParams.AdditionalCost >= 0 {
@ -696,7 +715,7 @@ func (device *Device) process_RequestPeerMsg(content mtypes.QueryPeerMsg) error
return nil
}
func (device *Device) process_BoardcastPeerMsg(peer *Peer, content mtypes.BoardcastPeerMsg) error {
func (device *Device) process_BoardcastPeerMsg(peer *Peer, content mtypes.BoardcastPeerMsg) (err error) {
if device.EdgeConfig.DynamicRoute.P2P.UseP2P {
var pk NoisePublicKey
if content.Request_ID == uint32(device.ID) {
@ -717,7 +736,10 @@ func (device *Device) process_BoardcastPeerMsg(peer *Peer, content mtypes.Boardc
if device.graph.Weight(content.NodeID, device.ID, false) == mtypes.Infinity { // add node to graph
device.graph.UpdateLatency(content.NodeID, device.ID, mtypes.Infinity, 0, device.EdgeConfig.DynamicRoute.AdditionalCost, true, false)
}
device.NewPeer(pk, content.NodeID, false, 0)
thepeer, err = device.NewPeer(pk, content.NodeID, false, 0)
if err != nil {
return err
}
}
if !thepeer.IsPeerAlive() {
//Peer died, try to switch to this new endpoint
@ -781,10 +803,10 @@ func (device *Device) RoutineDetectOfflineAndTryNextEndpoint() {
if !(device.EdgeConfig.DynamicRoute.P2P.UseP2P || device.EdgeConfig.DynamicRoute.SuperNode.UseSuperNode) {
return
}
if device.EdgeConfig.DynamicRoute.ConnTimeOut == 0 {
if device.EdgeConfig.DynamicRoute.TimeoutCheckInterval == 0 {
return
}
timeout := mtypes.S2TD(device.EdgeConfig.DynamicRoute.ConnTimeOut)
timeout := mtypes.S2TD(device.EdgeConfig.DynamicRoute.TimeoutCheckInterval)
for {
device.event_tryendpoint <- struct{}{}
time.Sleep(timeout)

View File

@ -0,0 +1,71 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 1
NodeName: EgNet1
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: m+okCrSHKbhaAw1MycIf9+i1mnl/PXQFBx9q6Alfa7Y=
ListenPort: 3001
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.95
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: FRPoFmNczfXChxHcyqUB/DlP8uilmULXJ53rkXKbRnA=
PSKey: F04akG91pDuDPSpeiorm1RBZTspDqpk5xbWg1ywW2qA=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true

View File

@ -0,0 +1,83 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 2
NodeName: EgNet2
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: F1rQITtaIzm4uGI83znW7hXRA/brORBYh9nYE1T20TQ=
ListenPort: 3002
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 4
PubKey: kSH8k+0tx67ExXNXYLElgnMaLQDxqPQ3wIUv2CRXKSc=
PSKey: wFwfJeWIBTZw3eAQxBK7mM70cZOllNnCoOnUJC0008g=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 1
PubKey: Da0+2BD/tyz38YuAJ7Ltfm8N+tetzo/0YwyqY9PCrRw=
PSKey: F04akG91pDuDPSpeiorm1RBZTspDqpk5xbWg1ywW2qA=
EndPoint: 127.0.0.1:3001
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: Xv/1VqAxaB+ZYSBg2PeL+oeyi05U+PHdXjoUeHuX7Rs=
PSKey: Cijbh7tHoGbwVANl/3x7qtDHbe3bO9lpOFXoU4hp8w8=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true

View File

@ -0,0 +1,83 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 3
NodeName: EgNet3
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: +zc8mBj65eA/J7RAVRnsRxAfoi45fgipiyqL9kmsqdM=
ListenPort: 3003
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: FRPoFmNczfXChxHcyqUB/DlP8uilmULXJ53rkXKbRnA=
PSKey: Cijbh7tHoGbwVANl/3x7qtDHbe3bO9lpOFXoU4hp8w8=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: kSH8k+0tx67ExXNXYLElgnMaLQDxqPQ3wIUv2CRXKSc=
PSKey: mAgQbX34b3f/geVEU7bn1y4AqA6Eu+ZY9PR1d6IEkDg=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 5
PubKey: 6GTxl1C65KC2wV0bXDVSnp6f3FdtjUhhDWZF4Ipt6gY=
PSKey: 5Ph+d0SFW7hQ8LibICiXcpWpWnaI7i3T1J5Zmw8km3w=
EndPoint: 127.0.0.1:3005
PersistentKeepalive: 0
Static: true

View File

@ -0,0 +1,83 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 4
NodeName: EgNet4
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: DW1nI8xKiaYJRJYUwQaZKNLRVKIVl1unF4YKzmYfNZE=
ListenPort: 3004
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: FRPoFmNczfXChxHcyqUB/DlP8uilmULXJ53rkXKbRnA=
PSKey: wFwfJeWIBTZw3eAQxBK7mM70cZOllNnCoOnUJC0008g=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: Xv/1VqAxaB+ZYSBg2PeL+oeyi05U+PHdXjoUeHuX7Rs=
PSKey: mAgQbX34b3f/geVEU7bn1y4AqA6Eu+ZY9PR1d6IEkDg=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 6
PubKey: XagHQGIw/3Y1btg/gCWYbQMOB5RsOeJRP5i/w5bzf14=
PSKey: n44pByAV/umw2EtfP90jn2A1Hq/mzXCRrT6nXQKlJfw=
EndPoint: 127.0.0.1:3006
PersistentKeepalive: 0
Static: true

View File

@ -0,0 +1,71 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 5
NodeName: EgNet5
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 0zI7tZlrD57Xj0u2qo7zfcqWslpUqaYPpxIp9nZSI1s=
ListenPort: 3005
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 3
PubKey: Xv/1VqAxaB+ZYSBg2PeL+oeyi05U+PHdXjoUeHuX7Rs=
PSKey: 5Ph+d0SFW7hQ8LibICiXcpWpWnaI7i3T1J5Zmw8km3w=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true

View File

@ -0,0 +1,71 @@
Interface:
IType: stdio
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: 26:E9:46:C5
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
MTU: 1416
RecvAddr: 127.0.0.1:4001
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 6
NodeName: EgNet6
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: 4J/LdOJYHem4ZJyzqniN4VYZcSiBZy362grDDovYVzc=
ListenPort: 3006
LogLevel:
LogLevel: error
LogTransit: true
LogNormal: true
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: false
SuperNode:
UseSuperNode: false
PSKey: ""
EndpointV4: ""
PubKeyV4: ""
EndpointV6: ""
PubKeyV6: ""
EndpointEdgeAPIUrl: ""
SkipLocalIP: false
SuperNodeInfoTimeout: 50
P2P:
UseP2P: true
SendPeerInterval: 20
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
UseNTP: true
MaxServerUse: 8
SyncTimeInterval: 3600
NTPTimeout: 3
Servers: []
NextHopTable: {}
ResetConnInterval: 86400
Peers:
- NodeID: 4
PubKey: kSH8k+0tx67ExXNXYLElgnMaLQDxqPQ3wIUv2CRXKSc=
PSKey: n44pByAV/umw2EtfP90jn2A1Hq/mzXCRrT6nXQKlJfw=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -1,14 +1,55 @@
# Etherguard
[English](README.md)
P2P Mode的[範例配置檔](./)的說明文件
在了解Super Mode的運作之前建議您先閱讀[Super Mode的運作](../super_mode/README_zh.md)方法,再閱讀本篇會比較好
## P2P Mode
受到[tinc](https://github.com/gsliepen/tinc)的啟發
和[Super模式運作](../super_mode/README_zh.md)有點相似,不過也有點修改
## Quick Start
首先,按照需求修改`genstatic.yaml`
```yaml
Config output dir: /tmp/eg_gen_static # 設定檔輸出位置
ConfigTemplate for edge node: "" # 設定檔Template
Network name: "EgNet"
Edge Node:
MacAddress prefix: "" # 留空隨機產生
IPv4 range: 192.168.76.0/24 # 順帶一提IP的部分可以直接省略沒關係
IPv6 range: fd95:71cb:a3df:e586::/64 # 這個欄位唯一的目的只是在啟動以後調用ip命令幫tap接口加個ip
IPv6 LL range: fe80::a3df:0/112 # 和VPN本身運作完全無關
Edge Nodes: # 所有的節點相關設定
1:
Endpoint(optional): ""
2:
Endpoint(optional): ""
3:
Endpoint(optional): 127.0.0.1:3003
4:
Endpoint(optional): 127.0.0.1:3004
5:
Endpoint(optional): ""
6:
Endpoint(optional): ""
```
接著執行這個,就會生成所需設定檔了。
```
./etherguard-go -mode gencfg -cfgmode static -config example_config/static_mode/genstatic.yaml
```
把這些設定檔不捨去對應節點,然後再執行
```
./etherguard-go -config [設定檔位置] -mode edge
```
就可以了
確認運作以後可以關閉不必要的log增加性能
## Documentation
P2P Mode的[範例配置檔](./)的說明文件
在了解Super Mode的運作之前建議您先閱讀[Super Mode的運作](../super_mode/README_zh.md)方法,再閱讀本篇會比較好
### ControlMsg
P2P模式又引入一種新的 `終點ID` 叫做 `ControlMsg`
@ -55,18 +96,34 @@ Pong封包是一種`ControlMsg`,使用**flood廣播**盡量讓每個節點都
如果已經有了再檢查Peer是不是離線。
如果已經離線就用收到的Endpoint覆蓋掉自己原本的Endpoint
## Config Paramaters
### EdgeNode Config Parameter
P2P模式也有幾個參數
1. usep2p: 是否啟用P2P模式
1. sendpeerinterval: 廣播BoardcastPeer的間格
1. graphrecalculatesetting: 一些和[Floyd-Warshall演算法](https://zh.wikipedia.org/zh-tw/Floyd-Warshall算法)相關的參數
1. staticmode: 關閉Floyd-Warshall演算法只使用一開始載入的nexthoptable。P2P單純用來打洞
1. jittertolerance: 抖動容許誤差收到Pong以後一個37ms一個39ms不會觸發重新計算
1. jittertolerancemultiplier: 一樣是抖動容許誤差但是高ping的話允許更多誤差
https://www.desmos.com/calculator/raoti16r5n
1. nodereporttimeout: 收到的`Pong`封包的有效期限。太久沒收到就變回Infinity
1. recalculatecooldown: Floyd-Warshal是O(n^3)時間複雜度,不能太常算。設個冷卻時間
<a name="P2P"></a>P2P | Description
------------------------|:-----
UseP2P | 是否啟用P2P模式
SendPeerInterval | 廣播BoardcastPeer的間格
[GraphRecalculateSetting](../super_mode/README_zh.md#GraphRecalculateSetting) | 一些和[Floyd-Warshall演算法](https://zh.wikipedia.org/zh-tw/Floyd-Warshall算法)相關的參數
#### Run example config
在**不同terminal**分別執行以下命令
```
./etherguard-go -config example_config/p2p_mode/EgNet_edge1.yaml -mode edge
./etherguard-go -config example_config/p2p_mode/EgNet_edge2.yaml -mode edge
./etherguard-go -config example_config/p2p_mode/EgNet_edge3.yaml -mode edge
./etherguard-go -config example_config/p2p_mode/EgNet_edge4.yaml -mode edge
./etherguard-go -config example_config/p2p_mode/EgNet_edge5.yaml -mode edge
./etherguard-go -config example_config/p2p_mode/EgNet_edge6.yaml -mode edge
```
因為本範例配置是stdio的kbdbg模式stdin會讀入VPN網路
請在其中一個edge視窗中鍵入
```
b1message
```
因為`L2HeaderMode`是`kbdbg`所以b1會被轉換成 12byte 的layer 2 headerb是廣播地址`FF:FF:FF:FF:FF:FF`1是普通地址`AA:BB:CC:DD:EE:01`message是後面的payload然後再丟入VPN
此時應該要能夠在另一個視窗上看見字串b1message。前12byte被轉換回來了
## Note
P2P模式下PSK是禁用的。因為n個節點有n(n-1)/2的連線每個連線都要使用不同PSK

View File

@ -0,0 +1,29 @@
Config output dir: /tmp/eg_gen_p2p
ConfigTemplate for edge node: "EgNet_edge1.yaml"
Network name: "EgNet"
Edge Node:
MacAddress prefix: ""
IPv4 range: 192.168.76.0/24
IPv6 range: fd95:71cb:a3df:e586::/64
IPv6 LL range: fe80::a3df:0/112
Edge Nodes:
1:
Endpoint(optional): 127.0.0.1:3001
2:
Endpoint(optional): 127.0.0.1:3002
3:
Endpoint(optional): 127.0.0.1:3003
4:
Endpoint(optional): 127.0.0.1:3004
5:
Endpoint(optional): 127.0.0.1:3005
6:
Endpoint(optional): 127.0.0.1:3006
Distance matrix for all nodes: |-
X 1 2 3 4 5 6
1 0 1.0 Inf Inf Inf Inf
2 1.0 0 1.0 1.0 Inf Inf
3 Inf 1.0 0 1 1.0 Inf
4 Inf 1.0 1.0 0 Inf 1.0
5 Inf Inf 1.0 Inf 1.0 Inf
6 Inf Inf Inf 1.0 Inf 1.0

View File

@ -1,113 +0,0 @@
interface:
itype: stdio
name: tap1
vppifaceid: 1
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4001
sendaddr: 127.0.0.1:5001
l2headermode: kbdbg
nodeid: 1
nodename: Node01
defaultttl: 200
l2fibtimeout: 3600
privkey: aABzjKhWdkFfQ29ZuijtMp1h1TNJe66SDCwvfmvQznw=
listenport: 3001
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 2
pubkey: csT+hco4Jpa7btMeC9subHk2ZqzxcljcBk/57V0cSEk=
pskey: ""
endpoint: 127.0.0.1:3002
static: true

View File

@ -1,123 +0,0 @@
interface:
itype: stdio
name: tap2
vppifaceid: 2
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4002
sendaddr: 127.0.0.1:5002
l2headermode: kbdbg
nodeid: 2
nodename: Node02
defaultttl: 200
l2fibtimeout: 3600
privkey: UNZMzPX5fG/8yGC8edVj/ksF9N6ARRqdq7fqE/PD7ls=
listenport: 3002
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 1
pubkey: CooSkIP7/wiC7Rh83UYnB2yPkJijkNFmhtorHtyYlzY=
pskey: ""
endpoint: 127.0.0.1:3001
static: true
- nodeid: 3
pubkey: 0meQ0pQCAkLZdpfyMqggpnk0k3UKG2M8jfIMlQjTRWs=
pskey: ""
endpoint: 127.0.0.1:3003
static: true
- nodeid: 4
pubkey: 2EfY85KF1S+3dZ3A55eZcyi0QU+sOzOyuADtJs2U2Ww=
pskey: ""
endpoint: 127.0.0.1:3004
static: true

View File

@ -1,123 +0,0 @@
interface:
itype: stdio
name: tap3
vppifaceid: 3
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4003
sendaddr: 127.0.0.1:5003
l2headermode: kbdbg
nodeid: 3
nodename: Node03
defaultttl: 200
l2fibtimeout: 3600
privkey: gJy35nbsd8FuuxyWHjsefN+U+oM7RkuIB1EanNLSVHg=
listenport: 3003
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 2
pubkey: csT+hco4Jpa7btMeC9subHk2ZqzxcljcBk/57V0cSEk=
pskey: ""
endpoint: 127.0.0.1:3002
static: true
- nodeid: 4
pubkey: 2EfY85KF1S+3dZ3A55eZcyi0QU+sOzOyuADtJs2U2Ww=
pskey: ""
endpoint: 127.0.0.1:3004
static: true
- nodeid: 5
pubkey: yS7a/e0l0qF7z9MO/P79yYVfLI6UAli2iKjEZa6XmgY=
pskey: ""
endpoint: 127.0.0.1:3005
static: true

View File

@ -1,123 +0,0 @@
interface:
itype: stdio
name: tap4
vppifaceid: 4
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4004
sendaddr: 127.0.0.1:5004
l2headermode: kbdbg
nodeid: 4
nodename: Node04
defaultttl: 200
l2fibtimeout: 3600
privkey: wAdLgCk0SHiO11/aUf9944focD1BUCH5b6Pe+cRHHXQ=
listenport: 3004
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 2
pubkey: csT+hco4Jpa7btMeC9subHk2ZqzxcljcBk/57V0cSEk=
pskey: ""
endpoint: 127.0.0.1:3002
static: true
- nodeid: 3
pubkey: 0meQ0pQCAkLZdpfyMqggpnk0k3UKG2M8jfIMlQjTRWs=
pskey: ""
endpoint: 127.0.0.1:3003
static: true
- nodeid: 6
pubkey: EXLAGpDrkB5cjP7lr4dL0FGZG0rssmQNtWx9k/CGChk=
pskey: ""
endpoint: 127.0.0.1:3006
static: true

View File

@ -1,113 +0,0 @@
interface:
itype: stdio
name: tap5
vppifaceid: 5
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4005
sendaddr: 127.0.0.1:5005
l2headermode: kbdbg
nodeid: 5
nodename: Node05
defaultttl: 200
l2fibtimeout: 3600
privkey: gLmzeCbmN/hjiE+ehNXL9IxuG9hhWIYv2s16/DOW6FE=
listenport: 3005
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 3
pubkey: 0meQ0pQCAkLZdpfyMqggpnk0k3UKG2M8jfIMlQjTRWs=
pskey: ""
endpoint: 127.0.0.1:3003
static: true

View File

@ -1,113 +0,0 @@
interface:
itype: stdio
name: tap6
vppifaceid: 6
vppbridgeid: 4242
macaddrprefix: AA:BB:CC:DD
mtu: 1416
recvaddr: 127.0.0.1:4006
sendaddr: 127.0.0.1:5006
l2headermode: kbdbg
nodeid: 6
nodename: Node06
defaultttl: 200
l2fibtimeout: 3600
privkey: IIX5F6oWZUS2dlhxWFJ7TxdJtDCr5jzeuhxUB6YM7Us=
listenport: 3006
loglevel:
loglevel: normal
logtransit: true
logcontrol: true
lognormal: true
loginternal: true
logntp: true
dynamicroute:
sendpinginterval: 20
peeralivetimeout: 30
dupchecktimeout: 40
conntimeout: 30
connnexttry: 5
savenewpeers: false
supernode:
usesupernode: false
connurlv4: 127.0.0.1:3000
pubkeyv4: LJ8KKacUcIoACTGB/9Ed9w0osrJ3WWeelzpL2u4oUic=
connurlv6: '[::1]:3000'
pubkeyv6: HCfL6YJtpJEGHTlJ2LgVXIWKB/K95P57LHTJ42ZG8VI=
apiurl: http://127.0.0.1:3000/api
supernodeinfotimeout: 40
p2p:
usep2p: true
sendpeerinterval: 20
graphrecalculatesetting:
staticmode: false
jittertolerance: 20
jittertolerancemultiplier: 1.1
nodereporttimeout: 40
timeoutcheckinterval: 5
recalculatecooldown: 5
ntpconfig:
usentp: true
maxserveruse: 8
synctimeinterval: 3600
ntptimeout: 10
servers:
- time.google.com
- time1.google.com
- time2.google.com
- time3.google.com
- time4.google.com
- time1.facebook.com
- time2.facebook.com
- time3.facebook.com
- time4.facebook.com
- time5.facebook.com
- time.cloudflare.com
- time.apple.com
- time.asia.apple.com
- time.euro.apple.com
- time.windows.com
nexthoptable:
1:
2: 2
3: 2
4: 2
5: 2
6: 2
2:
1: 1
3: 3
4: 4
5: 3
6: 4
3:
1: 2
2: 2
4: 4
5: 5
6: 4
4:
1: 2
2: 2
3: 3
5: 3
6: 6
5:
1: 3
2: 3
3: 3
4: 3
6: 3
6:
1: 4
2: 4
3: 4
4: 4
5: 4
resetconninterval: 86400
peers:
- nodeid: 4
pubkey: 2EfY85KF1S+3dZ3A55eZcyi0QU+sOzOyuADtJs2U2Ww=
pskey: ""
endpoint: 127.0.0.1:3004
static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: LFFQqPBQ84x2AQ9BCI+0wG8nr+Y6yXHqhXkMCb4HCmg=
PrivKey: wEo/Y73+zu/OwhdV6pfwJHaUlhPhQJFk5scQYAWHdcI=
ListenPort: 3001
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -100,8 +100,8 @@ NextHopTable:
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: 0r2o9Hb36gYVgD3VSKCH18MVOZw0BvzcJ6TOTo6Cc1g=
PSKey: lFq67qp9LXL3PtlEJ3SGg3c/6++Ljy2I8i/k0Xcibvk=
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: viLcvMWwVR2P+ojtc2psl5CFhmziiet5aquG3KFQDrs=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: M8SxYCTHCPES/yPqcKP4mr+AoMAx9sgUmk64FCJIv6k=
PrivKey: RYPUQ3ne0AxLKF6T800B/bqiF0L6kIA5aP6E2MUYoKw=
ListenPort: 3002
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -99,21 +99,21 @@ NextHopTable:
5: 4
ResetConnInterval: 86400
Peers:
- NodeID: 4
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: VVzfkmJBGdjphL0Ccs0Ka04rgsOlZkhuO308u4yK5Wc=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 1
PubKey: fnc7bfFTf7B23hwtARPpX14tCeZwNfDhGCJctBpMfA8=
PSKey: lFq67qp9LXL3PtlEJ3SGg3c/6++Ljy2I8i/k0Xcibvk=
PubKey: 4J8epTkbMnIiSQRM1BAzLMSjTN2OdcuXqIfH74IeQh0=
PSKey: viLcvMWwVR2P+ojtc2psl5CFhmziiet5aquG3KFQDrs=
EndPoint: 127.0.0.1:3001
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: ymNpm430tiph3rMSVnQzDAxmK9+3jdcRFi6e96xmQUI=
PSKey: Y86PZY1ldgoyzPJxEqei5Vg5zlzkJkoO77LJfxV8alE=
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: LBGuT44cTMEFe03LIpG3ze8GF+ZFmQ7/90ZdQUm/Stw=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: 9YSIkihv/+aeukOaWwsR9EKvO1DM9+5kN53a/osTpmA=
PSKey: QHyrrls0KT2dvBKtoWkZvq5NQ+Xyjm0YgbMUzCCRw34=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: cTO/GUSYHoj5mKczCyQu/ckPiDMEygkUbXcY3RafGEE=
PrivKey: f1B5y7rG0+ci4SM3myrPgUZdMsKfytqS1tC9V07mTrc=
ListenPort: 3003
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -100,20 +100,20 @@ NextHopTable:
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: 0r2o9Hb36gYVgD3VSKCH18MVOZw0BvzcJ6TOTo6Cc1g=
PSKey: Y86PZY1ldgoyzPJxEqei5Vg5zlzkJkoO77LJfxV8alE=
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: LBGuT44cTMEFe03LIpG3ze8GF+ZFmQ7/90ZdQUm/Stw=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 4
PubKey: 9YSIkihv/+aeukOaWwsR9EKvO1DM9+5kN53a/osTpmA=
PSKey: SQyLomXDeknBIFezUKardOviAmNS+YZ1XTvZtYVlOtE=
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: Kpd1FKPEj+NFgq69+t5xDely7Yp5tU+fvlkeRVNCb2I=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true
- NodeID: 5
PubKey: x66hOjYXoZjL1FI3OVtf/CWittsnvmezKV6sW0v5FXQ=
PSKey: ChWBQurfGNZE5xIlhi9EUvZrQPBvkFsfrPaD6tyqSYg=
PubKey: raPJ4aW930QQMko5khFGnFB9TcVv+iHNJpnjdCm6Wwo=
PSKey: pd+roM0C5CqSii7NPZkgK3EWdx0PS2zXEiUHycdIPts=
EndPoint: 127.0.0.1:3005
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: ai9XXdezwamYHf7EvzmLGlMp7mUg+hZwoqLefzwHWVM=
PrivKey: GwPv8hvKV5YP6TdSc9Bn4lJirmyapU/4iHb6NhgUueI=
ListenPort: 3004
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -100,20 +100,20 @@ NextHopTable:
ResetConnInterval: 86400
Peers:
- NodeID: 2
PubKey: 0r2o9Hb36gYVgD3VSKCH18MVOZw0BvzcJ6TOTo6Cc1g=
PSKey: QHyrrls0KT2dvBKtoWkZvq5NQ+Xyjm0YgbMUzCCRw34=
PubKey: /OUi+mno1dvZi3L0T72P4Lxd42TkXdEJwR0VEhsaKxQ=
PSKey: VVzfkmJBGdjphL0Ccs0Ka04rgsOlZkhuO308u4yK5Wc=
EndPoint: 127.0.0.1:3002
PersistentKeepalive: 0
Static: true
- NodeID: 3
PubKey: ymNpm430tiph3rMSVnQzDAxmK9+3jdcRFi6e96xmQUI=
PSKey: SQyLomXDeknBIFezUKardOviAmNS+YZ1XTvZtYVlOtE=
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: Kpd1FKPEj+NFgq69+t5xDely7Yp5tU+fvlkeRVNCb2I=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true
- NodeID: 6
PubKey: f6kHXq3qPLocdM0CZEkoumOHevrabzqOBFG5vg9cjDc=
PSKey: crsb9pbTY/Bei7TugjPNtg4dVKVzjwC/A6AjlSVoqbQ=
PubKey: jY7Uj9s2UXTiiNjZlTuUagIYz5YzAnelfrp4YT8+5So=
PSKey: zd3zB1QWk26a7IOCJSx031TPly3nv7P3QIxk845zsXA=
EndPoint: 127.0.0.1:3006
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: hBNK6Wu/Cl2MOXVA/F8yZsqIQ5eeIYCKPJeLu7i/190=
PrivKey: jK3oL4WfEPphp+2jra5/uVZwbhI6wqPAXYStOGwGJqQ=
ListenPort: 3005
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -100,8 +100,8 @@ NextHopTable:
ResetConnInterval: 86400
Peers:
- NodeID: 3
PubKey: ymNpm430tiph3rMSVnQzDAxmK9+3jdcRFi6e96xmQUI=
PSKey: ChWBQurfGNZE5xIlhi9EUvZrQPBvkFsfrPaD6tyqSYg=
PubKey: FRpS3KJJDiG3LgNkZCZiSNenYR3b/nINu2fTJmXZWlo=
PSKey: pd+roM0C5CqSii7NPZkgK3EWdx0PS2zXEiUHycdIPts=
EndPoint: 127.0.0.1:3003
PersistentKeepalive: 0
Static: true

View File

@ -3,7 +3,7 @@ Interface:
Name: tap1
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: DA:21:10:81
MacAddrPrefix: EA:C9:BC:0F
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: ao6wfUYOG3FBYYPlb+VtXk2ZiK6j/6ac75Y9VuKd2Vs=
PrivKey: Hn6v3HRWZW63P44qocWQm+hydkZPqCwSSVv7N8aVBBo=
ListenPort: 3006
LogLevel:
LogLevel: error
@ -28,10 +28,11 @@ LogLevel:
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: false
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:
@ -100,8 +100,8 @@ NextHopTable:
ResetConnInterval: 86400
Peers:
- NodeID: 4
PubKey: 9YSIkihv/+aeukOaWwsR9EKvO1DM9+5kN53a/osTpmA=
PSKey: crsb9pbTY/Bei7TugjPNtg4dVKVzjwC/A6AjlSVoqbQ=
PubKey: 4WO6Eqm0puYvZMyw6mlzq8Ap0KKXcaqbaQp0zxAVYhs=
PSKey: zd3zB1QWk26a7IOCJSx031TPly3nv7P3QIxk845zsXA=
EndPoint: 127.0.0.1:3004
PersistentKeepalive: 0
Static: true

View File

@ -1,5 +1,5 @@
Config output dir: /tmp/eg_gen_static
ConfigTemplate for edge node: "" # "EgNet_edge1.yaml"
ConfigTemplate for edge node: "EgNet_edge1.yaml"
Network name: "EgNet"
Edge Node:
MacAddress prefix: ""

View File

@ -1,9 +1,9 @@
Interface:
IType: stdio
Name: Node001
Name: EgNet001
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: CE:51:BA:B4
MacAddrPrefix: 62:A6:A3:6D
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -12,34 +12,35 @@ Interface:
SendAddr: 127.0.0.1:5001
L2HeaderMode: kbdbg
NodeID: 1
NodeName: Node001
NodeName: EgNet001
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: C0SXvffZh8nDqXYNzG4UqUJtSCiRMEj3ehX5o7QiJz0=
ListenPort: 3001
PrivKey: 12CRJpzWOTRQDOdtROtwwWb68B4HHjSbrS1WySAkWYI=
ListenPort: 0
LogLevel:
LogLevel: error
LogTransit: false
LogControl: true
LogNormal: false
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: j2f9Fhdhw2O2zLqUqfL5nTFStjVWPnEXpw7Iqz6VX9M=
PSKey: 2eOq1sJlEs3No80xYOaKJ059ElgRaSveyMu9IyQG3X8=
EndpointV4: 127.0.0.1:3456
PubKeyV4: Id/VoZ6HmTU3FSqhxBUswfuHHB0mQxfzcbdoJNGBRzQ=
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
EndpointV6: :3456
PubKeyV6: 40tADRhJTvaortwE5Ur4qNXhP+SOMX7ZuSvl251Yxnc=
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
SuperNodeInfoTimeout: 50
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:

View File

@ -1,9 +1,9 @@
Interface:
IType: stdio
Name: Node002
Name: EgNet002
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: CE:51:BA:B4
MacAddrPrefix: 62:A6:A3:6D
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -12,34 +12,35 @@ Interface:
SendAddr: 127.0.0.1:5002
L2HeaderMode: kbdbg
NodeID: 2
NodeName: Node002
NodeName: EgNet002
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: AErxhLXdZvidPZVXRYgD+84fa2qYWG9ft4MRuCbAtt8=
ListenPort: 3002
PrivKey: 2swvwMtyuOKd2HsrfSY1eEYKRjhS4dCr2Cwtj9or0us=
ListenPort: 0
LogLevel:
LogLevel: error
LogTransit: false
LogControl: true
LogNormal: false
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: iCw096jsW2aWyMwPyzVEvL8C3XXqMpB+jOeWqDC34uU=
PSKey: Ye1vd4P8vZWCLmuhYq8yiu1ziB84AGwuO+/cexQObqc=
EndpointV4: 127.0.0.1:3456
PubKeyV4: Id/VoZ6HmTU3FSqhxBUswfuHHB0mQxfzcbdoJNGBRzQ=
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
EndpointV6: :3456
PubKeyV6: 40tADRhJTvaortwE5Ur4qNXhP+SOMX7ZuSvl251Yxnc=
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
SuperNodeInfoTimeout: 50
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:

View File

@ -1,9 +1,9 @@
Interface:
IType: stdio
Name: Node100
Name: EgNet100
VPPIFaceID: 1
VPPBridgeID: 4242
MacAddrPrefix: CE:51:BA:B4
MacAddrPrefix: 62:A6:A3:6D
IPv4CIDR: 192.168.76.0/24
IPv6CIDR: fd95:71cb:a3df:e586::/64
IPv6LLPrefix: fe80::a3df:0/112
@ -12,34 +12,35 @@ Interface:
SendAddr: 127.0.0.1:5100
L2HeaderMode: kbdbg
NodeID: 100
NodeName: Node100
NodeName: EgNet100
PostScript: ""
DefaultTTL: 200
L2FIBTimeout: 3600
PrivKey: a04BVvT+YbrX1ejjvMQVI6k5VRFlBkEX8tuLGWNyNrY=
ListenPort: 3100
PrivKey: iquaLyD+YLzW3zvI0JGSed9GfDqHYMh/vUaU0PYVAbQ=
ListenPort: 0
LogLevel:
LogLevel: error
LogTransit: false
LogControl: true
LogNormal: false
LogControl: true
LogInternal: true
LogNTP: true
DynamicRoute:
SendPingInterval: 16
PeerAliveTimeout: 70
DupCheckTimeout: 40
ConnTimeOut: 20
TimeoutCheckInterval: 20
ConnNextTry: 5
DupCheckTimeout: 40
AdditionalCost: 10
DampingResistance: 0.9
SaveNewPeers: true
SuperNode:
UseSuperNode: true
PSKey: Gfp2RkPNrKTeGKrCJNEvSyiBqYYRmzVnVG6CBuUKUNc=
PSKey: w5t64vFEoyNk/iKJP3oeSi9eiGEiPteZmf2o0oI2q2U=
EndpointV4: 127.0.0.1:3456
PubKeyV4: Id/VoZ6HmTU3FSqhxBUswfuHHB0mQxfzcbdoJNGBRzQ=
PubKeyV4: 10CPQrpXKqXxnjtpdxDwnYqLglnuRnCFsiSAjxMrMTc=
EndpointV6: :3456
PubKeyV6: 40tADRhJTvaortwE5Ur4qNXhP+SOMX7ZuSvl251Yxnc=
PubKeyV6: KhpV1fJ+jtNT6S5wKUZJbb0oFlDNMS5qxO0f5Ow/QQU=
EndpointEdgeAPIUrl: http://127.0.0.1:3456/eg_net/eg_api
SkipLocalIP: false
SuperNodeInfoTimeout: 50
@ -51,7 +52,6 @@ DynamicRoute:
ManualLatency: {}
JitterTolerance: 50
JitterToleranceMultiplier: 1.1
DampingResistance: 0
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NTPConfig:

View File

@ -0,0 +1,55 @@
NodeName: EgNetSP
PostScript: ""
PrivKeyV4: xJiK1UiWpZyygZUlZWR+nmGU9PrweCIPDcCRRXNvHLI=
PrivKeyV6: 8AEBC4hRAKhAWd2F5kR7xJZJi8GIp7K8hEjo2cDn8kE=
ListenPort: 3456
ListenPort_EdgeAPI: "3456"
ListenPort_ManageAPI: "3456"
API_Prefix: /eg_net/eg_api
RePushConfigInterval: 30
HttpPostInterval: 50
PeerAliveTimeout: 70
SendPingInterval: 15
DampingResistance: 0.9
LogLevel:
LogLevel: normal
LogTransit: false
LogNormal: false
LogControl: true
LogInternal: true
LogNTP: true
Passwords:
ShowState: zOWP0T9O_showstate
AddPeer: zOWP0T9O_addpeer
DelPeer: zOWP0T9O_delpeer
UpdatePeer: zOWP0T9O_updatepeer
UpdateSuper: zOWP0T9O_updatesuper
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 30
JitterToleranceMultiplier: 1.01
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NextHopTable: {}
EdgeTemplate: EgNet_edge001.yaml
UsePSKForInterEdge: true
Peers:
- NodeID: 1
Name: EgNet001
PubKey: SlRqHTbVz976aBbR06DFDFXG8yKjSvMdrrWeKuvePgw=
PSKey: 2eOq1sJlEs3No80xYOaKJ059ElgRaSveyMu9IyQG3X8=
AdditionalCost: 10
SkipLocalIP: false
- NodeID: 2
Name: EgNet002
PubKey: TlxC+ZHej2RkitN1o2tnFT8pO6WUFulitF4RzMlMFlk=
PSKey: Ye1vd4P8vZWCLmuhYq8yiu1ziB84AGwuO+/cexQObqc=
AdditionalCost: 10
SkipLocalIP: false
- NodeID: 100
Name: EgNet100
PubKey: DG/Lq1bFpE/6109emAoO3iaC+shgWtdRaGBhW3soiSI=
PSKey: w5t64vFEoyNk/iKJP3oeSi9eiGEiPteZmf2o0oI2q2U=
AdditionalCost: 10
SkipLocalIP: false

View File

@ -1,55 +0,0 @@
NodeName: NodeSP
PostScript: ""
PrivKeyV4: 2P0mV5RkpFFyg+aLPK841sml5RobQGrxAV5ld4En9Kk=
PrivKeyV6: 9JrdnAk1ljXUTn9VFb1uFyey20tQEQuzJJtVueM4vsw=
ListenPort: 3456
ListenPort_EdgeAPI: "3456"
ListenPort_ManageAPI: "3456"
API_Prefix: /eg_net/eg_api
RePushConfigInterval: 30
HttpPostInterval: 50
PeerAliveTimeout: 70
SendPingInterval: 15
LogLevel:
LogLevel: normal
LogTransit: false
LogNormal: false
LogControl: true
LogInternal: true
LogNTP: true
Passwords:
ShowState: passwd_showstate
AddPeer: passwd_addpeer
DelPeer: passwd_delpeer
UpdatePeer: passwd_updatepeer
UpdateSuper: passwd_updatesuper
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
JitterTolerance: 30
JitterToleranceMultiplier: 1.01
DampingResistance: 0.9
TimeoutCheckInterval: 5
RecalculateCoolDown: 5
NextHopTable: {}
EdgeTemplate: ""
UsePSKForInterEdge: true
Peers:
- NodeID: 1
Name: Node001
PubKey: awnuKYQOgCywkJbHAynqMzKi5QEGsG0w4iBy2Ja1MDQ=
PSKey: j2f9Fhdhw2O2zLqUqfL5nTFStjVWPnEXpw7Iqz6VX9M=
AdditionalCost: 10
SkipLocalIP: false
- NodeID: 2
Name: Node002
PubKey: WUyblc/DZzPNU5sOQQS2lS0aP53zFEVNjqCHjkhkdzE=
PSKey: iCw096jsW2aWyMwPyzVEvL8C3XXqMpB+jOeWqDC34uU=
AdditionalCost: 10
SkipLocalIP: false
- NodeID: 100
Name: Node_100
PubKey: Bax6wOJpisSVJtrU92ujn8D/2oGUyhyPrKTXkHbGamM=
PSKey: Gfp2RkPNrKTeGKrCJNEvSyiBqYYRmzVnVG6CBuUKUNc=
AdditionalCost: 1000
SkipLocalIP: false

View File

@ -230,7 +230,7 @@ curl "http://127.0.0.1:3456/eg_net/eg_api/manage/super/state?Password=passwd_sho
```bash
curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/add?Password=passwd_addpeer" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "NodeID=100&Name=Node_100&PubKey=Bax6wOJpisSVJtrU92ujn8D%2F2oGUyhyPrKTXkHbGamM%3D&AdditionalCost=1000&PSKey=Gfp2RkPNrKTeGKrCJNEvSyiBqYYRmzVnVG6CBuUKUNc%3D&SkipLocalIP=false"
-d "NodeID=100&Name=Node_100&PubKey=DG%2FLq1bFpE%2F6109emAoO3iaC%2BshgWtdRaGBhW3soiSI%3D&AdditionalCost=1000&PSKey=w5t64vFEoyNk%2FiKJP3oeSi9eiGEiPteZmf2o0oI2q2U%3D&SkipLocalIP=false"
```
參數:
1. URL query: Password: 新增peer用的密碼在設定檔配置
@ -260,7 +260,7 @@ curl "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/del?Password=passwd_delpee
也可以使用privkey刪除同上但是只要附上privkey參數就好
```bash
curl "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/del?PrivKey=a04BVvT%2BYbrX1ejjvMQVI6k5VRFlBkEX8tuLGWNyNrY%3D"
curl "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/del?PrivKey=iquaLyD%2BYLzW3zvI0JGSed9GfDqHYMh%2FvUaU0PYVAbQ%3D"
```
參數:
@ -286,7 +286,7 @@ curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/eg_api/manage/peer/update?Pass
```bash
curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/eg_api/manage/super/update?Password=e05znou1_updatesuper" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "SendPingInterval=15&HttpPostInterval=60&PeerAliveTimeout=70"
-d "SendPingInterval=15&HttpPostInterval=60&PeerAliveTimeout=70DampingResistance=0.9"
```
### SuperNode Config Parameter
@ -359,15 +359,15 @@ ResetConnInterval | 如果對方是動態ip就要用這個。每隔一段時間
<a name="DynamicRoute"></a>DynamicRoute | Description
--------------------|:-----
SendPingInterval | 發送Ping訊息的間隔(秒)
PeerAliveTimeout | 每次收到封包就重置,超過時間(秒)沒收到就標記該peer離線
DupCheckTimeout | 重複封包檢查的timeout(秒)<br>完全相同的封包收第二次會被丟棄
ConnTimeOut | 檢查peer離線的時間間格<br>如果標記離線就切換下一個endpoint<br>SuperNode可能傳了多個endpoint過來
ConnNextTry | 切換下一個endpoint的間隔
SendPingInterval | 發送Ping訊息的間隔(秒)
PeerAliveTimeout | 被標記為離線所需的無反應時間(秒)
TimeoutCheckInterval | 檢查間格(秒)檢查是否有任何peer超時若有就標記
ConnNextTry | 被標記以後嘗試下一個endpoint的間隔(秒)
DupCheckTimeout | 重複封包檢查的timeout(秒)<br>完全相同的封包收第二次會被丟棄
[AdditionalCost](#AdditionalCost) | 繞路成本(毫秒)。僅限SuperNode設定-1時生效
SaveNewPeers | 是否把下載來的鄰居資訊存到本地設定檔裡面
SaveNewPeers | 是否把下載來的鄰居資訊存到本地設定檔裡面
[SuperNode](#SuperNode) | SuperNode相關設定
P2P | P2P相關設定SuperMode用不到
[P2P](../p2p_mode/README_zh.md#P2P) | P2P相關設定SuperMode用不到
[NTPConfig](#NTPConfig) | NTP時間同步相關設定
<a name="SuperNode"></a>SuperNode | Description

View File

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

View File

@ -48,13 +48,14 @@ func GetExampleEdgeConf(templatePath string, getDemo bool) mtypes.EdgeConfig {
LogNTP: true,
},
DynamicRoute: mtypes.DynamicRouteInfo{
SendPingInterval: 16,
PeerAliveTimeout: 70,
DupCheckTimeout: 40,
ConnTimeOut: 20,
ConnNextTry: 5,
AdditionalCost: 10,
SaveNewPeers: true,
SendPingInterval: 16,
PeerAliveTimeout: 70,
DupCheckTimeout: 40,
TimeoutCheckInterval: 20,
ConnNextTry: 5,
AdditionalCost: 10,
DampingResistance: 0.95,
SaveNewPeers: true,
SuperNode: mtypes.SuperInfo{
UseSuperNode: true,
PSKey: "iPM8FXfnHVzwjguZHRW9bLNY+h7+B1O2oTJtktptQkI=",
@ -73,7 +74,6 @@ func GetExampleEdgeConf(templatePath string, getDemo bool) mtypes.EdgeConfig {
StaticMode: false,
JitterTolerance: 50,
JitterToleranceMultiplier: 1.1,
DampingResistance: 0.9,
TimeoutCheckInterval: 5,
RecalculateCoolDown: 5,
ManualLatency: mtypes.DistTable{
@ -193,6 +193,7 @@ func GetExampleSuperConf(templatePath string, getDemo bool) mtypes.SuperConfig {
},
RePushConfigInterval: 30,
PeerAliveTimeout: 70,
DampingResistance: 0.9,
HttpPostInterval: 50,
SendPingInterval: 15,
Passwords: mtypes.Passwords{
@ -206,7 +207,6 @@ func GetExampleSuperConf(templatePath string, getDemo bool) mtypes.SuperConfig {
StaticMode: false,
JitterTolerance: 30,
JitterToleranceMultiplier: 1.01,
DampingResistance: 0.9,
TimeoutCheckInterval: 5,
RecalculateCoolDown: 5,
},

View File

@ -34,7 +34,7 @@ func printNMCinfig() {
fmt.Print(string(toprint))
}
func GenNMCfg(NMCinfigPath string, printExample bool) (err error) {
func GenNMCfg(NMCinfigPath string, enableP2P bool, printExample bool) (err error) {
NMCfg := NMCfg{}
if printExample {
printNMCinfig()
@ -76,9 +76,30 @@ func GenNMCfg(NMCinfigPath string, printExample bool) (err error) {
}
g, _ := path.NewGraph(0, false, mtypes.GraphRecalculateSetting{}, mtypes.NTPInfo{}, mtypes.LoggerInfo{LogInternal: false})
edges, err := path.ParseDistanceMatrix(NMCfg.DistanceMatrix)
if err != nil {
return err
edges := []mtypes.PongMsg{}
if NMCfg.DistanceMatrix != "" {
edges, err = path.ParseDistanceMatrix(NMCfg.DistanceMatrix)
if err != nil {
return err
}
} else {
for S, edgeinfoS := range NMCfg.EdgeNodes {
for D, edgeinfoD := range NMCfg.EdgeNodes {
if S == D {
continue
}
if len(edgeinfoS.Endpoint)+len(edgeinfoD.Endpoint) == 0 {
continue
}
edges = append(edges, mtypes.PongMsg{
Src_nodeID: S,
Dst_nodeID: D,
Timediff: 1,
TimeToAlive: 99999,
AdditionalCost: 0,
})
}
}
}
g.UpdateLatencyMulti(edges, false, false)
all_verts := g.Vertices()
@ -156,9 +177,12 @@ func GenNMCfg(NMCinfigPath string, printExample bool) (err error) {
}
}
econfig := GetExampleEdgeConf(NMCfg.EdgeConfigTemplate, false)
econfig.DynamicRoute.P2P.UseP2P = false
econfig.DynamicRoute.P2P.UseP2P = enableP2P
econfig.DynamicRoute.SuperNode.UseSuperNode = false
econfig.NextHopTable = next
if enableP2P {
econfig.NextHopTable = make(mtypes.NextHopTable)
}
econfig.DynamicRoute.NTPConfig.Servers = make([]string, 0)
econfig.DynamicRoute.SuperNode.PSKey = ""

View File

@ -264,7 +264,6 @@ func GenSuperCfg(SMCinfigPath string, printExample bool) (err error) {
peerceconf.DynamicRoute.SuperNode.EndpointV4 = EndpointV4 + ":" + ListenPort
peerceconf.DynamicRoute.SuperNode.EndpointV6 = EndpointV6 + ":" + ListenPort
peerceconf.DynamicRoute.SuperNode.EndpointEdgeAPIUrl = EndpointEdgeAPIUrl
peerceconf.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance = 0
peerceconf.Interface.MacAddrPrefix = MacPrefix
peerceconf.Interface.IPv4CIDR = IPv4Block
peerceconf.Interface.IPv6CIDR = IPv6Block

View File

@ -44,23 +44,8 @@ type NMCfg struct {
DistanceMatrix string `yaml:"Distance matrix for all nodes"`
}
type PMCfg struct {
ConfigOutputDir string `yaml:"Config output dir"`
EdgeConfigTemplate string `yaml:"ConfigTemplate for edge node"`
NetworkName string `yaml:"Network name"`
EdgeNode struct {
MacPrefix string `yaml:"MacAddress prefix"`
IPv4Range string `yaml:"IPv4 range"`
IPv6Range string `yaml:"IPv6 range"`
IPv6LLRange string `yaml:"IPv6 LL range"`
} `yaml:"Edge Node"`
EdgeNodes map[mtypes.Vertex]edge_raw_info `yaml:"Edge Nodes"`
}
type edge_raw_info struct {
Endpoint string `yaml:"Endpoint(optional)"`
PersistentKeepalive uint32 `yaml:"PersistentKeepalive"`
AdditionalCost float64 `yaml:"AdditionalCost"`
}
type edge_info struct {

View File

@ -72,7 +72,9 @@ func main() {
case "super":
err = gencfg.GenSuperCfg(*tconfig, *printExample)
case "static":
err = gencfg.GenNMCfg(*tconfig, *printExample)
err = gencfg.GenNMCfg(*tconfig, false, *printExample)
case "p2p":
err = gencfg.GenNMCfg(*tconfig, true, *printExample)
default:
err = fmt.Errorf("gencfg: generate config for %v mode are not implement", *cfgmode)
}

View File

@ -51,8 +51,8 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
if len(NodeName) > 32 {
return errors.New("Node name can't longer than 32 :" + NodeName)
}
if econfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance < 0 || econfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance >= 1 {
return fmt.Errorf("DampingResistance must in range [0,1) : %v", econfig.DynamicRoute.P2P.GraphRecalculateSetting.DampingResistance)
if econfig.DynamicRoute.DampingResistance < 0 || econfig.DynamicRoute.DampingResistance >= 1 {
return fmt.Errorf("DampingResistance must in range [0,1) : %v", econfig.DynamicRoute.DampingResistance)
}
var logLevel int
switch econfig.LogLevel.LogLevel {

View File

@ -230,10 +230,11 @@ func edge_get_superparams(w http.ResponseWriter, r *http.Request) {
}
// Do something
SuperParams := mtypes.API_SuperParams{
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
AdditionalCost: httpobj.http_PeerID2Info[NodeID].AdditionalCost,
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
AdditionalCost: httpobj.http_PeerID2Info[NodeID].AdditionalCost,
DampingResistance: httpobj.http_sconfig.DampingResistance,
}
SuperParamStr, _ := json.Marshal(SuperParams)
httpobj.http_PeerState[PubKey].SuperParamStateClient.Store(State)
@ -734,10 +735,11 @@ func manage_peerupdate(w http.ResponseWriter, r *http.Request) {
httpobj.http_PeerID2Info[toUpdate] = new_superpeerinfo
SuperParams := mtypes.API_SuperParams{
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
AdditionalCost: new_superpeerinfo.AdditionalCost,
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
DampingResistance: httpobj.http_sconfig.DampingResistance,
AdditionalCost: new_superpeerinfo.AdditionalCost,
}
SuperParamStr, _ := json.Marshal(SuperParams)
@ -797,6 +799,17 @@ func manage_superupdate(w http.ResponseWriter, r *http.Request) {
sconfig_temp.PeerAliveTimeout = PeerAliveTimeout
}
DampingResistance, err := extractParamsFloat(r.Form, "DampingResistance", 64, nil)
if err == nil {
if DampingResistance < 0 || DampingResistance >= 0 {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(fmt.Sprintf("Paramater DampingResistance %v: Must in range [0,1)\n", DampingResistance)))
return
}
Updated_params["DampingResistance"] = fmt.Sprintf("%v", DampingResistance)
sconfig_temp.DampingResistance = DampingResistance
}
SendPingInterval, err := extractParamsFloat(r.Form, "SendPingInterval", 64, nil)
if err == nil {
if SendPingInterval <= 0 || SendPingInterval >= sconfig_temp.PeerAliveTimeout {
@ -827,12 +840,14 @@ func manage_superupdate(w http.ResponseWriter, r *http.Request) {
httpobj.http_sconfig.PeerAliveTimeout = sconfig_temp.PeerAliveTimeout
httpobj.http_sconfig.SendPingInterval = sconfig_temp.SendPingInterval
httpobj.http_sconfig.HttpPostInterval = sconfig_temp.HttpPostInterval
httpobj.http_sconfig.DampingResistance = sconfig_temp.HttpPostInterval
SuperParams := mtypes.API_SuperParams{
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
AdditionalCost: 10,
SendPingInterval: httpobj.http_sconfig.SendPingInterval,
HttpPostInterval: httpobj.http_sconfig.HttpPostInterval,
PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout,
DampingResistance: httpobj.http_sconfig.PeerAliveTimeout,
AdditionalCost: 10,
}
httpobj.Lock()
defer httpobj.Unlock()

View File

@ -100,8 +100,8 @@ func Super(configPath string, useUAPI bool, printExample bool, bindmode string)
if sconfig.RePushConfigInterval <= 0 {
return fmt.Errorf("RePushConfigInterval must > 0 : %v", sconfig.RePushConfigInterval)
}
if sconfig.GraphRecalculateSetting.DampingResistance < 0 || sconfig.GraphRecalculateSetting.DampingResistance >= 1 {
return fmt.Errorf("DampingResistance must in range [0,1) : %v", sconfig.GraphRecalculateSetting.DampingResistance)
if sconfig.DampingResistance < 0 || sconfig.DampingResistance >= 1 {
return fmt.Errorf("DampingResistance must in range [0,1) : %v", sconfig.DampingResistance)
}
var logLevel int

View File

@ -10,11 +10,11 @@ import (
type Vertex uint16
const (
NodeID_Broadcast Vertex = math.MaxUint16 - iota // Normal boardcast, boardcast with route table
NodeID_Broadcast Vertex = math.MaxUint16 - iota // Normal boardcast, boardcast with route table
NodeID_AllPeer Vertex = math.MaxUint16 - iota // p2p mode: boardcast to every know peer and prevent dup. super mode: send to supernode
NodeID_SuperNode Vertex = math.MaxUint16 - iota
NodeID_Invalid Vertex = math.MaxUint16 - iota
NodeID_Special Vertex = NodeID_Invalid
NodeID_Invalid Vertex = math.MaxUint16 - iota
NodeID_Special Vertex = NodeID_Invalid
)
type EdgeConfig struct {
@ -46,6 +46,7 @@ type SuperConfig struct {
HttpPostInterval float64 `yaml:"HttpPostInterval"`
PeerAliveTimeout float64 `yaml:"PeerAliveTimeout"`
SendPingInterval float64 `yaml:"SendPingInterval"`
DampingResistance float64 `yaml:"DampingResistance"`
LogLevel LoggerInfo `yaml:"LogLevel"`
Passwords Passwords `yaml:"Passwords"`
GraphRecalculateSetting GraphRecalculateSetting `yaml:"GraphRecalculateSetting"`
@ -110,25 +111,28 @@ func (v *Vertex) ToString() string {
case NodeID_Broadcast:
return "Boardcast"
case NodeID_AllPeer:
return "Control"
return "AllPeer"
case NodeID_SuperNode:
return "Super"
case NodeID_Invalid:
return "Invalid"
default:
return strconv.Itoa(int(*v))
}
}
type DynamicRouteInfo struct {
SendPingInterval float64 `yaml:"SendPingInterval"`
PeerAliveTimeout float64 `yaml:"PeerAliveTimeout"`
DupCheckTimeout float64 `yaml:"DupCheckTimeout"`
ConnTimeOut float64 `yaml:"ConnTimeOut"`
ConnNextTry float64 `yaml:"ConnNextTry"`
AdditionalCost float64 `yaml:"AdditionalCost"`
SaveNewPeers bool `yaml:"SaveNewPeers"`
SuperNode SuperInfo `yaml:"SuperNode"`
P2P P2PInfo `yaml:"P2P"`
NTPConfig NTPInfo `yaml:"NTPConfig"`
SendPingInterval float64 `yaml:"SendPingInterval"`
PeerAliveTimeout float64 `yaml:"PeerAliveTimeout"`
TimeoutCheckInterval float64 `yaml:"TimeoutCheckInterval"`
ConnNextTry float64 `yaml:"ConnNextTry"`
DupCheckTimeout float64 `yaml:"DupCheckTimeout"`
AdditionalCost float64 `yaml:"AdditionalCost"`
DampingResistance float64 `yaml:"DampingResistance"`
SaveNewPeers bool `yaml:"SaveNewPeers"`
SuperNode SuperInfo `yaml:"SuperNode"`
P2P P2PInfo `yaml:"P2P"`
NTPConfig NTPInfo `yaml:"NTPConfig"`
}
type NTPInfo struct {
@ -162,7 +166,6 @@ type GraphRecalculateSetting struct {
ManualLatency DistTable `yaml:"ManualLatency"`
JitterTolerance float64 `yaml:"JitterTolerance"`
JitterToleranceMultiplier float64 `yaml:"JitterToleranceMultiplier"`
DampingResistance float64 `yaml:"DampingResistance"`
TimeoutCheckInterval float64 `yaml:"TimeoutCheckInterval"`
RecalculateCoolDown float64 `yaml:"RecalculateCoolDown"`
}
@ -215,10 +218,11 @@ type API_Peerinfo struct {
}
type API_SuperParams struct {
SendPingInterval float64
HttpPostInterval float64
PeerAliveTimeout float64
AdditionalCost float64
SendPingInterval float64
HttpPostInterval float64
PeerAliveTimeout float64
DampingResistance float64
AdditionalCost float64
}
type StateHash struct {

View File

@ -65,9 +65,6 @@ func NewGraph(num_node int, IsSuperMode bool, theconfig mtypes.GraphRecalculateS
g.edges = make(map[mtypes.Vertex]map[mtypes.Vertex]*Latency, num_node)
g.IsSuperMode = IsSuperMode
g.loglevel = loglevel
if theconfig.DampingResistance < 0 || theconfig.DampingResistance >= 1 {
return nil, fmt.Errorf("DampingResistance must in range [0,1)")
}
g.InitNTP()
return &g, nil
}
@ -206,9 +203,6 @@ func (g *IG) UpdateLatencyMulti(pong_info []mtypes.PongMsg, recalculate bool, ch
g.edgelock.Unlock()
oldval := g.OldWeight(u, v, false)
g.edgelock.Lock()
if oldval != mtypes.Infinity && g.IsSuperMode && g.gsetting.DampingResistance > 0 {
w = oldval*g.gsetting.DampingResistance + newval*(1-g.gsetting.DampingResistance)
}
should_update = should_update || g.ShouldUpdate(oldval, w, false)
if _, ok := g.edges[u][v]; ok {
g.edges[u][v].ping = w