pub struct OutboundConnector { /* private fields */ }Expand description
A native outbound connector that executes the chain engine directly.
This compiles routing/upstream state from a TOML config and provides methods to open TCP connections through the configured proxy chain without starting a listener service.
Implementations§
Source§impl OutboundConnector
impl OutboundConnector
Sourcepub fn from_toml(config_toml: &str) -> Result<Self, EggressError>
pub fn from_toml(config_toml: &str) -> Result<Self, EggressError>
Create a connector from a TOML config string.
Sourcepub fn from_pproxy_uri(uri: &str) -> Result<Self, EggressError>
pub fn from_pproxy_uri(uri: &str) -> Result<Self, EggressError>
Create a connector from a pproxy-style URI (e.g., “socks5://127.0.0.1:1080”).
Sourcepub async fn connect_tcp(
&self,
host: &str,
port: u16,
) -> Result<(BoxStream, OutboundInfo), EggressError>
pub async fn connect_tcp( &self, host: &str, port: u16, ) -> Result<(BoxStream, OutboundInfo), EggressError>
Connect to a target host:port through the configured proxy chain.
Returns the connected stream and connection metadata.
Sourcepub async fn connect_tcp_timeout(
&self,
host: &str,
port: u16,
timeout: Duration,
) -> Result<(BoxStream, OutboundInfo), EggressError>
pub async fn connect_tcp_timeout( &self, host: &str, port: u16, timeout: Duration, ) -> Result<(BoxStream, OutboundInfo), EggressError>
Connect with a timeout.
Sourcepub async fn associate_udp(
&self,
_target_host: &str,
_target_port: u16,
) -> Result<UdpAssociation, EggressError>
pub async fn associate_udp( &self, _target_host: &str, _target_port: u16, ) -> Result<UdpAssociation, EggressError>
Create a UDP association through the configured proxy chain.
Returns a UdpAssociation with the relay address to send/receive
UDP datagrams through the proxy chain.
UDP association requires SOCKS5 with UDP ASSOCIATE support. This method establishes the association and returns channel endpoints.
Sourcepub fn upstream_count(&self) -> usize
pub fn upstream_count(&self) -> usize
Get the number of upstreams configured.
Sourcepub fn validate_outbound_config(
config_toml: &str,
) -> Result<usize, EggressError>
pub fn validate_outbound_config( config_toml: &str, ) -> Result<usize, EggressError>
Validate that the config is usable for outbound connections.
Returns the number of hops in the first upstream’s chain.