5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-22 23:25:39 +00:00

Update mobile bindings

This commit is contained in:
Neil Alexander 2023-05-14 10:16:33 +01:00
parent 669e61af9a
commit c7ea223a9a
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 14 additions and 7 deletions

View File

@ -190,10 +190,9 @@ func (m *Yggdrasil) GetPublicKeyString() string {
return hex.EncodeToString(m.core.GetSelf().Key) return hex.EncodeToString(m.core.GetSelf().Key)
} }
// GetCoordsString gets the node's coordinates // GetRoutingEntries gets the number of entries in the routing table
func (m *Yggdrasil) GetCoordsString() string { func (m *Yggdrasil) GetRoutingEntries() int {
return "N/A" return int(m.core.GetSelf().RoutingEntries)
// return fmt.Sprintf("%v", m.core.GetSelf().Coords)
} }
func (m *Yggdrasil) GetPeersJSON() (result string) { func (m *Yggdrasil) GetPeersJSON() (result string) {
@ -219,8 +218,16 @@ func (m *Yggdrasil) GetPeersJSON() (result string) {
} }
} }
func (m *Yggdrasil) GetDHTJSON() (result string) { func (m *Yggdrasil) GetPathsJSON() (result string) {
if res, err := json.Marshal(m.core.GetDHT()); err == nil { if res, err := json.Marshal(m.core.GetPaths()); err == nil {
return string(res)
} else {
return "{}"
}
}
func (m *Yggdrasil) GetTreeJSON() (result string) {
if res, err := json.Marshal(m.core.GetTree()); err == nil {
return string(res) return string(res)
} else { } else {
return "{}" return "{}"

View File

@ -9,7 +9,7 @@ func TestStartYggdrasil(t *testing.T) {
} }
t.Log("Address:", ygg.GetAddressString()) t.Log("Address:", ygg.GetAddressString())
t.Log("Subnet:", ygg.GetSubnetString()) t.Log("Subnet:", ygg.GetSubnetString())
t.Log("Coords:", ygg.GetCoordsString()) t.Log("Routing entries:", ygg.GetRoutingEntries())
if err := ygg.Stop(); err != nil { if err := ygg.Stop(); err != nil {
t.Fatalf("Failed to stop Yggdrasil: %s", err) t.Fatalf("Failed to stop Yggdrasil: %s", err)
} }