mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-12 21:50:01 +00:00
20 lines
579 B
Nim
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()
|