mirror of https://github.com/waku-org/nwaku.git
Revert "wss multiaddress switch support"
This reverts commit ac76e2f189
.
This commit is contained in:
parent
ac76e2f189
commit
5f76d90b7f
|
@ -12,8 +12,6 @@ import
|
||||||
libp2p/protocols/pubsub/gossipsub,
|
libp2p/protocols/pubsub/gossipsub,
|
||||||
libp2p/nameresolving/dnsresolver,
|
libp2p/nameresolving/dnsresolver,
|
||||||
libp2p/builders,
|
libp2p/builders,
|
||||||
libp2p/transports/wstransport,
|
|
||||||
libp2p/multicodec,
|
|
||||||
../protocol/[waku_relay, waku_message],
|
../protocol/[waku_relay, waku_message],
|
||||||
../protocol/waku_store/waku_store,
|
../protocol/waku_store/waku_store,
|
||||||
../protocol/waku_swap/waku_swap,
|
../protocol/waku_swap/waku_swap,
|
||||||
|
@ -124,9 +122,6 @@ proc removeContentFilters(filters: var Filters, contentFilters: seq[ContentFilte
|
||||||
template tcpEndPoint(address, port): auto =
|
template tcpEndPoint(address, port): auto =
|
||||||
MultiAddress.init(address, tcpProtocol, port)
|
MultiAddress.init(address, tcpProtocol, port)
|
||||||
|
|
||||||
template addWssFlag() =
|
|
||||||
MultiAddress.init(multiCodec("ws"))
|
|
||||||
|
|
||||||
## Public API
|
## Public API
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -142,9 +137,6 @@ proc new*(T: type WakuNode, nodeKey: crypto.PrivateKey,
|
||||||
let
|
let
|
||||||
rng = crypto.newRng()
|
rng = crypto.newRng()
|
||||||
hostAddress = tcpEndPoint(bindIp, bindPort)
|
hostAddress = tcpEndPoint(bindIp, bindPort)
|
||||||
|
|
||||||
hostAddressWithWss = hostAddress & addWssFlag.get()
|
|
||||||
|
|
||||||
announcedAddresses = if extIp.isNone() or extPort.isNone(): @[]
|
announcedAddresses = if extIp.isNone() or extPort.isNone(): @[]
|
||||||
else: @[tcpEndPoint(extIp.get(), extPort.get())]
|
else: @[tcpEndPoint(extIp.get(), extPort.get())]
|
||||||
peerInfo = PeerInfo.init(nodekey)
|
peerInfo = PeerInfo.init(nodekey)
|
||||||
|
@ -156,26 +148,11 @@ proc new*(T: type WakuNode, nodeKey: crypto.PrivateKey,
|
||||||
|
|
||||||
info "Initializing networking", hostAddress,
|
info "Initializing networking", hostAddress,
|
||||||
announcedAddresses
|
announcedAddresses
|
||||||
|
|
||||||
#info "Initializing networking", hostAddressWithWss,
|
|
||||||
# announcedAddresses
|
|
||||||
|
|
||||||
# XXX: Add this when we create node or start it?
|
# XXX: Add this when we create node or start it?
|
||||||
peerInfo.addrs.add(hostAddress) # Index 0
|
peerInfo.addrs.add(hostAddress) # Index 0
|
||||||
for multiaddr in announcedAddresses:
|
for multiaddr in announcedAddresses:
|
||||||
peerInfo.addrs.add(multiaddr) # Announced addresses in index > 0
|
peerInfo.addrs.add(multiaddr) # Announced addresses in index > 0
|
||||||
|
|
||||||
# WSS switch builder code
|
|
||||||
let WssSwitch = SwitchBuilder
|
|
||||||
.new()
|
|
||||||
.withAddress(hostAddressWithWss)
|
|
||||||
.withRng(rng)
|
|
||||||
.withMplex()
|
|
||||||
.withTransport(proc (upgr: Upgrade): Transport = WsTransport.new(upgr))
|
|
||||||
.withNoise()
|
|
||||||
.build()
|
|
||||||
|
|
||||||
|
|
||||||
var switch = newStandardSwitch(some(nodekey), hostAddress,
|
var switch = newStandardSwitch(some(nodekey), hostAddress,
|
||||||
transportFlags = {ServerFlags.ReuseAddr}, rng = rng)
|
transportFlags = {ServerFlags.ReuseAddr}, rng = rng)
|
||||||
# TODO Untested - verify behavior after switch interface change
|
# TODO Untested - verify behavior after switch interface change
|
||||||
|
|
Loading…
Reference in New Issue