destinations
ModuleWhere a client may connect.
A transport checks its Destinations against the address each
connection actually reached (every connection, every redirect hop), not a
DNS answer taken earlier, so a host name that resolves differently at
connect time cannot get past the check.
Contents
use utopia_client::Anywhere;pub struct AnywhereAny address, through any proxy: for services whose address the operator configured, never for a URL a user supplied. The default.
use utopia_client::IpRange;pub struct IpRangeAn IPv4 or IPv6 address or CIDR range. A single address is its /32 or
/128, so every spelling of an address (::1, 0:0:0:0:0:0:0:1) is the
same range.
use utopia_client::IpRange;
let range = IpRange::new("10.0.0.0/8")?;
assert!(range.contains("10.1.2.3"));
assert!(!range.contains("11.0.0.1"));
assert!(IpRange::new("10.0.0.0/").is_err());use utopia_client::PublicInternet;pub struct PublicInternetGlobally routable addresses only: never a private, loopback, link-local, multicast or otherwise reserved one (cloud metadata, the host, the internal network), unless one of the given ranges admits it. Never through a proxy. For fetching a URL a user supplied.
use utopia_client::{Destinations, IpRange, PublicInternet};
let public = PublicInternet::new([]);
assert!(public.allows("8.8.8.8"));
assert!(!public.allows("169.254.169.254"));
let internal = PublicInternet::new([IpRange::new("10.0.0.0/8")?]);
assert!(internal.allows("10.0.0.7"));Default.use utopia_client::Destinations;pub trait Destinations: Send + Sync + std::fmt::DebugWhere requests may connect. Implement it for a policy of your own.