Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: require external confirmation of public addresses #2867

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
159 changes: 0 additions & 159 deletions packages/integration-tests/test/addresses.spec.ts

This file was deleted.

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

/**
achingbrain marked this conversation as resolved.
Show resolved Hide resolved
* 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
achingbrain marked this conversation as resolved.
Show resolved Hide resolved
*/
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
Loading