Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/libp2p/src/address-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,8 @@ export class AddressManager implements AddressManagerInterface {
_updatePeerStoreAddresses (): void {
// if announce addresses have been configured, ensure they make it into our peer
// record for things like identify
const addrs = this.getAnnounceAddrs()
.concat(this.components.transportManager.getAddrs())
.concat(
[...this.observed.entries()]
.filter(([_, metadata]) => metadata.confident)
.map(([str]) => multiaddr(str))
).map(ma => {
const addrs = this.getAddresses()
.map(ma => {
// strip our peer id if it is present
if (ma.getPeerId() === this.components.peerId.toString()) {
return ma.decapsulate(`/p2p/${this.components.peerId.toString()}`)
Expand Down Expand Up @@ -369,6 +364,7 @@ export class AddressManager implements AddressManagerInterface {
this.log('add DNS mapping %s to %s', ip, domain)
this.ipDomainMappings.set(ip, domain)
})
this._updatePeerStoreAddresses()
}

removeDNSMapping (domain: string): void {
Expand All @@ -378,6 +374,7 @@ export class AddressManager implements AddressManagerInterface {
this.ipDomainMappings.delete(key)
}
}
this._updatePeerStoreAddresses()
}

addPublicAddressMapping (internalIp: string, internalPort: number, externalIp: string, externalPort: number = internalPort, protocol: 'tcp' | 'udp' = 'tcp'): void {
Expand All @@ -389,6 +386,7 @@ export class AddressManager implements AddressManagerInterface {
})

this.publicAddressMappings.set(key, mappings)
this._updatePeerStoreAddresses()
}

removePublicAddressMapping (internalIp: string, internalPort: number, externalIp: string, externalPort: number = internalPort, protocol: 'tcp' | 'udp' = 'tcp'): void {
Expand All @@ -402,5 +400,7 @@ export class AddressManager implements AddressManagerInterface {
} else {
this.publicAddressMappings.set(key, mappings)
}

this._updatePeerStoreAddresses()
}
}
Loading