diff --git a/.vscode/launch.json b/.vscode/launch.json index a31bf61..c8b29d4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,7 +22,7 @@ "program": "${workspaceFolder}", "buildFlags": "-tags 'novpp'", "env": {"CGO_CFLAGS":"-I/usr/include/memif"}, - "args":["-config","example_config/p2p_mode/EgNet_edge1.yaml","-mode","edge"/*,"-example"*/], + "args":["-config","example_config/super_mode/EgNet_edge001.yaml","-mode","edge"/*,"-example"*/], }, { "name": "Launch GenCfg", diff --git a/example_config/super_mode/EgNet_super.yaml b/example_config/super_mode/EgNet_super.yaml index 73f46b9..a2aefd3 100644 --- a/example_config/super_mode/EgNet_super.yaml +++ b/example_config/super_mode/EgNet_super.yaml @@ -19,11 +19,11 @@ LogLevel: LogInternal: true LogNTP: true Passwords: - ShowState: zOWP0T9O_showstate - AddPeer: zOWP0T9O_addpeer - DelPeer: zOWP0T9O_delpeer - UpdatePeer: zOWP0T9O_updatepeer - UpdateSuper: zOWP0T9O_updatesuper + ShowState: passwd_showstate + AddPeer: passwd_addpeer + DelPeer: passwd_delpeer + UpdatePeer: passwd_updatepeer + UpdateSuper: passwd_updatesuper GraphRecalculateSetting: StaticMode: false ManualLatency: {} diff --git a/example_config/super_mode/README_zh.md b/example_config/super_mode/README_zh.md index a746558..4971bd0 100644 --- a/example_config/super_mode/README_zh.md +++ b/example_config/super_mode/README_zh.md @@ -276,7 +276,7 @@ curl "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/del?PrivKey=iquaLyD%2BYLzW ### peer/update 更新節點的一些參數 ```bash -curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/eg_api/manage/peer/update?Password=e05znou1_updatepeer&NodeID=1" \ +curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/manage/peer/update?Password=passwd_updatepeer&NodeID=1" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "AdditionalCost=10&SkipLocalIP=false" ``` @@ -284,9 +284,9 @@ curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/eg_api/manage/peer/update?Pass ### super/update 更新SuperNode的一些參數 ```bash -curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/eg_api/manage/super/update?Password=e05znou1_updatesuper" \ +curl -X POST "http://127.0.0.1:3456/eg_net/eg_api/manage/super/update?Password=passwd_updatesuper" \ -H "Content-Type: application/x-www-form-urlencoded" \ - -d "SendPingInterval=15&HttpPostInterval=60&PeerAliveTimeout=70DampingResistance=0.9" + -d "SendPingInterval=15&HttpPostInterval=60&PeerAliveTimeout=70&DampingResistance=0.9" ``` ### SuperNode Config Parameter diff --git a/main_httpserver.go b/main_httpserver.go index 0720e7d..d78510c 100644 --- a/main_httpserver.go +++ b/main_httpserver.go @@ -787,6 +787,7 @@ func manage_superupdate(w http.ResponseWriter, r *http.Request) { sconfig_temp.PeerAliveTimeout = httpobj.http_sconfig.PeerAliveTimeout sconfig_temp.SendPingInterval = httpobj.http_sconfig.SendPingInterval sconfig_temp.HttpPostInterval = httpobj.http_sconfig.HttpPostInterval + sconfig_temp.DampingResistance = httpobj.http_sconfig.DampingResistance PeerAliveTimeout, err := extractParamsFloat(r.Form, "PeerAliveTimeout", 64, nil) if err == nil { @@ -801,7 +802,7 @@ func manage_superupdate(w http.ResponseWriter, r *http.Request) { DampingResistance, err := extractParamsFloat(r.Form, "DampingResistance", 64, nil) if err == nil { - if DampingResistance < 0 || DampingResistance >= 0 { + if DampingResistance < 0 || DampingResistance >= 1 { w.WriteHeader(http.StatusBadRequest) w.Write([]byte(fmt.Sprintf("Paramater DampingResistance %v: Must in range [0,1)\n", DampingResistance))) return @@ -840,13 +841,13 @@ 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 + httpobj.http_sconfig.DampingResistance = sconfig_temp.DampingResistance SuperParams := mtypes.API_SuperParams{ SendPingInterval: httpobj.http_sconfig.SendPingInterval, HttpPostInterval: httpobj.http_sconfig.HttpPostInterval, PeerAliveTimeout: httpobj.http_sconfig.PeerAliveTimeout, - DampingResistance: httpobj.http_sconfig.PeerAliveTimeout, + DampingResistance: httpobj.http_sconfig.DampingResistance, AdditionalCost: 10, } httpobj.Lock()