pub struct Service {
    pub base: NetAddr,
    pub port: u16,
}
Expand description

| A combination of a network address (CNetAddr) | and a (TCP) port |

Fields§

§base: NetAddr§port: u16

| host order |

Implementations§

source§

impl Service

source

pub fn is_relayable(&self) -> bool

source

pub fn serialize<Stream>(&self, s: &mut Stream)

source

pub fn unserialize<Stream>(&mut self, s: &mut Stream)

source

pub fn serialize_v1array(&self, arr: &mut [u8; 16])

source

pub fn serialize_v1stream<Stream>(&self, s: &mut Stream)

source

pub fn serialize_v2stream<Stream>(&self, s: &mut Stream)

source

pub fn unserialize_v1array(&mut self, arr: &mut [u8; 16])

source

pub fn unserialize_v1stream<Stream>(&mut self, s: &mut Stream)

source

pub fn unserialize_v2stream<Stream>(&mut self, s: &mut Stream)

source

pub fn get_bip155network(&self) -> BIP155Network

source

pub fn set_net_from_bip155network( &mut self, possible_bip155_net: u8, address_size: usize ) -> bool

source

pub fn setip(&mut self, ip_in: &NetAddr)

source

pub fn set_legacy_ipv6(&mut self, ipv6: &[u8])

source

pub fn set_internal(&mut self, name: &str) -> bool

source

pub fn set_special(&mut self, addr: &String) -> bool

source

pub fn set_tor(&mut self, addr: &String) -> bool

source

pub fn seti2p(&mut self, addr: &String) -> bool

source

pub fn is_bind_any(&self) -> bool

source

pub fn is_ipv4(&self) -> bool

source

pub fn is_ipv6(&self) -> bool

source

pub fn isrfc1918(&self) -> bool

source

pub fn isrfc2544(&self) -> bool

source

pub fn isrfc3927(&self) -> bool

source

pub fn isrfc6598(&self) -> bool

source

pub fn isrfc5737(&self) -> bool

source

pub fn isrfc3849(&self) -> bool

source

pub fn isrfc3964(&self) -> bool

source

pub fn isrfc6052(&self) -> bool

source

pub fn isrfc4380(&self) -> bool

source

pub fn isrfc4862(&self) -> bool

source

pub fn isrfc4193(&self) -> bool

source

pub fn isrfc6145(&self) -> bool

source

pub fn isrfc4843(&self) -> bool

source

pub fn isrfc7343(&self) -> bool

source

pub fn is_he_net(&self) -> bool

source

pub fn is_tor(&self) -> bool

source

pub fn isi2p(&self) -> bool

source

pub fn iscjdns(&self) -> bool

source

pub fn is_local(&self) -> bool

source

pub fn is_valid(&self) -> bool

source

pub fn is_routable(&self) -> bool

source

pub fn is_internal(&self) -> bool

source

pub fn is_addr_v1compatible(&self) -> bool

source

pub fn get_network(&self) -> Network

source

pub fn get_in_addr(&self, pipv_4addr: *mut InAddr) -> bool

source

pub fn get_in_6addr(&self, pipv_6addr: *mut In6Addr) -> bool

source

pub fn has_linked_ipv4(&self) -> bool

source

pub fn get_linked_ipv4(&self) -> u32

source

pub fn get_net_class(&self) -> Network

source

pub fn get_mappedas(&self, asmap: &Vec<bool>) -> u32

source

pub fn get_group(&self, asmap: &Vec<bool>) -> Vec<u8>

source

pub fn get_addr_bytes(&self) -> Vec<u8>

source

pub fn get_hash(&self) -> u64

source

pub fn get_reachability_from(&self, paddr_partner: *const NetAddr) -> i32

source§

impl Service

source

pub fn new_from_net_addr(cip: &NetAddr, port_in: u16) -> Self

source

pub fn new_from_ip4(ipv4_addr: &InAddr, port_in: u16) -> Self

source

pub fn new_from_ip6(ipv6_addr: &In6Addr, port_in: u16) -> Self

source

pub fn set_sock_addr(&mut self, paddr: *const SocketAddr) -> bool

source

pub fn get_port(&self) -> u16

source

pub fn get_sock_addr( &self, paddr: *mut SocketAddr, addrlen: *mut socklen_t ) -> bool

| Obtain the IPv4/6 socket address this | represents. | | ———– | @param[out] paddr | | The obtained socket address. | ––––– | @param[in,out] addrlen | | The size, in bytes, of the address structure | pointed to by paddr. The value that’s | pointed to by this parameter might change | after calling this function if the size | of the corresponding address structure | changed. | | ———– | @return | | Whether or not the operation was successful. |

source

pub fn get_key(&self) -> Vec<u8>

| @return | | An identifier unique to this service’s | address and port number. |

source

pub fn to_string_port(&self) -> String

source

pub fn to_string_ip_port(&self) -> String

source

pub fn to_string(&self) -> String

Trait Implementations§

source§

impl Clone for Service

source§

fn clone(&self) -> Service

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Service

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Service

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Service

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&sockaddr_in> for Service

source§

fn from(addr: &sockaddr_in) -> Self

Converts to this type from the input type.
source§

impl From<&sockaddr_in6> for Service

source§

fn from(addr: &sockaddr_in6) -> Self

Converts to this type from the input type.
source§

impl Hash for Service

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

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

impl Ord for Service

source§

fn cmp(&self, other: &Service) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Service> for Service

source§

fn eq(&self, other: &Service) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Service> for Service

source§

fn partial_cmp(&self, other: &Service) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Service

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Service

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

§

impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,

§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> StaticUpcast<T> for T

§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,