2026-06-12 08:32:33 -04:00
|
|
|
import pkg/libp2p
|
|
|
|
|
import pkg/storage/rng as storage_rng
|
|
|
|
|
|
|
|
|
|
proc newStandardSwitch*(
|
|
|
|
|
transportFlags: set[ServerFlags] = {},
|
|
|
|
|
sendSignedPeerRecord = false,
|
|
|
|
|
addrs: MultiAddress =
|
|
|
|
|
MultiAddress.init("/ip4/127.0.0.1/tcp/0").expect("invalid multiaddress"),
|
|
|
|
|
): Switch =
|
|
|
|
|
SwitchBuilder
|
|
|
|
|
.new()
|
2026-07-21 03:46:22 +04:00
|
|
|
.withAddresses(@[addrs])
|
|
|
|
|
.withWildcardResolver(true)
|
2026-06-12 08:32:33 -04:00
|
|
|
.withSignedPeerRecord(sendSignedPeerRecord)
|
|
|
|
|
.withIdentifyPusher(false)
|
|
|
|
|
.withRng(storage_rng.Rng.instance().libp2pRng)
|
|
|
|
|
.withNoise()
|
|
|
|
|
.withMplex()
|
|
|
|
|
.withTcpTransport(transportFlags)
|
|
|
|
|
.build()
|