update admin functions and fix core tests

This commit is contained in:
Arceliar 2023-03-26 16:49:40 -05:00
parent abbe94fa80
commit e99c870d51
9 changed files with 66 additions and 45 deletions

View file

@ -1,5 +1,4 @@
/*
This file generates crypto keys.
It prints out a new set of keys each time if finds a "better" one.
By default, "better" means a higher NodeID (-> higher IP address).
@ -8,7 +7,6 @@ This is because the IP address format can compress leading 1s in the address, to
If run with the "-sig" flag, it generates signing keys instead.
A "better" signing key means one with a higher TreeID.
This only matters if it's high enough to make you the root of the tree.
*/
package main

View file

@ -194,31 +194,36 @@ func run() int {
if err := json.Unmarshal(recv.Response, &resp); err != nil {
panic(err)
}
table.SetHeader([]string{"Public Key", "IP Address", "Port", "Rest"})
//table.SetHeader([]string{"Public Key", "IP Address", "Port", "Rest"})
table.SetHeader([]string{"Public Key", "IP Address", "Parent", "Sequence"})
for _, dht := range resp.DHT {
table.Append([]string{
dht.PublicKey,
dht.IPAddress,
fmt.Sprintf("%d", dht.Port),
fmt.Sprintf("%d", dht.Rest),
dht.Parent,
fmt.Sprintf("%d", dht.Sequence),
//fmt.Sprintf("%d", dht.Port),
//fmt.Sprintf("%d", dht.Rest),
})
}
table.Render()
case "getpaths":
var resp admin.GetPathsResponse
if err := json.Unmarshal(recv.Response, &resp); err != nil {
panic(err)
}
table.SetHeader([]string{"Public Key", "IP Address", "Seq"})
for _, p := range resp.Paths {
table.Append([]string{
p.PublicKey,
p.IPAddress,
fmt.Sprintf("%d", p.Sequence),
})
}
table.Render()
/*
case "getpaths":
var resp admin.GetPathsResponse
if err := json.Unmarshal(recv.Response, &resp); err != nil {
panic(err)
}
table.SetHeader([]string{"Public Key", "IP Address", "Seq"})
for _, p := range resp.Paths {
table.Append([]string{
p.PublicKey,
p.IPAddress,
fmt.Sprintf("%d", p.Sequence),
})
}
table.Render()
*/
case "getsessions":
var resp admin.GetSessionsResponse