pub struct ServerProtocolConfig {
pub variant_requirements: BTreeMap<ProtocolVariant, VersionReq>,
}Expand description
Server protocol configuration - defines what requirements the server has
Fields§
§variant_requirements: BTreeMap<ProtocolVariant, VersionReq>Semver requirements for each variant that the server accepts
Implementations§
Source§impl ServerProtocolConfig
impl ServerProtocolConfig
Sourcepub fn add_variant_requirement(
self,
variant: ProtocolVariant,
requirement: VersionReq,
) -> Self
pub fn add_variant_requirement( self, variant: ProtocolVariant, requirement: VersionReq, ) -> Self
Add a semver requirement for a protocol variant
Sourcepub fn alpn_protocols(&self) -> Vec<Vec<u8>>
pub fn alpn_protocols(&self) -> Vec<Vec<u8>>
Get ALPN protocol identifiers for TLS negotiation Advertises the server’s version requirements as serialized data
Sourcepub fn negotiate_version(
&self,
client_versions: &[ProtocolVersion],
) -> Option<ProtocolVersion>
pub fn negotiate_version( &self, client_versions: &[ProtocolVersion], ) -> Option<ProtocolVersion>
Check if client versions are acceptable and return the best match
Sourcepub fn from_alpn_data(alpn_data: &[u8]) -> Result<Self, Error>
pub fn from_alpn_data(alpn_data: &[u8]) -> Result<Self, Error>
Deserialize ServerProtocolConfig from ALPN data
Sourcepub fn relay_default() -> Self
pub fn relay_default() -> Self
Create default server configuration for relay protocol
Trait Implementations§
Source§impl Clone for ServerProtocolConfig
impl Clone for ServerProtocolConfig
Source§fn clone(&self) -> ServerProtocolConfig
fn clone(&self) -> ServerProtocolConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerProtocolConfig
impl Debug for ServerProtocolConfig
Source§impl Default for ServerProtocolConfig
impl Default for ServerProtocolConfig
Source§impl<'de> Deserialize<'de> for ServerProtocolConfig
impl<'de> Deserialize<'de> for ServerProtocolConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ServerProtocolConfig
impl RefUnwindSafe for ServerProtocolConfig
impl Send for ServerProtocolConfig
impl Sync for ServerProtocolConfig
impl Unpin for ServerProtocolConfig
impl UnwindSafe for ServerProtocolConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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