mirror of https://github.com/waku-org/nwaku.git
chore(REST): returning lightpush support and updated filter protocol (#2219)
This commit is contained in:
parent
c48accb513
commit
59ee3c69c8
|
@ -16,6 +16,8 @@ import
|
|||
../../../waku_core,
|
||||
../../../waku_store,
|
||||
../../../waku_filter,
|
||||
../../../waku_filter_v2,
|
||||
../../../waku_lightpush,
|
||||
../../../waku_relay,
|
||||
../../../waku_node,
|
||||
../../../node/peer_manager,
|
||||
|
@ -61,6 +63,14 @@ proc installAdminV1GetPeersHandler(router: var RestRouter, node: WakuNode) =
|
|||
connected: it.connectedness == Connectedness.Connected))
|
||||
tuplesToWakuPeers(peers, filterPeers)
|
||||
|
||||
if not node.wakuFilter.isNil():
|
||||
# Map WakuFilter peers to WakuPeers and add to return list
|
||||
let filterV2Peers = node.peerManager.peerStore.peers(WakuFilterSubscribeCodec)
|
||||
.mapIt((multiaddr: constructMultiaddrStr(it),
|
||||
protocol: WakuFilterSubscribeCodec,
|
||||
connected: it.connectedness == Connectedness.Connected))
|
||||
tuplesToWakuPeers(peers, filterV2Peers)
|
||||
|
||||
if not node.wakuStore.isNil():
|
||||
# Map WakuStore peers to WakuPeers and add to return list
|
||||
let storePeers = node.peerManager.peerStore
|
||||
|
@ -70,6 +80,15 @@ proc installAdminV1GetPeersHandler(router: var RestRouter, node: WakuNode) =
|
|||
connected: it.connectedness == Connectedness.Connected))
|
||||
tuplesToWakuPeers(peers, storePeers)
|
||||
|
||||
if not node.wakuLightPush.isNil():
|
||||
# Map WakuStore peers to WakuPeers and add to return list
|
||||
let lightpushPeers = node.peerManager.peerStore
|
||||
.peers(WakuLightPushCodec)
|
||||
.mapIt((multiaddr: constructMultiaddrStr(it),
|
||||
protocol: WakuLightPushCodec,
|
||||
connected: it.connectedness == Connectedness.Connected))
|
||||
tuplesToWakuPeers(peers, lightpushPeers)
|
||||
|
||||
let resp = RestApiResponse.jsonResponse(peers, status=Http200)
|
||||
if resp.isErr():
|
||||
error "An error ocurred while building the json respose: ", error=resp.error
|
||||
|
|
Loading…
Reference in New Issue