Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mozilla/neqo into now-trans…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
mxinden committed Nov 12, 2024
2 parents 54a5040 + f11ce06 commit 74d838f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
14 changes: 10 additions & 4 deletions neqo-bin/src/client/http09.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use std::{
use neqo_common::{event::Provider, qdebug, qinfo, qwarn, Datagram};
use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_transport::{
CloseReason, Connection, ConnectionEvent, EmptyConnectionIdGenerator, Error, Output, State,
StreamId, StreamType,
CloseReason, Connection, ConnectionEvent, ConnectionIdGenerator, EmptyConnectionIdGenerator,
Error, Output, RandomConnectionIdGenerator, State, StreamId, StreamType,
};
use url::Url;

Expand Down Expand Up @@ -154,11 +154,17 @@ pub fn create_client(
"hq-29" | "hq-30" | "hq-31" | "hq-32" => args.shared.alpn.as_str(),
_ => "hq-interop",
};

let cid_generator: Rc<RefCell<dyn ConnectionIdGenerator>> = if args.cid_len == 0 {
Rc::new(RefCell::new(EmptyConnectionIdGenerator::default()))
} else {
Rc::new(RefCell::new(RandomConnectionIdGenerator::new(
args.cid_len.into(),
)))
};
let mut client = Connection::new_client(
hostname,
&[alpn],
Rc::new(RefCell::new(EmptyConnectionIdGenerator::default())),
cid_generator,
local_addr,
remote_addr,
args.shared.quic_parameters.get(alpn),
Expand Down
12 changes: 10 additions & 2 deletions neqo-bin/src/client/http3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_http3::{Error, Http3Client, Http3ClientEvent, Http3Parameters, Http3State, Priority};
use neqo_transport::{
AppError, CloseReason, Connection, EmptyConnectionIdGenerator, Error as TransportError, Output,
StreamId,
RandomConnectionIdGenerator, StreamId,
};
use url::Url;

Expand Down Expand Up @@ -64,10 +64,18 @@ pub fn create_client(
hostname: &str,
resumption_token: Option<ResumptionToken>,
) -> Res<Http3Client> {
let cid_generator: Rc<RefCell<dyn neqo_transport::ConnectionIdGenerator>> = if args.cid_len == 0
{
Rc::new(RefCell::new(EmptyConnectionIdGenerator::default()))
} else {
Rc::new(RefCell::new(RandomConnectionIdGenerator::new(
args.cid_len.into(),
)))
};
let mut transport = Connection::new_client(
hostname,
&[&args.shared.alpn],
Rc::new(RefCell::new(EmptyConnectionIdGenerator::default())),
cid_generator,
local_addr,
remote_addr,
args.shared.quic_parameters.get(args.shared.alpn.as_str()),
Expand Down
14 changes: 7 additions & 7 deletions neqo-bin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ pub struct Args {
/// Print connection stats after close.
#[arg(name = "stats", long)]
stats: bool,

/// The length of the local connection ID.
#[arg(name = "cid-length", short = 'l', long, default_value = "0",
value_parser = clap::value_parser!(u8).range(..=20))]
cid_len: u8,
}

impl Args {
Expand Down Expand Up @@ -198,6 +203,7 @@ impl Args {
test: None,
upload_size: if upload { requests[0] } else { 100 },
stats: false,
cid_len: 0,
}
}

Expand Down Expand Up @@ -245,13 +251,7 @@ impl Args {
self.method = String::from("POST");
}
}
"handshake"
| "transfer"
| "retry"
| "ecn"
| "rebind-port"
| "rebind-addr"
| "connectionmigration" => {}
"handshake" | "transfer" | "retry" | "ecn" => {}
"resumption" => {
if self.urls.len() < 2 {
qerror!("Warning: resumption test won't work without >1 URL");
Expand Down

0 comments on commit 74d838f

Please sign in to comment.