pub struct Connection { /* private fields */ }
Expand description
A connection to a server.
Implementations§
Source§impl Connection
The client API.
impl Connection
The client API.
Sourcepub async fn get_config(&self) -> Result<String>
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.
Sourcepub async fn get_allowlist(&self) -> Result<HostNetworkGroup>
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.
Sourcepub async fn get_blocklist(&self) -> Result<HostNetworkGroup>
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.
Sourcepub async fn get_data_source(
&self,
key: &DataSourceKey<'_>,
) -> Result<DataSource>
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.
Sourcepub async fn get_indicator(&self, name: &str) -> Result<HashSet<Vec<String>>>
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.
Sourcepub async fn get_internal_network_list(&self) -> Result<HostNetworkGroup>
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.
Sourcepub async fn get_tidb_patterns(
&self,
tidbs: &[(&str, &str)],
) -> Result<Vec<(String, Option<Tidb>)>>
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.
Sourcepub async fn get_tor_exit_node_list(&self) -> Result<Vec<String>>
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.
Sourcepub async fn get_trusted_domain_list(&self) -> Result<Vec<String>>
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.
Sourcepub async fn get_trusted_user_agent_list(&self) -> Result<Vec<String>>
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§impl Connection
impl Connection
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
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.
Sourcepub fn remote_addr(&self) -> SocketAddr
pub fn remote_addr(&self) -> SocketAddr
Gets the remote address of the connection.
Sourcepub fn close_reason(&self) -> Option<Error>
pub fn close_reason(&self) -> Option<Error>
If the connection is cloesd, returns the reason; otherwise, returns None
.
Sourcepub fn open_bi(&self) -> OpenBi<'_>
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.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more