Struct ConnectUdpService
pub struct ConnectUdpService<P = DestinationScopePolicy, R = GlobalDnsResolver, C = UdpConnector, F = ConnectUdpRelay> { /* private fields */ }masque only.Expand description
A CONNECT-UDP proxy (RFC 9298) for every HTTP version.
Matches requests against the proxy’s URI template, resolves the target before
answering (RFC 9298 §3.1), sends only to a resolved address the ConnectUdpPolicy
allows, and hands the tunnel and a connected UDP socket to the relay F: by default
ConnectUdpRelay, which forwards payloads until either side ends or the tunnel idles
out; an inspecting relay can terminate the tunneled QUIC instead. Refusals carry a Proxy-Status
(RFC 9209) entry. Authentication is any layer in front of this service.
The listener must allow the tunnel: HTTP/1.1 upgrades, Extended CONNECT on HTTP/2
(enable_connect_protocol) and HTTP/3 (extended_connect), with HTTP/3 datagrams
enabled for native payloads.
Implementations§
§impl ConnectUdpService
impl ConnectUdpService
pub fn try_new(
exec: Executor,
template: Option<&ProxyPathTemplate>,
) -> Result<ConnectUdpService, UriTemplateError>
pub fn try_new( exec: Executor, template: Option<&ProxyPathTemplate>, ) -> Result<ConnectUdpService, UriTemplateError>
A proxy for template, or for the RFC 9298 default template when None, with the
safe DestinationScopePolicy, the global DNS resolver and plain UDP sockets.
§impl<P, R, C, F> ConnectUdpService<P, R, C, F>
impl<P, R, C, F> ConnectUdpService<P, R, C, F>
pub fn with_policy<P2>(self, policy: P2) -> ConnectUdpService<P2, R, C, F>
pub fn with_policy<P2>(self, policy: P2) -> ConnectUdpService<P2, R, C, F>
Decide which resolved addresses tunnels may send to.
pub fn with_resolver<R2>(self, resolver: R2) -> ConnectUdpService<P, R2, C, F>
pub fn with_resolver<R2>(self, resolver: R2) -> ConnectUdpService<P, R2, C, F>
Resolve target names with resolver.
pub fn with_connector<C2>(self, connector: C2) -> ConnectUdpService<P, R, C2, F>
pub fn with_connector<C2>(self, connector: C2) -> ConnectUdpService<P, R, C2, F>
Create the target-side UDP sockets with connector.
pub fn with_relay<F2>(self, relay: F2) -> ConnectUdpService<P, R, C, F2>
pub fn with_relay<F2>(self, relay: F2) -> ConnectUdpService<P, R, C, F2>
Relay each accepted tunnel with relay, given the tunnel and its connected target
socket. The tunnel carries the target as its ConnectorTarget.
pub fn maybe_with_proxy_name(
self,
name: Option<Arc<str>>,
) -> ConnectUdpService<P, R, C, F>
pub fn maybe_with_proxy_name( self, name: Option<Arc<str>>, ) -> ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn maybe_set_proxy_name(
&mut self,
name: Option<Arc<str>>,
) -> &mut ConnectUdpService<P, R, C, F>
pub fn maybe_set_proxy_name( &mut self, name: Option<Arc<str>>, ) -> &mut ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn with_proxy_name(self, name: Arc<str>) -> ConnectUdpService<P, R, C, F>
pub fn with_proxy_name(self, name: Arc<str>) -> ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn set_proxy_name(
&mut self,
name: Arc<str>,
) -> &mut ConnectUdpService<P, R, C, F>
pub fn set_proxy_name( &mut self, name: Arc<str>, ) -> &mut ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn without_proxy_name(self) -> ConnectUdpService<P, R, C, F>
pub fn without_proxy_name(self) -> ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn unset_proxy_name(&mut self) -> &mut ConnectUdpService<P, R, C, F>
pub fn unset_proxy_name(&mut self) -> &mut ConnectUdpService<P, R, C, F>
How this proxy names itself in Proxy-Status: a service name, hostname or
alias. Defaults to the host the request addressed.
pub fn with_dns_timeout(
self,
timeout: Duration,
) -> ConnectUdpService<P, R, C, F>
pub fn with_dns_timeout( self, timeout: Duration, ) -> ConnectUdpService<P, R, C, F>
How long resolving a target may take before the request fails with dns_timeout.
pub fn set_dns_timeout(
&mut self,
timeout: Duration,
) -> &mut ConnectUdpService<P, R, C, F>
pub fn set_dns_timeout( &mut self, timeout: Duration, ) -> &mut ConnectUdpService<P, R, C, F>
How long resolving a target may take before the request fails with dns_timeout.
pub fn with_socket_config(
self,
config: ConnectUdpSocketConfig,
) -> ConnectUdpService<P, R, C, F>
pub fn with_socket_config( self, config: ConnectUdpSocketConfig, ) -> ConnectUdpService<P, R, C, F>
Limits of each tunnel, including its idle timeout.
pub fn set_socket_config(
&mut self,
config: ConnectUdpSocketConfig,
) -> &mut ConnectUdpService<P, R, C, F>
pub fn set_socket_config( &mut self, config: ConnectUdpSocketConfig, ) -> &mut ConnectUdpService<P, R, C, F>
Limits of each tunnel, including its idle timeout.
pub fn matcher(&self) -> &ConnectUdpRequestMatcher
pub fn matcher(&self) -> &ConnectUdpRequestMatcher
The matcher recognising this proxy’s CONNECT-UDP requests, for routing.
Trait Implementations§
§impl<P, R, C, F> Clone for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> Clone for ConnectUdpService<P, R, C, F>
§fn clone(&self) -> ConnectUdpService<P, R, C, F>
fn clone(&self) -> ConnectUdpService<P, R, C, F>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<P, R, C, F> Debug for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> Debug for ConnectUdpService<P, R, C, F>
§impl<P, R, C, F, S> Service<Request> for ConnectUdpService<P, R, C, F>where
P: ConnectUdpPolicy,
R: DnsAddressResolver,
C: ConnectorService<ConnectRequest, Connection = S>,
S: DatagramSocket,
F: Service<BridgeIo<ConnectUdpSocket, S>, Output = ()>,
<F as Service<BridgeIo<ConnectUdpSocket, S>>>::Error: Into<Box<dyn Error + Send + Sync>>,
impl<P, R, C, F, S> Service<Request> for ConnectUdpService<P, R, C, F>where
P: ConnectUdpPolicy,
R: DnsAddressResolver,
C: ConnectorService<ConnectRequest, Connection = S>,
S: DatagramSocket,
F: Service<BridgeIo<ConnectUdpSocket, S>, Output = ()>,
<F as Service<BridgeIo<ConnectUdpSocket, S>>>::Error: Into<Box<dyn Error + Send + Sync>>,
Auto Trait Implementations§
impl<P, R, C, F> Freeze for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> RefUnwindSafe for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> Send for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> Sync for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> Unpin for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> UnsafeUnpin for ConnectUdpService<P, R, C, F>
impl<P, R, C, F> UnwindSafe for ConnectUdpService<P, R, C, F>
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> 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, ReqBody, ResBody> GrpcService<ReqBody> for T
impl<T, ReqBody, ResBody> GrpcService<ReqBody> for T
§type ResponseBody = ResBody
type ResponseBody = ResBody
§fn serve(
&self,
request: Request<ReqBody>,
) -> impl Future<Output = Result<Response<<T as GrpcService<ReqBody>>::ResponseBody>, <T as GrpcService<ReqBody>>::Error>> + Send
fn serve( &self, request: Request<ReqBody>, ) -> impl Future<Output = Result<Response<<T as GrpcService<ReqBody>>::ResponseBody>, <T as GrpcService<ReqBody>>::Error>> + Send
§impl<S, Body> HttpClientExt for S
impl<S, Body> HttpClientExt for S
§type ExecuteResponse = Response<Body>
type ExecuteResponse = Response<Body>
execute method.§type ExecuteError = <S as Service<Request>>::Error
type ExecuteError = <S as Service<Request>>::Error
execute method.§fn get(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn get( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
GET request to a URL. Read more§fn post(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn post( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
POST request to a URL. Read more§fn put(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn put( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
PUT request to a URL. Read more§fn patch(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn patch( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
PATCH request to a URL. Read more§fn delete(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn delete( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
DELETE request to a URL. Read more§fn head(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn head( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
HEAD request to a URL. Read more§fn connect(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn connect( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
CONNECT request to a URL. Read more§fn query(
&self,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn query( &self, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
QUERY request to a URL. Read more§fn request(
&self,
method: Method,
url: impl IntoUrl,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn request( &self, method: Method, url: impl IntoUrl, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
§fn build_from_request<RequestBody>(
&self,
request: Request<RequestBody>,
) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
fn build_from_request<RequestBody>( &self, request: Request<RequestBody>, ) -> RequestBuilder<'_, S, <S as HttpClientExt>::ExecuteResponse>
§fn execute(
&self,
request: Request,
) -> impl Future<Output = Result<<S as HttpClientExt>::ExecuteResponse, <S as HttpClientExt>::ExecuteError>>
fn execute( &self, request: Request, ) -> impl Future<Output = Result<<S as HttpClientExt>::ExecuteResponse, <S as HttpClientExt>::ExecuteError>>
Request. Read more§impl<S, Body> HttpClientWebSocketExt<Body> for S
impl<S, Body> HttpClientWebSocketExt<Body> for S
§fn websocket(
&self,
url: impl IntoUrl,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder] to be used to establish a WebSocket connection over http/1.1.§fn websocket_h2(
&self,
url: impl IntoUrl,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket_h2( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder to be used to establish a WebSocket connection over h2.§fn websocket_h3(
&self,
url: impl IntoUrl,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket_h3( &self, url: impl IntoUrl, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder to be used to establish a WebSocket connection over h3.§fn websocket_with_request<RequestBody>(
&self,
req: Request<RequestBody>,
) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
fn websocket_with_request<RequestBody>( &self, req: Request<RequestBody>, ) -> WebSocketRequestBuilder<WithService<'_, S, Body>>
WebSocketRequestBuilder starting from the given request. Read more§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<S> IntoEndpointService<(S,)> for S
impl<S> IntoEndpointService<(S,)> for S
type Service = S
§fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
fn into_endpoint_service(self) -> <S as IntoEndpointService<(S,)>>::Service
rama_core::Service.§impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
impl<S, State> IntoEndpointServiceWithState<(S,), State> for S
type Service = S
§fn into_endpoint_service_with_state(
self,
_state: State,
) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
fn into_endpoint_service_with_state( self, _state: State, ) -> <S as IntoEndpointServiceWithState<(S,), State>>::Service
rama_core::Service with state.§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