mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-11-21 23:03:08 +01:00
Fix bug manage_superupdate
This commit is contained in:
parent
db8cf4710a
commit
89f1548dd4
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -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",
|
||||
|
@ -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: {}
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user