Debug/info shows announce addresses (#610)

* Shows announce addresses in debug/info endpoint.

* Shows announce addresses in debug/info endpoint.
This commit is contained in:
Ben Bierens 2023-11-12 09:58:40 +01:00 committed by GitHub
parent cb02962231
commit 80e2ef4eb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,7 @@ type
protocol*: discv5.Protocol # dht protocol protocol*: discv5.Protocol # dht protocol
key: PrivateKey # private key key: PrivateKey # private key
peerId: PeerId # the peer id of the local node peerId: PeerId # the peer id of the local node
announceAddrs: seq[MultiAddress] # addresses announced as part of the provider records announceAddrs*: seq[MultiAddress] # addresses announced as part of the provider records
providerRecord*: ?SignedPeerRecord # record to advertice node connection information, this carry any providerRecord*: ?SignedPeerRecord # record to advertice node connection information, this carry any
# address that the node can be connected on # address that the node can be connected on
dhtRecord*: ?SignedPeerRecord # record to advertice DHT connection information dhtRecord*: ?SignedPeerRecord # record to advertice DHT connection information
@ -74,7 +74,7 @@ method find*(
cid: Cid cid: Cid
): Future[seq[SignedPeerRecord]] {.async, base.} = ): Future[seq[SignedPeerRecord]] {.async, base.} =
## Find block providers ## Find block providers
## ##
trace "Finding providers for block", cid trace "Finding providers for block", cid
without providers =? without providers =?
@ -187,8 +187,8 @@ proc new*(
bootstrapNodes: openArray[SignedPeerRecord] = [], bootstrapNodes: openArray[SignedPeerRecord] = [],
store: Datastore = SQLiteDatastore.new(Memory).expect("Should not fail!") store: Datastore = SQLiteDatastore.new(Memory).expect("Should not fail!")
): Discovery = ): Discovery =
## Create a new Discovery node instance for the given key and datastore ## Create a new Discovery node instance for the given key and datastore
## ##
var var
self = Discovery( self = Discovery(

View File

@ -298,6 +298,7 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) =
node.discovery.dhtRecord.get.toURI node.discovery.dhtRecord.get.toURI
else: else:
"", "",
"announceAddresses": node.discovery.announceAddrs,
"table": table, "table": table,
"codex": { "codex": {
"version": $codexVersion, "version": $codexVersion,

View File

@ -108,3 +108,6 @@ func `%`*(obj: dn.Address): JsonNode =
func `%`*(obj: AddressInfo): JsonNode = func `%`*(obj: AddressInfo): JsonNode =
% $obj.address % $obj.address
func `%`*(obj: MultiAddress): JsonNode =
% $obj