Enum internet2::session::node_addr::PartialNodeAddr[][src]

#[non_exhaustive]
pub enum PartialNodeAddr {
    Native(PublicKeyInetAddrOption<u16>),
    Udp(PublicKeyIpAddrOption<u16>),
    Posix(String),
    ZmqIpc(StringZmqType),
    ZmqInproc(StringZmqType),
    ZmqTcpEncrypted(PublicKeyZmqTypeIpAddrOption<u16>),
    ZmqTcpUnencrypted(ZmqTypeIpAddrOption<u16>),
    Http(PublicKeyInetAddrOption<u16>),
    Text(PublicKey),
}
Expand description

Universal Node Locator for LNP protocol (from LNPBP-19)

Type is used for visual node and specific protocol representation or parsing It is different from NodeAddr by the fact that it may not contain port information for LNP-based protocols having known default port, while NodeAddr must always contain complete information with the explicit porn number. To convert PartialNodeAddr to NodeAddr use ToNodeAddr trait.

NB: DNS addressing is not used since it is considered insecure in terms of censorship resistance.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Native(PublicKeyInetAddrOption<u16>)

Tuple Fields

2: Option<u16>

Native Lightning network connection: uses end-to-end encryption and runs on top of either TCP socket (which may be backed by Tor connection)

URL Scheme

lnp://@|:

Udp(PublicKeyIpAddrOption<u16>)

Tuple Fields

1: IpAddr
2: Option<u16>

NB: Unfinished!

UDP-based connection that uses UDP packets instead of TCP. Can’t work with Tor, but may use UDP hole punching in a secure way, since the connection is still required to be encrypted.

URL Scheme

lnpu://@:

Posix(String)

Tuple Fields

0: String

Connection through POSIX (UNIX-type) socket. Does not use encryption.

URL Scheme

lnp:

ZmqIpc(StringZmqType)

Tuple Fields

0: String

Local (for inter-process communication based on POSIX sockets) connection without encryption. Relies on ZMQ IPC sockets internally; specific socket pair for ZMQ is provided via query parameter

URL Schema

lnpz:?api=<p2p|rpc|sub>

ZmqInproc(StringZmqType)

Tuple Fields

0: String

LNP protocol supports in-process communications (between threads of the same process using Mutex’es and other sync managing routines) without encryption. It relies on ZMQ IPC sockets internally. However, such connection can be done only withing the same process, and can’t be represented in the form of URL: it requires presence of ZMQ context object, which can’t be encoded as a string (context object is taken from a global variable).

ZmqTcpEncrypted(PublicKeyZmqTypeIpAddrOption<u16>)

Tuple Fields

2: IpAddr
3: Option<u16>

SHOULD be used only for DMZ area connections; otherwise PartialNodeAddr::Native or [PartialNodeAddr::Websocket] connection MUST be used

URL Scheme

lnpz://@[:]/?api=<p2p|rpc|sub>

ZmqTcpUnencrypted(ZmqTypeIpAddrOption<u16>)

Tuple Fields

1: IpAddr
2: Option<u16>

SHOULD be used only for DMZ area connections; otherwise PartialNodeAddr::Native or [PartialNodeAddr::Websocket] connection MUST be used

URL Schema

lnpz://[:]/?api=<p2p|rpc|sub>

Http(PublicKeyInetAddrOption<u16>)

Tuple Fields

2: Option<u16>

URL Scheme

lnph://@|[:]

Text(PublicKey)

Tuple Fields

Text (Bech32-based) connection for high latency or non-interactive protocols. Can work with SMPT, for mesh and satellite networks – or with other mediums of communications (chat messages, QR codes etc).

URL Scheme

lnpt://@

Implementations

Adds port information to the node locator, if it can contain port. In case if it does not, performs no action. Returns cloned Self with the updated data.

Parses PartialNodeAddr into it’s optional components, returned as a single tuple of optionals:

  1. node public key,
  2. InetAddr of the node,
  3. port
  4. file path or POSIX socket name
  5. ZmqType parameter for ZMQ based locators

Returns node id for the given locator, if any, or Option::None otherwise

Returns InetAddr for the given locator, if any, or Option::None otherwise

Returns port number for the given locator, if any, or Option::None otherwise

Returns socket name if for the given locator, if any, or Option::None otherwise

Returns ZmqType for the given locator, if any, or Option::None otherwise

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Constructs NodeAddr from an internal data with a default port put in place when the port details were not given is such structures as PartialNodeAddr Read more

Constructs RemoteNodeAddr from an internal data with a default port put in place when the port details were not given is such structures as PartialNodeAddr Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Returns full URL scheme string (i.e. including : or :// parts) corresponding to the provided address Read more

Returns URL string representation for a given node or socket address. If you need full URL address, please use Url::from() instead (this will require url feature for LNP/BP Core Library). Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.