Struct kvarn::PortDescriptor
source · pub struct PortDescriptor { /* private fields */ }
Expand description
Describes port, certificate, and host data for a single port to bind.
See the note at the bottom of Host
for an explanation
about the relationship between Self::new
and Self::unsecure
.
Implementations§
source§impl PortDescriptor
impl PortDescriptor
Creation and configuration.
Used when creating a server.
sourcepub fn http(host_data: Arc<HostCollection>) -> Self
pub fn http(host_data: Arc<HostCollection>) -> Self
Uses the defaults for non-secure HTTP with host_data
sourcepub fn https(host_data: Arc<HostCollection>) -> Self
Available on crate feature https
only.
pub fn https(host_data: Arc<HostCollection>) -> Self
https
only.Uses the defaults for secure HTTP, HTTPS, with host_data
.
Gets a rustls::ServerConfig
from HostCollection::make_config()
.
sourcepub fn with_server_config(
port: u16,
host_data: Arc<HostCollection>,
server_config: Option<Arc<ServerConfig>>
) -> Self
Available on crate feature https
only.
pub fn with_server_config( port: u16, host_data: Arc<HostCollection>, server_config: Option<Arc<ServerConfig>> ) -> Self
https
only.Creates a new descriptor for port
with host_data
and an optional rustls::ServerConfig
.
sourcepub fn new(port: u16, host_data: Arc<HostCollection>) -> Self
pub fn new(port: u16, host_data: Arc<HostCollection>) -> Self
Creates a new descriptor for port
with host_data
.
If the feature https
is enabled, a rustls::ServerConfig
is created
from the host_data
.
sourcepub fn unsecure(port: u16, host_data: Arc<HostCollection>) -> Self
pub fn unsecure(port: u16, host_data: Arc<HostCollection>) -> Self
Creates a new non-secure descriptor for port
with host_data
.
Does not try to assign a certificate.
source§impl PortDescriptor
impl PortDescriptor
Inspection.
Used in ctl::Plugin
s.
sourcepub fn tls_config(&self) -> Option<&ServerConfig>
Available on crate feature https
only.
pub fn tls_config(&self) -> Option<&ServerConfig>
https
only.Get a reference to this port’s optional TLS config.
sourcepub fn hosts(&self) -> &HostCollection
pub fn hosts(&self) -> &HostCollection
Get the associated hosts.
This can be used to remove entries from the response & file cache.
Remember, this collection can be the same as for any other port descriptor.
sourcepub fn internet_protocol(&self) -> BindIpVersion
pub fn internet_protocol(&self) -> BindIpVersion
Get the version of the internet protocol (IP) we are listening on
through Self::port
.
Trait Implementations§
source§impl Clone for PortDescriptor
impl Clone for PortDescriptor
source§fn clone(&self) -> PortDescriptor
fn clone(&self) -> PortDescriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more