pub struct SocketAddrV6(pub SocketAddrV6);
Expand description
Utility struct of SocketAddrV6 for hole punching
Tuple Fields§
§0: SocketAddrV6
Methods from Deref<Target = SocketAddrV6>§
1.0.0 · Sourcepub fn ip(&self) -> &Ipv6Addr
pub fn ip(&self) -> &Ipv6Addr
Returns the IP address associated with this socket address.
§Examples
use std::net::{SocketAddrV6, Ipv6Addr};
let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
assert_eq!(socket.ip(), &Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
1.0.0 · Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the port number associated with this socket address.
§Examples
use std::net::{SocketAddrV6, Ipv6Addr};
let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
assert_eq!(socket.port(), 8080);
1.0.0 · Sourcepub fn flowinfo(&self) -> u32
pub fn flowinfo(&self) -> u32
Returns the flow information associated with this address.
This information corresponds to the sin6_flowinfo
field in C’s netinet/in.h
,
as specified in IETF RFC 2553, Section 3.3.
It combines information about the flow label and the traffic class as specified
in IETF RFC 2460, respectively Section 6 and Section 7.
§Examples
use std::net::{SocketAddrV6, Ipv6Addr};
let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 10, 0);
assert_eq!(socket.flowinfo(), 10);
1.0.0 · Sourcepub fn scope_id(&self) -> u32
pub fn scope_id(&self) -> u32
Returns the scope ID associated with this address.
This information corresponds to the sin6_scope_id
field in C’s netinet/in.h
,
as specified in IETF RFC 2553, Section 3.3.
§Examples
use std::net::{SocketAddrV6, Ipv6Addr};
let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 78);
assert_eq!(socket.scope_id(), 78);
Trait Implementations§
Source§impl Clone for SocketAddrV6
impl Clone for SocketAddrV6
Source§fn clone(&self) -> SocketAddrV6
fn clone(&self) -> SocketAddrV6
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SocketAddrV6
impl Debug for SocketAddrV6
Source§impl Decodable for SocketAddrV6
impl Decodable for SocketAddrV6
Source§impl Deref for SocketAddrV6
impl Deref for SocketAddrV6
Source§type Target = SocketAddrV6
type Target = SocketAddrV6
The resulting type after dereferencing.
Source§fn deref(&self) -> &SocketAddrV6
fn deref(&self) -> &SocketAddrV6
Dereferences the value.
Source§impl Encodable for SocketAddrV6
impl Encodable for SocketAddrV6
Source§impl Hash for SocketAddrV6
impl Hash for SocketAddrV6
Source§impl PartialEq for SocketAddrV6
impl PartialEq for SocketAddrV6
impl Copy for SocketAddrV6
impl Eq for SocketAddrV6
impl StructuralPartialEq for SocketAddrV6
Auto Trait Implementations§
impl Freeze for SocketAddrV6
impl RefUnwindSafe for SocketAddrV6
impl Send for SocketAddrV6
impl Sync for SocketAddrV6
impl Unpin for SocketAddrV6
impl UnwindSafe for SocketAddrV6
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more