MCPcopy Create free account
hub / github.com/Recordscript/recordscript / new_proxy

Method new_proxy

libs/hbb_common/src/udp.rs:67–89  ·  view source on GitHub ↗
(
        proxy: P,
        local: T,
        username: &'a str,
        password: &'a str,
        ms_timeout: u64,
    )

Source from the content-addressed store, hash-verified

65 }
66
67 pub async fn new_proxy<'a, 't, P: ToProxyAddrs, T: ToSocketAddrs>(
68 proxy: P,
69 local: T,
70 username: &'a str,
71 password: &'a str,
72 ms_timeout: u64,
73 ) -> ResultType<Self> {
74 let framed = if username.trim().is_empty() {
75 super::timeout(ms_timeout, Socks5UdpFramed::connect(proxy, Some(local))).await??
76 } else {
77 super::timeout(
78 ms_timeout,
79 Socks5UdpFramed::connect_with_password(proxy, Some(local), username, password),
80 )
81 .await??
82 };
83 log::trace!(
84 "Socks5 udp connected, local addr: {:?}, target addr: {}",
85 framed.local_addr(),
86 framed.socks_addr()
87 );
88 Ok(Self::ProxySocks(framed))
89 }
90
91 #[inline]
92 pub async fn send(

Callers

nothing calls this directly

Calls 2

timeoutFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected