Skip to content

Commit

Permalink
fix: require external confirmation of public addresses
Browse files Browse the repository at this point in the history
Requires autonat to confirm external IP addresses and domain names
before the node will announce them.
  • Loading branch information
achingbrain committed Nov 30, 2024
1 parent f8da60e commit 8165024
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 101 deletions.
38 changes: 38 additions & 0 deletions packages/interface-internal/src/address-manager/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
import type { Multiaddr } from '@multiformats/multiaddr'

/**
* The type of address:
*
* - 'transport' a listen address supplied by a transport
* - 'announce' a pre-configured announce address
* - 'observed' a peer reported this as a public address
* - 'dns-mapping' a DNS address dynamically mapped to one or more public addresses
* - 'ip-mapping' an external IP address dynamically mapped to a LAN address
*/
export type AddressType = 'transport' | 'announce' | 'observed' | 'dns-mapping' | 'ip-mapping'

/**
* An address that has been configured or detected
*/
export interface NodeAddress {
/**
* The multiaddr that represents the address
*/
multiaddr: Multiaddr

/**
* Whether we are confident that this address is externally routable.
*
* Once confident this address will appear in the output of `getAddresses()`
*/
confident: boolean

/**
* The source of this address
*/
type: AddressType
}

export interface AddressManager {
/**
* Get peer listen multiaddrs
Expand Down Expand Up @@ -41,6 +74,11 @@ export interface AddressManager {
*/
getAddresses(): Multiaddr[]

/**
* Return all addresses we know about with metadata
*/
getAddressesWithMetadata(): NodeAddress[]

/**
* Adds a mapping between one or more IP addresses and a domain name - when
* `getAddresses` is invoked, where the IP addresses are present in a
Expand Down
Loading

0 comments on commit 8165024

Please sign in to comment.