Enum internet2::session::node_addr::PartialNodeAddr [−][src]
#[non_exhaustive]
pub enum PartialNodeAddr {
Native(PublicKey, InetAddr, Option<u16>),
Udp(PublicKey, IpAddr, Option<u16>),
Posix(String),
ZmqIpc(String, ZmqType),
ZmqInproc(String, ZmqType),
ZmqTcpEncrypted(PublicKey, ZmqType, IpAddr, Option<u16>),
ZmqTcpUnencrypted(ZmqType, IpAddr, Option<u16>),
Http(PublicKey, InetAddr, Option<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
Native(PublicKey, InetAddr, 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(PublicKey, IpAddr, 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
ZmqIpc(String, ZmqType)
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:
ZmqInproc(String, ZmqType)
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, ZmqType, IpAddr, Option<u16>)
SHOULD be used only for DMZ area connections; otherwise
PartialNodeAddr::Native
or [PartialNodeAddr::Websocket
]
connection MUST be used
URL Scheme
lnpz://
ZmqTcpUnencrypted(ZmqType, IpAddr, Option<u16>)
SHOULD be used only for DMZ area connections; otherwise
PartialNodeAddr::Native
or [PartialNodeAddr::Websocket
]
connection MUST be used
URL Schema
lnpz://
Http(PublicKey, InetAddr, Option<u16>)
URL Scheme
lnph://
Text(PublicKey)
Tuple Fields
0: 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
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:
- node public key,
InetAddr
of the node,- port
- file path or POSIX socket name
- [
zmqsocket::ApiType
] 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 [zmqsocket::ApiType
] for the given locator, if any, or
Option::None
otherwise
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
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
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
impl RefUnwindSafe for PartialNodeAddr
impl Send for PartialNodeAddr
impl Sync for PartialNodeAddr
impl Unpin for PartialNodeAddr
impl UnwindSafe for PartialNodeAddr
Blanket Implementations
Mutably borrows from an owned value. Read more