Struct Proxy
pub struct Proxy {
pub id: NonEmptyStr,
pub address: HostWithPort,
pub credential: Option<ProxyCredential>,
pub protocols: ProxyProtocols,
pub ip_category: IpCategory,
pub pool_id: Option<StringFilter>,
pub continent: Option<StringFilter>,
pub country: Option<StringFilter>,
pub state: Option<StringFilter>,
pub city: Option<StringFilter>,
pub carrier: Option<StringFilter>,
pub asn: Option<Asn>,
}proxy only.Expand description
A proxy record returned by a ProxyDB.
A record names every protocol the proxy speaks, and the
ProxyDBService turns a record plus the requested
transport into one ProxyAddress with one of them.
Fields§
§id: NonEmptyStrUnique identifier of the proxy.
address: HostWithPortHost and port to connect to the proxy on.
credential: Option<ProxyCredential>Credential to authenticate with at the proxy.
protocols: ProxyProtocolsEvery protocol the proxy speaks, each one way to reach it and one kind of tunnel, in order of preference: a request uses the first that carries its transport.
Outside of Rust each protocol is written as a proxy address scheme, optionally
followed by a path (see ProxyProtocol::try_from_scheme_and_path):
h2: CONNECT (TCP) over HTTP/2socks5+tcp: SOCKS5 CONNECTsocks5+udp: SOCKS5 UDP ASSOCIATEh3+udp: CONNECT-UDP over HTTP/3, on the default templateh3/udp/{target_host}/{target_port}: CONNECT-UDP over HTTP/3 on that path template, as inh3://proxy.example:443/udp/{target_host}/{target_port}
A record is selected on what it offers, so a SOCKS5 protocol names its transport.
A proxy that does both TCP and UDP lists both, such as socks5+tcp;socks5+udp.
ip_category: IpCategoryWhere the IP of the proxy comes from.
pool_id: Option<StringFilter>Pool ID of the proxy.
continent: Option<StringFilter>Continent of the proxy.
country: Option<StringFilter>Country of the proxy.
state: Option<StringFilter>State of the proxy.
city: Option<StringFilter>City of the proxy.
carrier: Option<StringFilter>Mobile carrier of the proxy.
asn: Option<Asn>Autonomous System Number (ASN).
Implementations§
§impl Proxy
impl Proxy
pub fn supports_connect_udp(&self) -> bool
pub fn supports_connect_udp(&self) -> bool
Whether the proxy tunnels UDP with CONNECT-UDP on at least one HTTP version.
pub fn supports_transport(&self, protocol: TransportProtocol) -> bool
pub fn supports_transport(&self, protocol: TransportProtocol) -> bool
Whether one of the proxy’s protocols carries the given transport.
pub fn is_match(&self, ctx: &ProxyContext, filter: &ProxyFilter) -> bool
pub fn is_match(&self, ctx: &ProxyContext, filter: &ProxyFilter) -> bool
Check if the proxy is a match for the givenProxyContext and ProxyFilter.
Trait Implementations§
§impl<'de> Deserialize<'de> for Proxy
impl<'de> Deserialize<'de> for Proxy
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Proxy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Proxy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Extension for Proxy
impl Extension for Proxy
§fn scope() -> ExtensionScopewhere
Self: Sized,
fn scope() -> ExtensionScopewhere
Self: Sized,
Extensions chain a lookup of this type resolves,
ExtensionScope::Flow unless the type says otherwise.§impl ProxyDB for Proxy
impl ProxyDB for Proxy
§type Error = Box<dyn Error + Send + Sync>
type Error = Box<dyn Error + Send + Sync>
§async fn get_proxies_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
_limit: Option<NonZero<usize>>,
) -> Result<NonEmptyVec<Proxy>, <Proxy as ProxyDB>::Error>
async fn get_proxies_if( &self, ctx: ProxyContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, _limit: Option<NonZero<usize>>, ) -> Result<NonEmptyVec<Proxy>, <Proxy as ProxyDB>::Error>
Proxy values in database-defined preference order,
after applying an additional predicate and optional result limit.§async fn get_proxy_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> Result<Proxy, <Proxy as ProxyDB>::Error>
async fn get_proxy_if( &self, ctx: ProxyContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, <Proxy as ProxyDB>::Error>
§fn get_proxies(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
limit: Option<NonZero<usize>>,
) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
fn get_proxies( &self, ctx: ProxyContext, filter: ProxyFilter, limit: Option<NonZero<usize>>, ) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
Proxy values in database-defined preference order,
up to the optional result limit.§fn get_proxy(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
fn get_proxy( &self, ctx: ProxyContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
Proxy based on the given ProxyContext and ProxyFilter,
or return an error in case no Proxy could be returned.impl ProxyExtension for Proxy
§impl Serialize for Proxy
impl Serialize for Proxy
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl !Freeze for Proxy
impl Forget for Proxy
impl Move for Proxy
impl RefUnwindSafe for Proxywhere
Atomic<usize>: RefUnwindSafe,
Atomic<*mut ()>: RefUnwindSafe,
TemplateVariable: RefUnwindSafe,
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl UnsafeUnpin for Proxywhere
*const ThinInner is !null: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ProxyProtocol>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Proxywhere
NonNull<ThinInner>: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
RawVecInner: UnwindSafe,
Arc<Inner>: UnwindSafe,
&'static str: UnwindSafe,
Arc<str>: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more