ManualLatency anytarget

This commit is contained in:
KusakabeSi 2021-12-28 09:45:35 +00:00
parent 3a1fad0366
commit 999fb6d641
5 changed files with 39 additions and 8 deletions

View File

@ -26,7 +26,15 @@ Passwords:
UpdateSuper: passwd_updatesuper
GraphRecalculateSetting:
StaticMode: false
ManualLatency: {}
ManualLatency:
1:
2: 1.14
2:
1: 5.14
100:
65535: 1.919
65535:
100: 8.1
JitterTolerance: 30
JitterToleranceMultiplier: 1.01
TimeoutCheckInterval: 5

View File

@ -321,7 +321,7 @@ UpdateSuper | HTTP ManageAPI `super/update` 的密碼
<a name="GraphRecalculateSetting"></a>GraphRecalculateSetting | Description
--------------------|:-----
StaticMode | 關閉`Floyd-Warshall`演算法只使用設定檔提供的NextHopTable`。SuperNode單純用來輔助打洞
ManualLatency | 手動設定延遲不採用EdgeNode回報的延遲(單位: 毫秒)
ManualLatency | 手動設定延遲不採用EdgeNode回報的延遲(單位: 毫秒)<br> 特殊值65535匹配任何目標
JitterTolerance | 抖動容許誤差收到Pong以後一個37ms一個39ms不會觸發重新計算<br>比較對象是上次更新使用的值。如果37 37 41 43 .. 100 ,每次變動一點點,總變動量超過域值還是會更新
JitterToleranceMultiplier | 抖動容許誤差的放大係數高ping的話允許更多誤差<br>https://www.desmos.com/calculator/raoti16r5n
DampingFilterRadius | 防抖用低通濾波器的window半徑

View File

@ -85,10 +85,16 @@ func GetExampleEdgeConf(templatePath string, getDemo bool) (mtypes.EdgeConfig, e
RecalculateCoolDown: 5,
ManualLatency: mtypes.DistTable{
mtypes.Vertex(1): {
mtypes.Vertex(2): 2,
mtypes.Vertex(2): 1.14,
},
mtypes.Vertex(2): {
mtypes.Vertex(1): 2,
mtypes.Vertex(1): 5.14,
},
mtypes.Vertex(100): {
mtypes.NodeID_Broadcast: 1.919,
},
mtypes.NodeID_Broadcast: {
mtypes.Vertex(100): 8.1,
},
},
},
@ -224,6 +230,12 @@ func GetExampleSuperConf(templatePath string, getDemo bool) (mtypes.SuperConfig,
mtypes.Vertex(2): {
mtypes.Vertex(1): 5.14,
},
mtypes.Vertex(100): {
mtypes.NodeID_Broadcast: 1.919,
},
mtypes.NodeID_Broadcast: {
mtypes.Vertex(100): 8.1,
},
},
JitterTolerance: 30,
JitterToleranceMultiplier: 1.01,

View File

@ -98,7 +98,7 @@ func Edge(configPath string, useUAPI bool, printExample bool, bindmode string) (
case "tap":
thetap, err = tap.CreateTAP(econfig.Interface, econfig.NodeID)
default:
return errors.New("Unknow interface type:" + econfig.Interface.IType)
return errors.New("Unknown interface type:" + econfig.Interface.IType)
}
if err != nil {
logger.Errorf("Failed to create TAP device: %v", err)

View File

@ -184,9 +184,20 @@ func (g *IG) UpdateLatencyMulti(pong_info []mtypes.PongMsg, recalculate bool, ch
u := pong_msg.Src_nodeID
v := pong_msg.Dst_nodeID
newval := pong_msg.Timediff
if _, ok := g.gsetting.ManualLatency[u]; ok {
if _, ok := g.gsetting.ManualLatency[u][v]; ok {
newval = g.gsetting.ManualLatency[u][v] / 1000 // s to ms
if dst_latency, ok := g.gsetting.ManualLatency[mtypes.NodeID_Broadcast]; ok {
if _, ok := dst_latency[mtypes.NodeID_Broadcast]; ok {
newval = dst_latency[mtypes.NodeID_Broadcast] / 1000 // s to ms
}
if _, ok := dst_latency[v]; ok {
newval = dst_latency[v] / 1000 // s to ms
}
}
if dst_latency, ok := g.gsetting.ManualLatency[u]; ok {
if _, ok := dst_latency[mtypes.NodeID_Broadcast]; ok {
newval = dst_latency[mtypes.NodeID_Broadcast] / 1000 // s to ms
}
if _, ok := dst_latency[v]; ok {
newval = dst_latency[v] / 1000 // s to ms
}
}
w := newval