Expose DHT addresses

This commit is contained in:
Arnaud 2026-06-05 19:33:21 +04:00
parent e9d6c5c0b9
commit aa28578ca7
No known key found for this signature in database
GPG Key ID: A6C7C781817146FA
4 changed files with 9 additions and 4 deletions

View File

@ -61,6 +61,7 @@ proc getDebug(
"addrs": node.switch.peerInfo.addrs.mapIt($it),
"spr": nodeSpr.toURI,
"announceAddresses": node.discovery.announceAddrs,
"dhtAddresses": node.discovery.dhtAddrs,
"table": table,
"nat": {
"reachability": reachabilityStr(storage[].autonatService),

View File

@ -106,6 +106,7 @@ components:
- repo
- spr
- announceAddresses
- dhtAddresses
- table
- storage
properties:
@ -124,6 +125,10 @@ components:
type: array
items:
$ref: "#/components/schemas/MultiAddress"
dhtAddresses:
type: array
items:
$ref: "#/components/schemas/MultiAddress"
table:
$ref: "#/components/schemas/PeersTable"
storage:

View File

@ -43,7 +43,7 @@ type Discovery* = ref object of RootObj
providerRecord*: ?SignedPeerRecord
# record to advertice node connection information, this carry any
# address that the node can be connected on
dhtRecord*: ?SignedPeerRecord # record to advertice DHT connection information
dhtAddrs*: seq[MultiAddress] # UDP discovery addresses, exposed for debugging
isStarted: bool
store: Datastore
@ -191,12 +191,10 @@ proc announceDirectAddrs*(
info "Updating announce and DHT records", tcpAddrs, udpAddrs
d.announceAddrs = tcpAddrs
d.dhtAddrs = udpAddrs
d.providerRecord = SignedPeerRecord
.init(d.key, PeerRecord.init(d.peerId, tcpAddrs))
.expect("Should construct signed record").some
d.dhtRecord = SignedPeerRecord
.init(d.key, PeerRecord.init(d.peerId, udpAddrs))
.expect("Should construct signed record").some
if not d.protocol.isNil:
let spr = SignedPeerRecord

View File

@ -585,6 +585,7 @@ proc initDebugApi(
"repo": $conf.dataDir,
"spr": nodeSpr.toURI,
"announceAddresses": node.discovery.announceAddrs,
"dhtAddresses": node.discovery.dhtAddrs,
"table": table,
"storage": {"version": $storageVersion, "revision": $storageRevision},
"nat": {