[−][src]Enum internet2::session::node_addr::PartialNodeAddr
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)
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://
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)
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:
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).
SHOULD be used only for DMZ area connections; otherwise
PartialNodeAddr::Native
or [PartialNodeAddr::Websocket
]
connection MUST be used
URL Scheme
lnpz://
SHOULD be used only for DMZ area connections; otherwise
PartialNodeAddr::Native
or [PartialNodeAddr::Websocket
]
connection MUST be used
URL Schema
lnpz://
URL Scheme
lnph://
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]
&self
) -> (Option<PublicKey>, Option<InetAddr>, Option<u16>, Option<String>, Option<ZmqType>)
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
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]
pub fn clone(&self) -> PartialNodeAddr
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PartialNodeAddr
[src]
impl Display for PartialNodeAddr
[src]
impl Eq for PartialNodeAddr
[src]
impl From<PartialNodeAddr> for NodeAddr
[src]
pub fn from(locator: PartialNodeAddr) -> Self
[src]
impl From<RemoteNodeAddr> for PartialNodeAddr
[src]
pub fn from(node_addr: RemoteNodeAddr) -> PartialNodeAddr
[src]
impl FromStr for PartialNodeAddr
[src]
type Err = AddrError
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for PartialNodeAddr
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<PartialNodeAddr> for PartialNodeAddr
[src]
pub fn eq(&self, other: &PartialNodeAddr) -> bool
[src]
pub fn ne(&self, other: &PartialNodeAddr) -> bool
[src]
impl StructuralEq for PartialNodeAddr
[src]
impl StructuralPartialEq for PartialNodeAddr
[src]
impl ToNodeAddr for PartialNodeAddr
[src]
pub fn to_node_addr(&self, default_port: u16) -> Option<NodeAddr>
[src]
impl ToRemoteNodeAddr for PartialNodeAddr
[src]
pub fn to_remote_node_addr(&self, default_port: u16) -> Option<RemoteNodeAddr>
[src]
impl TryFrom<PartialNodeAddr> for LocalSocketAddr
[src]
type Error = AddrError
The type returned in the event of a conversion error.
pub fn try_from(value: PartialNodeAddr) -> Result<Self, Self::Error>
[src]
impl TryFrom<PartialNodeAddr> for RemoteNodeAddr
[src]
type Error = AddrError
The type returned in the event of a conversion error.
pub fn try_from(locator: PartialNodeAddr) -> Result<Self, Self::Error>
[src]
impl TryFrom<PartialNodeAddr> for ZmqSocketAddr
[src]
type Error = AddrError
The type returned in the event of a conversion error.
pub fn try_from(socket_addr: PartialNodeAddr) -> Result<Self, Self::Error>
[src]
impl TryFrom<Url> for PartialNodeAddr
[src]
type Error = AddrError
The type returned in the event of a conversion error.
pub fn try_from(url: Url) -> Result<Self, Self::Error>
[src]
impl UrlString for PartialNodeAddr
[src]
pub fn url_scheme(&self) -> &'static str
[src]
pub fn to_url_string(&self) -> String
[src]
Auto Trait Implementations
impl RefUnwindSafe for PartialNodeAddr
[src]
impl Send for PartialNodeAddr
[src]
impl Sync for PartialNodeAddr
[src]
impl Unpin for PartialNodeAddr
[src]
impl UnwindSafe for PartialNodeAddr
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,