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

Method into_proxy_scheme

libs/hbb_common/src/proxy.rs:278–296  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

276
277impl<S: IntoUrl> IntoProxyScheme for S {
278 fn into_proxy_scheme(self) -> Result<ProxyScheme, ProxyError> {
279 // validate the URL
280 let url = match self.as_str().into_url() {
281 Ok(ok) => ok,
282 Err(e) => {
283 match e {
284 // If the string does not contain protocol headers, try to parse it using the socks5 protocol
285 ProxyError::UrlParseScheme(_source) => {
286 let try_this = format!("socks5://{}", self.as_str());
287 try_this.into_url()?
288 }
289 _ => {
290 return Err(e);
291 }
292 }
293 }
294 };
295 ProxyScheme::parse(url)
296 }
297}
298
299impl IntoProxyScheme for ProxyScheme {

Callers 1

newMethod · 0.80

Calls 2

into_urlMethod · 0.80
as_strMethod · 0.80

Tested by

no test coverage detected