pub struct DestinationPolicy { /* private fields */ }Expand description
Policy for URLs learned from TEIs, discovery documents, and redirects.
Implementations§
Source§impl DestinationPolicy
impl DestinationPolicy
Sourcepub fn public_https() -> Self
pub fn public_https() -> Self
HTTPS to public addresses only.
Sourcepub fn allow_origin(origin: &Url) -> Result<Self, PolicyError>
pub fn allow_origin(origin: &Url) -> Result<Self, PolicyError>
Allow one explicit origin to use HTTP and non-public addresses.
Other origins keep the production restrictions. This is the development seam for a local TEA server; it is not a global “insecure” switch.
§Errors
Returns an error when origin has no host.
Sourcepub fn and_allow(self, origin: &Url) -> Result<Self, PolicyError>
pub fn and_allow(self, origin: &Url) -> Result<Self, PolicyError>
Sourcepub fn allows_origin(&self, url: &Url) -> bool
pub fn allows_origin(&self, url: &Url) -> bool
Whether this origin was explicitly excepted.
An exception is one scheme://host:port key. https://example.test
and https://example.test:443 are the same origin. A different scheme
or port is not excepted, and another hostname is not excepted merely
because it resolves to the same address.
Sourcepub fn check_url(&self, url: &Url) -> Result<(), PolicyError>
pub fn check_url(&self, url: &Url) -> Result<(), PolicyError>
Check scheme, userinfo, and literal addresses.
DNS results are checked separately with Self::allows_resolved_ip.
§Errors
Returns an error when the URL must not be contacted.
Sourcepub fn allows_resolved_ip(
&self,
url: &Url,
ip: IpAddr,
) -> Result<(), PolicyError>
pub fn allows_resolved_ip( &self, url: &Url, ip: IpAddr, ) -> Result<(), PolicyError>
Accept a DNS answer for url.
§Errors
Returns an error when the address is not public and the origin is not excepted.