fix: get_waku_v2_admin_v1_peers response

This commit is contained in:
Richard Ramos 2022-07-26 13:49:10 -04:00
parent ecf55b6f89
commit 069d66ed6d
No known key found for this signature in database
GPG Key ID: BD36D48BC9FFC88C
1 changed files with 3 additions and 5 deletions

View File

@ -26,14 +26,12 @@ type PeersArgs struct {
} }
type PeerReply struct { type PeerReply struct {
Multiaddr string `json:"mutliaddr,omitempty"` Multiaddr string `json:"multiaddr,omitempty"`
Protocol string `json:"protocol,omitempty"` Protocol string `json:"protocol,omitempty"`
Connected bool `json:"connected,omitempty"` Connected bool `json:"connected,omitempty"`
} }
type PeersReply struct { type PeersReply []PeerReply
Peers []PeerReply `json:"peers,omitempty"`
}
func (a *AdminService) PostV1Peers(req *http.Request, args *PeersArgs, reply *SuccessReply) error { func (a *AdminService) PostV1Peers(req *http.Request, args *PeersArgs, reply *SuccessReply) error {
for _, peer := range args.Peers { for _, peer := range args.Peers {
@ -70,7 +68,7 @@ func (a *AdminService) GetV1Peers(req *http.Request, args *GetPeersArgs, reply *
if !isWakuProtocol(proto) { if !isWakuProtocol(proto) {
continue continue
} }
reply.Peers = append(reply.Peers, PeerReply{ *reply = append(*reply, PeerReply{
Multiaddr: addr.String(), Multiaddr: addr.String(),
Protocol: proto, Protocol: proto,
Connected: peer.Connected, Connected: peer.Connected,