add remote URI to GetPeers (fallback to net.Conn.RemoteAddr().String() if the uri is unknown)

This commit is contained in:
Arceliar 2021-06-13 09:25:08 -05:00
parent 6c63b02385
commit c6a7a077a3
4 changed files with 16 additions and 3 deletions

View file

@ -18,6 +18,7 @@ type PeerEntry struct {
PublicKey string `json:"key"`
Port uint64 `json:"port"`
Coords []uint64 `json:"coords"`
Remote string `json:"remote"`
}
func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersResponse) error {
@ -29,6 +30,7 @@ func (a *AdminSocket) getPeersHandler(req *GetPeersRequest, res *GetPeersRespons
PublicKey: hex.EncodeToString(p.Key),
Port: p.Port,
Coords: p.Coords,
Remote: p.Remote,
}
}
return nil