Struct Connection

Source
pub struct Connection { /* private fields */ }
Expand description

A connection to a server.

Implementations§

Source§

impl Connection

The client API.

Source

pub async fn get_config(&self) -> Result<String>

Fetches the configuration from the server.

The format of the configuration is up to the caller to interpret.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_allowlist(&self) -> Result<HostNetworkGroup>

Fetches the list of allowed networks from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_blocklist(&self) -> Result<HostNetworkGroup>

Fetches the list of blocked networks from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_data_source( &self, key: &DataSourceKey<'_>, ) -> Result<DataSource>

Fetches a data source from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_indicator(&self, name: &str) -> Result<HashSet<Vec<String>>>

Fetches an indicator from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_internal_network_list(&self) -> Result<HostNetworkGroup>

Fetches the list of internal networks from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_tidb_patterns( &self, tidbs: &[(&str, &str)], ) -> Result<Vec<(String, Option<Tidb>)>>

Fetches the patterns from the threat-intelligence database.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_tor_exit_node_list(&self) -> Result<Vec<String>>

Fetches the list of Tor exit nodes from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_trusted_domain_list(&self) -> Result<Vec<String>>

Fetches the list of trusted domains from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_trusted_user_agent_list(&self) -> Result<Vec<String>>

Fetches the list of trusted user agents from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn get_pretrained_model(&self, name: &str) -> Result<Vec<u8>>

Fetches the pretrained model from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source

pub async fn renew_certificate(&self, cert: &[u8]) -> Result<(String, String)>

Obtains a new certificate from the server.

§Errors

Returns an error if the request fails or the response is invalid.

Source§

impl Connection

Source

pub fn local_addr(&self) -> Result<SocketAddr>

Gets the local address of the connection.

§Errors

Returns an error if the call to the underlying local_addr fails.

Source

pub fn remote_addr(&self) -> SocketAddr

Gets the remote address of the connection.

Source

pub fn close_reason(&self) -> Option<Error>

If the connection is cloesd, returns the reason; otherwise, returns None.

Source

pub fn open_bi(&self) -> OpenBi<'_>

Initiates an outgoing bidirectional stream.

This directly corresponds to the open_bi method of the underlying quinn::Connection. In the future, this method may be removed in favor of this crate’s own implementation to provide additional features.

Source

pub fn open_uni(&self) -> OpenUni<'_>

Initiates an outgoing unidirectional stream.

This directly corresponds to the open_uni method of the underlying quinn::Connection. In the future, this method may be removed in favor of this crate’s own implementation to provide additional features.

Source

pub fn accept_bi(&self) -> AcceptBi<'_>

Accepts an incoming bidirectional stream.

This directly corresponds to the accept_bi method of the underlying quinn::Connection. In the future, this method may be removed in favor of this crate’s own implementation to provide additional features.

Trait Implementations§

Source§

impl Clone for Connection

Source§

fn clone(&self) -> Connection

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Connection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more