INNER CODE UNIT · Rust
parse_outproxy
eepnet/emissary · emissary-cli/src/proxy/http/mod.rs:142
fn parse_outproxy(
outproxy: &str,
address_book_handle: &Option<Arc<dyn AddressBook>>,
) -> Option<OutproxyKind> {
let host = outproxy.strip_prefix("http://").unwrap_or(outproxy);
let host = host.strip_prefix("www.").unwrap_or(host);
// split `outproxy` into host and port (if specified)
let (host, maybe_port) = {
let mut parts = host.split(":");
let Some(host) = parts.next() else {
tracing::warn!(
target: LOG_TARGET,
%outproxy,
"not a valid outproxy url",
);
return None;