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

Method get_domain

libs/hbb_common/src/proxy.rs:242–256  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

240 }
241
242 pub fn get_domain(&self) -> Result<String, ProxyError> {
243 match self {
244 ProxyScheme::Http { host, .. } | ProxyScheme::Https { host, .. } => {
245 let domain = host
246 .split(':')
247 .next()
248 .ok_or_else(|| ProxyError::AddressResolutionFailed(host.clone()))?;
249 Ok(domain.to_string())
250 }
251 ProxyScheme::Socks5 { addr, .. } => match addr {
252 SocketAddr::V4(addr_v4) => Ok(addr_v4.ip().to_string()),
253 SocketAddr::V6(addr_v6) => Ok(addr_v6.ip().to_string()),
254 },
255 }
256 }
257 pub fn get_host_and_port(&self) -> Result<String, ProxyError> {
258 match self {
259 ProxyScheme::Http { host, .. } => Ok(self.append_default_port(host, 80)),

Callers 1

https_connectMethod · 0.80

Calls 3

to_stringMethod · 0.80
nextMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected