2024-02-06 16:37:42 +00:00
|
|
|
{.used.}
|
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
import std/options, chronicles, chronos, libp2p/crypto/crypto
|
2024-02-06 16:37:42 +00:00
|
|
|
|
|
|
|
import
|
2024-07-05 22:03:38 +00:00
|
|
|
waku/node/peer_manager,
|
|
|
|
waku/waku_core,
|
|
|
|
waku/waku_lightpush,
|
|
|
|
waku/waku_lightpush/[client, common],
|
2024-07-16 13:46:21 +00:00
|
|
|
waku/common/rate_limit/setting,
|
2024-03-15 23:08:47 +00:00
|
|
|
../testlib/[common, wakucore]
|
2024-02-06 16:37:42 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc newTestWakuLightpushNode*(
|
2024-04-15 13:28:35 +00:00
|
|
|
switch: Switch,
|
|
|
|
handler: PushMessageHandler,
|
|
|
|
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
2024-03-15 23:08:47 +00:00
|
|
|
): Future[WakuLightPush] {.async.} =
|
2024-02-06 16:37:42 +00:00
|
|
|
let
|
|
|
|
peerManager = PeerManager.new(switch)
|
2024-04-15 13:28:35 +00:00
|
|
|
proto = WakuLightPush.new(peerManager, rng, handler, rateLimitSetting)
|
2024-02-06 16:37:42 +00:00
|
|
|
|
|
|
|
await proto.start()
|
|
|
|
switch.mount(proto)
|
|
|
|
|
|
|
|
return proto
|
|
|
|
|
|
|
|
proc newTestWakuLightpushClient*(switch: Switch): WakuLightPushClient =
|
|
|
|
let peerManager = PeerManager.new(switch)
|
|
|
|
WakuLightPushClient.new(peerManager, rng)
|