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

Method resolve_host

libs/hbb_common/src/proxy.rs:230–240  ·  view source on GitHub ↗
(&self, host: &str, default_port: u16)

Source from the content-addressed store, hash-verified

228 }
229
230 async fn resolve_host(&self, host: &str, default_port: u16) -> Result<SocketAddr, ProxyError> {
231 let (host_str, port) = match host.split_once(':') {
232 Some((h, p)) => (h, p.parse::<u16>().ok()),
233 None => (host, None),
234 };
235 let addr = (host_str, port.unwrap_or(default_port))
236 .to_socket_addrs()?
237 .next()
238 .ok_or_else(|| ProxyError::AddressResolutionFailed(host.to_string()))?;
239 Ok(addr)
240 }
241
242 pub fn get_domain(&self) -> Result<String, ProxyError> {
243 match self {

Callers 1

socket_addrsMethod · 0.80

Calls 2

to_stringMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected