mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-12 05:19:33 +00:00
update libp2p & add addr filtering
This commit is contained in:
parent
e4e3502aa7
commit
e5740c2f12
@ -10,8 +10,7 @@ import
|
||||
libp2p/protocols/mix/mix_protocol,
|
||||
libp2p/[peerid, multiaddress, switch],
|
||||
libp2p/extended_peer_record,
|
||||
libp2p/protocols/[kademlia, kad_disco],
|
||||
libp2p/protocols/kademlia_discovery/types as kad_types,
|
||||
libp2p/protocols/[kademlia, service_discovery],
|
||||
libp2p/protocols/service_discovery/types
|
||||
|
||||
import waku/waku_core, waku/node/peer_manager
|
||||
@ -22,7 +21,7 @@ logScope:
|
||||
const DefaultKademliaDiscoveryInterval* = chronos.seconds(60)
|
||||
|
||||
type WakuKademlia* = ref object
|
||||
protocol*: KademliaDiscovery
|
||||
protocol*: ServiceDiscovery
|
||||
peerManager: PeerManager
|
||||
loopInterval: Duration
|
||||
#periodicWalkFut: Future[void]
|
||||
@ -158,12 +157,11 @@ proc new*(
|
||||
if bootstrapNodes.len == 0:
|
||||
debug "creating kademlia discovery as seed node (no bootstrap nodes)"
|
||||
|
||||
let kademlia = KademliaDiscovery.new(
|
||||
let kademlia = ServiceDiscovery.new(
|
||||
switch,
|
||||
bootstrapNodes = bootstrapNodes,
|
||||
config = KadDHTConfig.new(
|
||||
validator = kad_types.ExtEntryValidator(), selector = kad_types.ExtEntrySelector()
|
||||
),
|
||||
config =
|
||||
KadDHTConfig.new(validator = ExtEntryValidator(), selector = ExtEntrySelector()),
|
||||
services = providedServices,
|
||||
xprPublishing = xprPublishing,
|
||||
)
|
||||
|
||||
@ -16,7 +16,8 @@ import
|
||||
libp2p/nameresolving/nameresolver,
|
||||
libp2p/builders,
|
||||
libp2p/switch,
|
||||
libp2p/transports/[transport, tcptransport, wstransport]
|
||||
libp2p/transports/[transport, tcptransport, wstransport],
|
||||
libp2p/peeraddrpolicy
|
||||
|
||||
# override nim-libp2p default value (which is also 1)
|
||||
const MaxConnectionsPerPeer* = 1
|
||||
@ -100,6 +101,7 @@ proc newWakuSwitch*(
|
||||
.withSignedPeerRecord(sendSignedPeerRecord)
|
||||
.withCircuitRelay(circuitRelay)
|
||||
.withServices(@[hpService])
|
||||
.withAddressPolicy(noPrivateAddressPolicy)
|
||||
|
||||
if peerStoreCapacity.isSome():
|
||||
b = b.withPeerStore(peerStoreCapacity.get())
|
||||
|
||||
@ -99,11 +99,7 @@ proc new*(
|
||||
wakuKademlia: wakuKademlia,
|
||||
)
|
||||
|
||||
procCall MixProtocol(mix).init(
|
||||
localMixNodeInfo,
|
||||
switch,
|
||||
delayStrategy = ExponentialDelayStrategy.new(rng = crypto.newRng()),
|
||||
)
|
||||
procCall MixProtocol(mix).init(localMixNodeInfo, switch)
|
||||
|
||||
return ok(mix)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user