pub struct Server<T> { /* private fields */ }Expand description
The snaptun server accepts connections from clients and provides them with an address assignment.
Implementations§
Source§impl<T: SnapTunToken> Server<T>
impl<T: SnapTunToken> Server<T>
Sourcepub fn new(validator: Arc<dyn TokenValidator<T>>, metrics: Metrics) -> Self
pub fn new(validator: Arc<dyn TokenValidator<T>>, metrics: Metrics) -> Self
Create a new server that can accept QUIC connections and turn them into snap tunnels.
Sourcepub async fn accept_with_timeout(
&self,
conn: Connection,
) -> Result<(Sender<T>, Receiver<T>, Control), AcceptError>
pub async fn accept_with_timeout( &self, conn: Connection, ) -> Result<(Sender<T>, Receiver<T>, Control), AcceptError>
Accept a connection and establish a tunnel.
§Tunnel initialization
The client is expected to first send a token update request, followed by an address assignment request. The connection is closed with a SnaptunConnErrors::Timeout if the client does not send the requests within ACCEPT_TIMEOUT.
Auto Trait Implementations§
impl<T> Freeze for Server<T>
impl<T> !RefUnwindSafe for Server<T>
impl<T> Send for Server<T>
impl<T> Sync for Server<T>
impl<T> Unpin for Server<T>
impl<T> !UnwindSafe for Server<T>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request