pub struct DirPort {
pub address: IpAddr,
pub port: u16,
}Expand description
A directory port endpoint for downloading descriptors.
Directory ports (DirPorts) are HTTP endpoints where Tor relays and authorities serve directory information. This struct represents the address and port of such an endpoint.
§Example
use stem_rs::descriptor::remote::DirPort;
use std::net::IpAddr;
let addr: IpAddr = "128.31.0.39".parse().unwrap();
let dirport = DirPort::new(addr, 9131);
println!("Connecting to {}", dirport.socket_addr());Fields§
§address: IpAddrIP address of the directory server.
Can be either IPv4 or IPv6.
port: u16Port number for the directory service.
Common values are 80, 443, or 9030.
Implementations§
Source§impl DirPort
impl DirPort
Sourcepub fn new(address: IpAddr, port: u16) -> Self
pub fn new(address: IpAddr, port: u16) -> Self
Creates a new directory port endpoint.
§Arguments
address- IP address of the directory serverport- Port number for the directory service
§Example
use stem_rs::descriptor::remote::DirPort;
use std::net::IpAddr;
let addr: IpAddr = "127.0.0.1".parse().unwrap();
let dirport = DirPort::new(addr, 9030);Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
Returns the socket address for this endpoint.
Combines the IP address and port into a SocketAddr suitable
for use with network operations.
§Returns
A SocketAddr combining the address and port.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DirPort
impl RefUnwindSafe for DirPort
impl Send for DirPort
impl Sync for DirPort
impl Unpin for DirPort
impl UnwindSafe for DirPort
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