quinn: add proper guards to Endpoint constructor helpers

This commit is contained in:
Dirkjan Ochtman
2024-05-03 17:02:41 +02:00
committed by Benjamin Saunders
parent 74c035822b
commit 272dd5d45f
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ publish = false
anyhow = "1.0.22"
bytes = "1"
hdrhistogram = { version = "7.2", default-features = false }
quinn = { path = "../quinn" }
quinn = { path = "../quinn", features = ["ring"] }
rcgen = "0.13"
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
clap = { version = "4", features = ["derive"] }
+5 -1
View File
@@ -12,8 +12,10 @@ use std::{
time::Instant,
};
#[cfg(feature = "ring")]
use crate::runtime::default_runtime;
use crate::{
runtime::{default_runtime, AsyncUdpSocket, Runtime},
runtime::{AsyncUdpSocket, Runtime},
udp_transmit,
};
use bytes::{Bytes, BytesMut};
@@ -56,6 +58,7 @@ impl Endpoint {
/// IPv6 address on Windows will not by default be able to communicate with IPv4
/// addresses. Portable applications should bind an address that matches the family they wish to
/// communicate within.
#[cfg(feature = "ring")]
pub fn client(addr: SocketAddr) -> io::Result<Self> {
let socket = std::net::UdpSocket::bind(addr)?;
let runtime = default_runtime()
@@ -74,6 +77,7 @@ impl Endpoint {
/// IPv6 address on Windows will not by default be able to communicate with IPv4
/// addresses. Portable applications should bind an address that matches the family they wish to
/// communicate within.
#[cfg(feature = "ring")]
pub fn server(config: ServerConfig, addr: SocketAddr) -> io::Result<Self> {
let socket = std::net::UdpSocket::bind(addr)?;
let runtime = default_runtime()