richΛrd d65f32f819
chore: update libp2p to 2.0.0 (#1443)
Co-authored-by: Arnaud <arnaud@status.im>
2026-06-12 12:32:33 +00:00

20 lines
579 B
Nim

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()
.withAddresses(@[addrs], enableWildcardResolver = true)
.withSignedPeerRecord(sendSignedPeerRecord)
.withIdentifyPusher(false)
.withRng(storage_rng.Rng.instance().libp2pRng)
.withNoise()
.withMplex()
.withTcpTransport(transportFlags)
.build()