Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to draft 29 #812

Merged
merged 7 commits into from
Jun 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions interop/src/main.rs
Original file line number Diff line number Diff line change
@@ -65,9 +65,9 @@ impl From<&Alpn> for Vec<Vec<u8>> {
fn from(alpn: &Alpn) -> Vec<Vec<u8>> {
match alpn {
Alpn::H3 => vec![quinn_h3::ALPN.into()],
Alpn::Hq => vec![b"hq-28"[..].into()],
Alpn::Hq => vec![b"hq-29"[..].into()],
Alpn::SiDuck => vec![b"siduck-00"[..].into()],
Alpn::HqH3 => vec![b"hq-28"[..].into(), quinn_h3::ALPN.into()],
Alpn::HqH3 => vec![b"hq-29"[..].into(), quinn_h3::ALPN.into()],
}
}
}
6 changes: 3 additions & 3 deletions interop/src/server.rs
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ async fn main() -> Result<()> {

let mut server_config = quinn::ServerConfigBuilder::default();
server_config.certificate(cert_chain, key)?;
server_config.protocols(&[quinn_h3::ALPN, b"hq-28", b"siduck-00"]);
server_config.protocols(&[quinn_h3::ALPN, b"hq-29", b"siduck-00"]);

let main = server(server_config.clone(), SocketAddr::new(opt.listen, 4433));
let default = server(server_config.clone(), SocketAddr::new(opt.listen, 443));
@@ -110,7 +110,7 @@ async fn server(server_config: quinn::ServerConfigBuilder, addr: SocketAddr) ->

let result = match &proto[..] {
quinn_h3::ALPN => h3_handle_connection(connecting).await,
b"hq-28" => hq_handle_connection(connecting).await,
b"hq-29" => hq_handle_connection(connecting).await,
b"siduck-00" => siduck_handle_connection(connecting).await,
_ => unreachable!("unsupported protocol"),
};
@@ -324,7 +324,7 @@ fn parse_size(literal: &str) -> Result<usize> {
Ok(num * scale)
}

const ALT_SVC: &str = "h3-28=\":443\"";
const ALT_SVC: &str = "h3-29=\":443\"";

fn h2_home() -> hyper::Response<hyper::Body> {
Response::builder()
2 changes: 1 addition & 1 deletion quinn-h3/src/lib.rs
Original file line number Diff line number Diff line change
@@ -374,7 +374,7 @@ impl From<VarInt> for HttpError {
}

/// TLS ALPN value for the HTTP/3 protocol
pub const ALPN: &[u8] = b"h3-28";
pub const ALPN: &[u8] = b"h3-29";

impl From<frame::Error> for (ErrorCode, String, Error) {
fn from(err: frame::Error) -> Self {
202 changes: 127 additions & 75 deletions quinn-proto/src/connection/mod.rs

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions quinn-proto/src/connection/spaces.rs
Original file line number Diff line number Diff line change
@@ -54,14 +54,16 @@ where
pub(crate) crypto_offset: u64,

/// The time the most recently sent retransmittable packet was sent.
pub(crate) time_of_last_sent_ack_eliciting_packet: Option<Instant>,
pub(crate) time_of_last_ack_eliciting_packet: Option<Instant>,
/// The time at which the earliest sent packet in this space will be considered lost based on
/// exceeding the reordering window in time. Only set for packets numbered prior to a packet
/// that has been acknowledged.
pub(crate) loss_time: Option<Instant>,
/// Number of tail loss probes to send
pub(crate) loss_probes: u32,
pub(crate) ping_pending: bool,
/// Number of congestion control "in flight" bytes
pub(crate) in_flight: u64,
}

impl<S> PacketSpace<S>
@@ -89,10 +91,11 @@ where
crypto_stream: Assembler::new(),
crypto_offset: 0,

time_of_last_sent_ack_eliciting_packet: None,
time_of_last_ack_eliciting_packet: None,
loss_time: None,
loss_probes: 0,
ping_pending: false,
in_flight: 0,
}
}

@@ -142,6 +145,11 @@ where
self.ecn_feedback = ecn;
Ok(ce_increase != 0)
}

pub(crate) fn sent(&mut self, number: u64, packet: SentPacket) {
self.in_flight += u64::from(packet.size);
self.sent_packets.insert(number, packet);
}
}

