[][src]Enum lnpbp::lnp::NodeLocator

pub enum NodeLocator {
    Native(PublicKey, InetAddrOption<u16>),
    Udp(PublicKey, IpAddrOption<u16>),
    Ipc(PathBufZmqType),
    Inproc(StringContextZmqType),
    ZmqEncrypted(PublicKey, ZmqTypeIpAddrOption<u16>),
    ZmqUnencrypted(ZmqTypeIpAddrOption<u16>),
    Text(PublicKey),
}

Universal Node Locator for LNP protocol (from LNPBP-19) NB: DNS addressing is not used since it is considered insecure in terms of censorship resistance.

Variants

Native(PublicKey, InetAddrOption<u16>)

Native Lightning network connection: uses end-to-end encryption and runs on top of either TCP or Tor socket

URL Scheme

lnp://@|:

Udp(PublicKey, IpAddrOption<u16>)

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://@:

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>

Inproc(StringContextZmqType)

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.

ZmqEncrypted(PublicKey, ZmqTypeIpAddrOption<u16>)

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

URL Schema

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

ZmqUnencrypted(ZmqTypeIpAddrOption<u16>)

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

URL Schema

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

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 Schema

lnpt://@

Implementations

impl NodeLocator[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 scheme(&self) -> String[src]

Returns URL schema name for the given node locator type

pub fn to_url_string(&self) -> String[src]

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

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

Parses NodeLocator 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

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 ZmqType for the given locator, if any, or Option::None otherwise

Trait Implementations

impl Clone for NodeLocator[src]

impl Debug for NodeLocator[src]

impl Display for NodeLocator[src]

impl Eq for NodeLocator[src]

impl<'_> From<&'_ NodeLocator> for Url[src]

impl From<NodeAddr> for NodeLocator[src]

impl FromStr for NodeLocator[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for NodeLocator[src]

impl PartialEq<NodeLocator> for NodeLocator[src]

impl TryFrom<NodeLocator> for NodeAddr[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Url> for NodeLocator[src]

type Error = ParseError

The type returned in the event of a conversion error.

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>,