pub struct Socks5Layer {
target_host: String,
target_port: u16,
}Expand description
SOCKS5 proxy layer (RFC 1928). Client-only.
Performs the SOCKS5 handshake on the stream (which is already connected to the proxy) to tunnel through to the target.
§Example
use karyon_net::{tcp, ClientLayer, Endpoint};
use karyon_net::layers::proxy::Socks5Layer;
async {
// Connect to the proxy
let proxy_ep: Endpoint = "tcp://127.0.0.1:1080".parse().unwrap();
let stream = tcp::connect(&proxy_ep, Default::default()).await.unwrap();
// Tunnel to target via SOCKS5
let layer = Socks5Layer::new("example.com", 443);
let tunneled = ClientLayer::handshake(&layer, stream).await.unwrap();
};Fields§
§target_host: String§target_port: u16Implementations§
Trait Implementations§
Source§impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for Socks5Layer
impl ClientLayer<Box<dyn ByteStream>, Box<dyn ByteStream>> for Socks5Layer
async fn handshake( &self, stream: Box<dyn ByteStream>, ) -> Result<Box<dyn ByteStream>>
Source§impl Clone for Socks5Layer
impl Clone for Socks5Layer
Source§fn clone(&self) -> Socks5Layer
fn clone(&self) -> Socks5Layer
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for Socks5Layer
impl RefUnwindSafe for Socks5Layer
impl Send for Socks5Layer
impl Sync for Socks5Layer
impl Unpin for Socks5Layer
impl UnsafeUnpin for Socks5Layer
impl UnwindSafe for Socks5Layer
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