keep track of participating tunnels

This commit is contained in:
idk
2020-01-09 18:26:25 -05:00
parent f19ddbf66f
commit 0608951c4c
2 changed files with 18 additions and 1 deletions

View File

@ -27,5 +27,9 @@ func TestAuth(t *testing.T) {
} else {
t.Log("Your I2P router doesn't need an update")
}
tunnels, err := ParticipatingTunnels()
if err != nil {
t.Fatal(err)
}
t.Log(tunnels, "Participating tunnels")
}

13
info.go Normal file
View File

@ -0,0 +1,13 @@
package i2pcontrol
func ParticipatingTunnels() (int, error) {
retpre, err := Call("RouterInfo", map[string]interface{}{
"i2p.router.net.tunnels.participating": nil,
"Token": token,
})
if err != nil {
return -1, err
}
result := int(retpre["i2p.router.net.tunnels.participating"].(float64))
return result, nil
}