pub struct SocksChain {
pub index: usize,
pub links: Vec<ProxyAddress>,
}
Expand description
The SocksChain
struct is used for managing a chain of SOCKS proxy addresses.
Fields§
§index: usize
The current index within the links vector.
links: Vec<ProxyAddress>
A vector containing the chain of proxy addresses.
Implementations§
Source§impl SocksChain
impl SocksChain
Sourcepub fn new(index: usize, links: Vec<ProxyAddress>) -> Self
pub fn new(index: usize, links: Vec<ProxyAddress>) -> Self
Creates a new SocksChain
with a given index and list of proxy addresses.
Sourcepub fn current_link(&self) -> &ProxyAddress
pub fn current_link(&self) -> &ProxyAddress
Returns a reference to the current ProxyAddress
based on the index.
Panics if index is out of bounds.
Sourcepub fn has_next(&self) -> bool
pub fn has_next(&self) -> bool
Checks if there is a next ProxyAddress
in the chain.
Returns true
if a next link exists, false
otherwise.
Sourcepub fn next_link(&mut self) -> Option<&ProxyAddress>
pub fn next_link(&mut self) -> Option<&ProxyAddress>
Advances to the next ProxyAddress
in the chain.
Returns an Option
containing a reference to the next ProxyAddress
, if it exists.
Sourcepub fn detour(&mut self, links: &[ProxyAddress])
pub fn detour(&mut self, links: &[ProxyAddress])
Inserts additional ProxyAddress
es into the chain at the current position.
If the chain is empty, appends the root and then the new links.
Sourcepub fn as_options(&self) -> Vec<SocksOption>
pub fn as_options(&self) -> Vec<SocksOption>
Converts the SocksChain
into a vector of SocksOption
s.
Adds metadata options to indicate the current index and total length of the chain.
Trait Implementations§
Source§impl Clone for SocksChain
impl Clone for SocksChain
Source§fn clone(&self) -> SocksChain
fn clone(&self) -> SocksChain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more