impl<S: crypto::Session> Index<SpaceId> for [PacketSpace<S>; 3] {
8 changes: 4 additions & 4 deletions quinn-proto/src/crypto/rustls.rs
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ impl crypto::Session for TlsSession {

fn initial_keys(dst_cid: &ConnectionId, side: Side) -> Keys<Self> {
const INITIAL_SALT: [u8; 20] = [
0xc3, 0xee, 0xf7, 0x12, 0xc7, 0x2e, 0xbb, 0x5a, 0x11, 0xa7, 0xd2, 0x43, 0x2b, 0xb4,
0x63, 0x65, 0xbe, 0xf9, 0xf5, 0x02,
0xaf, 0xbf, 0xec, 0x28, 0x99, 0x93, 0xd2, 0x4c, 0x9e, 0x97, 0x86, 0xf1, 0x9c, 0x61,
0x11, 0xe0, 0x43, 0x90, 0xa8, 0x99,
];

let salt = ring::hkdf::Salt::new(ring::hkdf::HKDF_SHA256, &INITIAL_SALT);
@@ -239,10 +239,10 @@ impl DerefMut for TlsSession {
}

const RETRY_INTEGRITY_KEY: [u8; 16] = [
0x4d, 0x32, 0xec, 0xdb, 0x2a, 0x21, 0x33, 0xc8, 0x41, 0xe4, 0x04, 0x3d, 0xf2, 0x7d, 0x44, 0x30,
0xcc, 0xce, 0x18, 0x7e, 0xd0, 0x9a, 0x09, 0xd0, 0x57, 0x28, 0x15, 0x5a, 0x6c, 0xb9, 0x6b, 0xe1,
];
const RETRY_INTEGRITY_NONCE: [u8; 12] = [
0x4d, 0x16, 0x11, 0xd0, 0x55, 0x13, 0xa5, 0x52, 0xc5, 0x87, 0xd5, 0x75,
0xe5, 0x49, 0x30, 0xf9, 0x7f, 0x21, 0x36, 0xf0, 0x53, 0x0a, 0x8c, 0x1c,
];

/// Authentication data for (rustls) TLS session
2 changes: 1 addition & 1 deletion quinn-proto/src/endpoint.rs
Original file line number Diff line number Diff line change
@@ -512,7 +512,7 @@ where
crypto,
&src_cid,
&temp_loc_cid,
TransportError::SERVER_BUSY(""),
TransportError::CONNECTION_REFUSED(""),
);
return None;
}
2 changes: 1 addition & 1 deletion quinn-proto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ mod rustls_impls {
pub use crate::rustls_impls::*;

/// The QUIC protocol version implemented
const VERSION: u32 = 0xff00_001c;
const VERSION: u32 = 0xff00_001d;

/// Whether an endpoint was the initiator of a connection
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6 changes: 3 additions & 3 deletions quinn-proto/src/packet.rs
Original file line number Diff line number Diff line change
@@ -836,8 +836,8 @@ mod tests {
assert_eq!(
buf[..],
hex!(
"c7ff00001c0806b858ec6f80452b0000402150
540018670adb60eab8efbd35425c2d9b4bc7d1df5d8f2b894b9c49b026165097"
"ccff00001d0806b858ec6f80452b00004021b1
b35cedb8ac6906c20c52b09ad2719228310d8f8a51746a75b853060a4e3c0e6e"
)[..]
);

@@ -846,7 +846,7 @@ mod tests {
let mut packet = decode.finish(Some(&server.header.remote)).unwrap();
assert_eq!(
packet.header_data[..],
hex!("c0ff00001c0806b858ec6f80452b0000402100")[..]
hex!("c0ff00001d0806b858ec6f80452b0000402100")[..]
);
server
.packet
4 changes: 2 additions & 2 deletions quinn-proto/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -842,7 +842,7 @@ fn idle_timeout() {
}

#[test]
fn server_busy() {
fn accept_buffer_full() {
let _guard = subscribe();
let mut pair = Pair::new(
Default::default(),
@@ -858,7 +858,7 @@ fn server_busy() {
Some(Event::ConnectionLost {
reason:
ConnectionError::ConnectionClosed(frame::ConnectionClose {
error_code: TransportErrorCode::SERVER_BUSY,
error_code: TransportErrorCode::CONNECTION_REFUSED,
..
}),
})
2 changes: 1 addition & 1 deletion quinn-proto/src/transport_error.rs
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ macro_rules! errors {
errors! {
NO_ERROR(0x0) "the connection is being closed abruptly in the absence of any error";
INTERNAL_ERROR(0x1) "the endpoint encountered an internal error and cannot continue with the connection";
SERVER_BUSY(0x2) "the server is currently busy and does not accept any new connections";
CONNECTION_REFUSED(0x2) "the server refused to accept a new connection";
FLOW_CONTROL_ERROR(0x3) "received more data than permitted in advertised data limits";
STREAM_LIMIT_ERROR(0x4) "received a frame for a stream identifier that exceeded advertised the stream limit for the corresponding stream type";
STREAM_STATE_ERROR(0x5) "received a frame for a stream that was not in a state that permitted that frame";
2 changes: 1 addition & 1 deletion quinn/examples/common/mod.rs
Original file line number Diff line number Diff line change
@@ -72,4 +72,4 @@ fn configure_server() -> Result<(ServerConfig, Vec<u8>), Box<dyn Error>> {
}

#[allow(unused)]
pub const ALPN_QUIC_HTTP: &[&[u8]] = &[b"hq-28"];
pub const ALPN_QUIC_HTTP: &[&[u8]] = &[b"hq-29"];