mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-04 05:00:02 +00:00
* bump libp2p pin to release/v2.0.0 (c43199378) * pin nimble.lock: lsquic/websock/boringssl/protobuf_serialization/npeg/jwt * add libp2p_mix dep and point libp2p/protocols/mix -> libp2p_mix * migrate rng to libp2p Rng type (prod, channels, noise, tests) * noise: take Rng, extract bearSslDrbg internally * waku_switch: TransportConfig factory; withMaxInOut; local MaxConnections * waku_relay/rendezvous/discv5/kademlia: v2.0.0 API (rng, config, ServiceDiscovery) * tests: newStandardSwitch shim; PeerId.random(rng); common.rng()/crypto.newRng() * drop libp2p/utils/semaphore (use chronos AsyncSemaphore) * add waku/compat/option_valueor shim where needed * add std/options where transitive re-export dropped
34 lines
958 B
Nim
34 lines
958 B
Nim
{.used.}
|
|
|
|
import std/options, chronos, chronicles, libp2p/crypto/crypto
|
|
|
|
import
|
|
waku/node/peer_manager,
|
|
waku/waku_core,
|
|
waku/waku_core/topics/sharding,
|
|
waku/waku_lightpush,
|
|
waku/waku_lightpush/[client, common],
|
|
waku/common/rate_limit/setting,
|
|
../testlib/[common, wakucore]
|
|
|
|
proc newTestWakuLightpushNode*(
|
|
switch: Switch,
|
|
handler: PushMessageHandler,
|
|
rateLimitSetting: Option[RateLimitSetting] = none[RateLimitSetting](),
|
|
): Future[WakuLightPush] {.async.} =
|
|
let
|
|
peerManager = PeerManager.new(switch)
|
|
wakuAutoSharding = Sharding(clusterId: 1, shardCountGenZero: 8)
|
|
proto = WakuLightPush.new(
|
|
peerManager, crypto.newRng(), handler, some(wakuAutoSharding), rateLimitSetting
|
|
)
|
|
|
|
await proto.start()
|
|
switch.mount(proto)
|
|
|
|
return proto
|
|
|
|
proc newTestWakuLightpushClient*(switch: Switch): WakuLightPushClient =
|
|
let peerManager = PeerManager.new(switch)
|
|
WakuLightPushClient.new(peerManager, crypto.newRng())
|