mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-12 15:06:38 +00:00
deploy: 979f1d397ad6ed0ca60d3247c5130adfb58be01e
This commit is contained in:
parent
33d9f96409
commit
26b52bab7b
@ -36,11 +36,6 @@ type
|
||||
desc: "prints the version"
|
||||
defaultValue: false
|
||||
name: "version" }: bool
|
||||
|
||||
agentString* {.
|
||||
defaultValue: "nwaku",
|
||||
desc: "Node agent string which is used as identifier in network"
|
||||
name: "agent-string" .}: string
|
||||
|
||||
nodekey* {.
|
||||
desc: "P2P node private key as 64 char hex string.",
|
||||
|
@ -283,8 +283,7 @@ proc initNode(conf: WakuNodeConf,
|
||||
dnsResolver,
|
||||
conf.relayPeerExchange, # We send our own signed peer record when peer exchange enabled
|
||||
dns4DomainName,
|
||||
discv5UdpPort,
|
||||
some(conf.agentString)
|
||||
discv5UdpPort
|
||||
)
|
||||
except:
|
||||
return err("failed to create waku node instance: " & getCurrentExceptionMsg())
|
||||
|
@ -209,39 +209,3 @@ procSuite "WakuNode":
|
||||
check:
|
||||
node.announcedAddresses.len == 1
|
||||
node.announcedAddresses.contains(expectedDns4Addr)
|
||||
|
||||
|
||||
asyncTest "Agent string is set and advertised correctly":
|
||||
let
|
||||
# custom agent string
|
||||
expectedAgentString1 = "node1-agent-string"
|
||||
|
||||
# bump when updating nim-libp2p
|
||||
expectedAgentString2 = "nim-libp2p/0.0.1"
|
||||
let
|
||||
# node with custom agent string
|
||||
nodeKey1 = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
||||
node1 = WakuNode.new(nodeKey1, ValidIpAddress.init("0.0.0.0"), Port(60000),
|
||||
agentString = some(expectedAgentString1))
|
||||
|
||||
# node with default agent string from libp2p
|
||||
nodeKey2 = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
||||
node2 = WakuNode.new(nodeKey2, ValidIpAddress.init("0.0.0.0"), Port(60002))
|
||||
|
||||
await node1.start()
|
||||
await node1.mountRelay()
|
||||
|
||||
await node2.start()
|
||||
await node2.mountRelay()
|
||||
|
||||
await node1.connectToNodes(@[node2.switch.peerInfo.toRemotePeerInfo()])
|
||||
await node2.connectToNodes(@[node1.switch.peerInfo.toRemotePeerInfo()])
|
||||
|
||||
let node1Agent = node2.switch.peerStore[AgentBook][node1.switch.peerInfo.toRemotePeerInfo().peerId]
|
||||
let node2Agent = node1.switch.peerStore[AgentBook][node2.switch.peerInfo.toRemotePeerInfo().peerId]
|
||||
|
||||
check:
|
||||
node1Agent == expectedAgentString1
|
||||
node2Agent == expectedAgentString2
|
||||
|
||||
await allFutures(node1.stop(), node2.stop())
|
@ -2,7 +2,7 @@
|
||||
|
||||
# libtool - Provide generalized library-building support services.
|
||||
# Generated automatically by config.status (libbacktrace) version-unused
|
||||
# Libtool was configured on host fv-az74-384:
|
||||
# Libtool was configured on host fv-az201-830:
|
||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||
|
@ -129,9 +129,7 @@ proc new*(T: type WakuNode,
|
||||
nameResolver: NameResolver = nil,
|
||||
sendSignedPeerRecord = false,
|
||||
dns4DomainName = none(string),
|
||||
discv5UdpPort = none(Port),
|
||||
agentString = none(string), # defaults to nim-libp2p version
|
||||
): T {.raises: [Defect, LPError, IOError, TLSStreamProtocolError].} =
|
||||
discv5UdpPort = none(Port)): T {.raises: [Defect, LPError, IOError, TLSStreamProtocolError].} =
|
||||
## Creates a Waku Node instance.
|
||||
|
||||
## Initialize addresses
|
||||
@ -200,8 +198,7 @@ proc new*(T: type WakuNode,
|
||||
secureKeyPath = secureKey,
|
||||
secureCertPath = secureCert,
|
||||
nameResolver = nameResolver,
|
||||
sendSignedPeerRecord = sendSignedPeerRecord,
|
||||
agentString = agentString
|
||||
sendSignedPeerRecord = sendSignedPeerRecord
|
||||
)
|
||||
|
||||
let wakuNode = WakuNode(
|
||||
|
@ -70,9 +70,7 @@ proc newWakuSwitch*(
|
||||
sendSignedPeerRecord = false,
|
||||
wssEnabled: bool = false,
|
||||
secureKeyPath: string = "",
|
||||
secureCertPath: string = "",
|
||||
agentString = none(string), # defaults to nim-libp2p version
|
||||
): Switch
|
||||
secureCertPath: string = ""): Switch
|
||||
{.raises: [Defect, IOError, LPError].} =
|
||||
|
||||
var b = SwitchBuilder
|
||||
@ -88,8 +86,6 @@ proc newWakuSwitch*(
|
||||
.withNameResolver(nameResolver)
|
||||
.withSignedPeerRecord(sendSignedPeerRecord)
|
||||
|
||||
if agentString.isSome():
|
||||
b = b.withAgentVersion(agentString.get())
|
||||
if privKey.isSome():
|
||||
b = b.withPrivateKey(privKey.get())
|
||||
if wsAddress.isSome():
|
||||
|
Loading…
x
Reference in New Issue
Block a user