mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-29 16:14:58 +02:00
tls doc updates
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
//! TCP connector services for Actix ecosystem.
|
||||
//! TCP and TLS connector services.
|
||||
//!
|
||||
//! # Stages of the TCP connector service:
|
||||
//! - Resolve [`Address`] with given [`Resolver`] and collect list of socket addresses.
|
||||
@ -9,10 +9,6 @@
|
||||
//! - Wrap the stream and perform connect handshake with remote peer.
|
||||
//! - Return certain stream type that impls `AsyncRead` and `AsyncWrite`.
|
||||
//!
|
||||
//! # Package feature
|
||||
//! * `openssl` - enables TLS support via `openssl` crate
|
||||
//! * `rustls` - enables TLS support via `rustls` crate
|
||||
//!
|
||||
//! [`TcpStream`]: actix_rt::net::TcpStream
|
||||
|
||||
#[allow(clippy::module_inception)]
|
||||
@ -22,55 +18,18 @@ mod error;
|
||||
mod resolve;
|
||||
mod service;
|
||||
pub mod tls;
|
||||
// TODO: remove `ssl` mod re-export in next break change
|
||||
#[doc(hidden)]
|
||||
pub use tls as ssl;
|
||||
mod tcp;
|
||||
#[cfg(feature = "uri")]
|
||||
mod uri;
|
||||
|
||||
use actix_rt::net::TcpStream;
|
||||
use actix_service::{Service, ServiceFactory};
|
||||
|
||||
pub use self::connect::{Address, Connect, Connection};
|
||||
pub use self::connector::{TcpConnector, TcpConnectorFactory};
|
||||
pub use self::error::ConnectError;
|
||||
pub use self::resolve::{Resolve, Resolver, ResolverFactory};
|
||||
pub use self::service::{ConnectService, ConnectServiceFactory};
|
||||
|
||||
/// Create TCP connector service.
|
||||
pub fn new_connector<T: Address + 'static>(
|
||||
resolver: Resolver,
|
||||
) -> impl Service<Connect<T>, Response = Connection<T, TcpStream>, Error = ConnectError> + Clone
|
||||
{
|
||||
ConnectServiceFactory::new(resolver).service()
|
||||
}
|
||||
|
||||
/// Create TCP connector service factory.
|
||||
pub fn new_connector_factory<T: Address + 'static>(
|
||||
resolver: Resolver,
|
||||
) -> impl ServiceFactory<
|
||||
Connect<T>,
|
||||
Config = (),
|
||||
Response = Connection<T, TcpStream>,
|
||||
Error = ConnectError,
|
||||
InitError = (),
|
||||
> + Clone {
|
||||
ConnectServiceFactory::new(resolver)
|
||||
}
|
||||
|
||||
/// Create connector service with default parameters.
|
||||
pub fn default_connector<T: Address + 'static>(
|
||||
) -> impl Service<Connect<T>, Response = Connection<T, TcpStream>, Error = ConnectError> + Clone
|
||||
{
|
||||
new_connector(Resolver::Default)
|
||||
}
|
||||
|
||||
/// Create connector service factory with default parameters.
|
||||
pub fn default_connector_factory<T: Address + 'static>() -> impl ServiceFactory<
|
||||
Connect<T>,
|
||||
Config = (),
|
||||
Response = Connection<T, TcpStream>,
|
||||
Error = ConnectError,
|
||||
InitError = (),
|
||||
> + Clone {
|
||||
new_connector_factory(Resolver::Default)
|
||||
}
|
||||
pub use self::tcp::{
|
||||
default_connector, default_connector_factory, new_connector, new_connector_factory,
|
||||
};
|
||||
|
43
actix-tls/src/connect/tcp.rs
Normal file
43
actix-tls/src/connect/tcp.rs
Normal file
@ -0,0 +1,43 @@
|
||||
use actix_rt::net::TcpStream;
|
||||
use actix_service::{Service, ServiceFactory};
|
||||
|
||||
use super::{Address, Connect, ConnectError, ConnectServiceFactory, Connection, Resolver};
|
||||
|
||||
/// Create TCP connector service.
|
||||
pub fn new_connector<T: Address + 'static>(
|
||||
resolver: Resolver,
|
||||
) -> impl Service<Connect<T>, Response = Connection<T, TcpStream>, Error = ConnectError> + Clone
|
||||
{
|
||||
ConnectServiceFactory::new(resolver).service()
|
||||
}
|
||||
|
||||
/// Create TCP connector service factory.
|
||||
pub fn new_connector_factory<T: Address + 'static>(
|
||||
resolver: Resolver,
|
||||
) -> impl ServiceFactory<
|
||||
Connect<T>,
|
||||
Config = (),
|
||||
Response = Connection<T, TcpStream>,
|
||||
Error = ConnectError,
|
||||
InitError = (),
|
||||
> + Clone {
|
||||
ConnectServiceFactory::new(resolver)
|
||||
}
|
||||
|
||||
/// Create TCP connector service with default parameters.
|
||||
pub fn default_connector<T: Address + 'static>(
|
||||
) -> impl Service<Connect<T>, Response = Connection<T, TcpStream>, Error = ConnectError> + Clone
|
||||
{
|
||||
new_connector(Resolver::Default)
|
||||
}
|
||||
|
||||
/// Create TCP connector service factory with default parameters.
|
||||
pub fn default_connector_factory<T: Address + 'static>() -> impl ServiceFactory<
|
||||
Connect<T>,
|
||||
Config = (),
|
||||
Response = Connection<T, TcpStream>,
|
||||
Error = ConnectError,
|
||||
InitError = (),
|
||||
> + Clone {
|
||||
new_connector_factory(Resolver::Default)
|
||||
}
|
Reference in New Issue
Block a user