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

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

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)

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(PublicKey, InetAddrOption<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(PublicKey, IpAddrOption<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)

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

URL Scheme

lnp:

ZmqIpc(StringZmqType)

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)

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(PublicKey, ZmqTypeIpAddrOption<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>)

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(PublicKey, InetAddrOption<u16>)

URL Scheme

lnph://@|[:]

Text(PublicKey)

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

impl PartialNodeAddr[src]

pub fn with_port(&self, port: u16) -> Self[src]

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.

pub fn components(
    &self
) -> (Option<PublicKey>, Option<InetAddr>, Option<u16>, Option<String>, Option<ZmqType>)
[src]

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. [zmqsocket::ApiType] parameter for ZMQ based locators

pub fn node_id(&self) -> Option<PublicKey>[src]

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

pub fn inet_addr(&self) -> Option<InetAddr>[src]

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

pub fn port(&self) -> Option<u16>[src]

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

pub fn socket_name(&self) -> Option<String>[src]

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

pub fn api_type(&self) -> Option<ZmqType>[src]

Returns [zmqsocket::ApiType] for the given locator, if any, or Option::None otherwise

Trait Implementations

impl Clone for PartialNodeAddr[src]

impl Debug for PartialNodeAddr[src]

impl Display for PartialNodeAddr[src]

impl Eq for PartialNodeAddr[src]

impl From<PartialNodeAddr> for NodeAddr[src]

impl From<RemoteNodeAddr> for PartialNodeAddr[src]

impl FromStr for PartialNodeAddr[src]

type Err = AddrError

The associated error which can be returned from parsing.

impl Hash for PartialNodeAddr[src]

impl PartialEq<PartialNodeAddr> for PartialNodeAddr[src]

impl StructuralEq for PartialNodeAddr[src]

impl StructuralPartialEq for PartialNodeAddr[src]

impl ToNodeAddr for PartialNodeAddr[src]

impl ToRemoteNodeAddr for PartialNodeAddr[src]

impl TryFrom<PartialNodeAddr> for LocalSocketAddr[src]

type Error = AddrError

The type returned in the event of a conversion error.

impl TryFrom<PartialNodeAddr> for RemoteNodeAddr[src]

type Error = AddrError

The type returned in the event of a conversion error.

impl TryFrom<PartialNodeAddr> for ZmqSocketAddr[src]

type Error = AddrError

The type returned in the event of a conversion error.

impl TryFrom<Url> for PartialNodeAddr[src]

type Error = AddrError

The type returned in the event of a conversion error.

impl UrlString for PartialNodeAddr[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,