Skip to content

Commit

Permalink
feat(s2n-quic-core): add null TLS provider for testing (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Jul 1, 2023
1 parent e7dfb0c commit 97096af
Show file tree
Hide file tree
Showing 13 changed files with 742 additions and 150 deletions.
2 changes: 1 addition & 1 deletion quic/s2n-quic-core/src/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pub mod error;
#[cfg(feature = "alloc")]
mod server_name;
pub(crate) mod server_name;

pub use error::Error;
#[cfg(feature = "alloc")]
Expand Down
6 changes: 5 additions & 1 deletion quic/s2n-quic-core/src/application/server_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ use bytes::Bytes;
/// - It can be converted into [`Bytes`] which supports zero-copy slicing and
/// reference counting.
/// - It can be accessed as `&str` so that applications can reason about the string value.
#[derive(Clone)]
#[derive(Clone, PartialEq)]
pub struct ServerName(Bytes);

/// A static value for localhost
#[allow(dead_code)] // this is used by conditional modules so don't warn
pub(crate) static LOCALHOST: ServerName = ServerName(Bytes::from_static(b"localhost"));

impl ServerName {
#[inline]
pub fn into_bytes(self) -> Bytes {
Expand Down
3 changes: 3 additions & 0 deletions quic/s2n-quic-core/src/crypto/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use zerocopy::{AsBytes, FromBytes, Unaligned};
#[cfg(any(test, feature = "testing"))]
pub mod testing;

#[cfg(all(feature = "alloc", any(test, feature = "testing")))]
pub mod null;

/// Holds all application parameters which are exchanged within the TLS handshake.
#[derive(Debug)]
pub struct ApplicationParameters<'a> {
Expand Down
Loading

0 comments on commit 97096af

Please sign in to comment.