Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions .github/actions/compliance/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ runs:
using: "composite"
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true

- name: Cache builds
uses: camshaft/rust-cache@v1
Expand Down Expand Up @@ -67,7 +66,7 @@ runs:
# publish report only when pushing to master
- name: Push to gh-pages
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v1
with:
github_token: ${{ github.token }}
branch: gh-pages
Expand Down
103 changes: 27 additions & 76 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
RUST_BACKTRACE: 1
toolchain_style: stable
toolchain_msrv: 1.70.0
toolchain_msrv: 1.74.1
toolchain_h3_quinn_msrv: 1.74.1
toolchain_doc: nightly-2025-04-02
toolchain_lint: stable
Expand All @@ -35,76 +35,49 @@ jobs:
name: Check Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_style }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_style }}
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: cargo fmt --all -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- run: cargo fmt --all -- --check

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_lint }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_lint }}
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
- run: cargo clippy

msrv:
name: Check MSRV
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_msrv }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_msrv }}
override: true
- uses: Swatinem/rust-cache@v2
- name: cargo check -p h3
uses: actions-rs/cargo@v1
with:
command: check
args: -p h3
- run: cargo check -p h3

msrv_h3_quinn:
name: Check MSRV of `h3-quinn`
needs: [style]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_h3_quinn_msrv }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_h3_quinn_msrv }}
override: true
- uses: Swatinem/rust-cache@v2
- name: cargo check -p h3-quinn
uses: actions-rs/cargo@v1
with:
command: check
args: -p h3-quinn
- run: cargo check -p h3-quinn

test:
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} ${{ matrix.target }}
Expand All @@ -123,7 +96,7 @@ jobs:
target: i686-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
# Add this step for 32-bit build support
- name: Install 32-bit development libraries
if: matrix.target == 'i686-unknown-linux-gnu'
Expand All @@ -132,18 +105,13 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-multilib libc6-dev-i386
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
- uses: Swatinem/rust-cache@v2
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --features ${{ matrix.features }} --target ${{ matrix.target }}
- run: cargo test --features ${{ matrix.features }} --target ${{ matrix.target }}
env: #[cfg(feature = "datagram")] unexpected `cfg` condition value: `datagram`
RUSTFLAGS: "-A unexpected_cfgs"
- name: h3Spec
run: ./ci/h3spec.sh
if: matrix.toolchain == 'stable'
Expand All @@ -153,49 +121,35 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_doc }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_doc }}
override: true
- uses: Swatinem/rust-cache@v2
- name: cargo rustdoc -p h3 -- -D intra-doc-link-resolution-failure
uses: actions-rs/cargo@v1
with:
command: rustdoc
args: -p h3 -- -D intra-doc-link-resolution-failure
- run: cargo rustdoc -p h3 -- -D intra-doc-link-resolution-failure

fuzz:
name: Fuzz test
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust ${{ env.toolchain_fuzz }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain_fuzz }}
override: true
- uses: Swatinem/rust-cache@v2
- name: Install cargo-fuzz
uses: camshaft/install@v1
with:
crate: cargo-fuzz
- name: cargo fuzz run fuzz_varint -- -runs=1
uses: actions-rs/cargo@v1
with:
command: fuzz
args: run fuzz_varint -- -runs=1
- run: cargo fuzz run fuzz_varint -- -runs=1

compliance:
name: Compliance report
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
persist-credentials: false
fetch-depth: 0
Expand All @@ -209,13 +163,10 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Install Rust stable
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Run server and client examples test
run: ./ci/example_test.sh
4 changes: 2 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ quinn = { version = "0.11", default-features = false, features = [
"rustls",
"ring",
] }
rcgen = { version = "0.13" }
rcgen = { version = "0.14" }
rustls = { version = "0.23", default-features = false, features = [
"logging",
"ring",
"std",
] }
rustls-native-certs = "0.7"
rustls-native-certs = "0.8"
structopt = "0.3"
tokio = { version = "1.27", features = ["full"] }
tracing = "0.1.37"
Expand Down
20 changes: 9 additions & 11 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{path::PathBuf, sync::Arc};
use futures::future;
use h3::error::{ConnectionError, StreamError};
use rustls::pki_types::CertificateDer;
use rustls_native_certs::CertificateResult;
use structopt::StructOpt;
use tokio::io::AsyncWriteExt;
use tracing::{error, info};
Expand Down Expand Up @@ -63,18 +64,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

// load CA certificates stored in the system
let mut roots = rustls::RootCertStore::empty();
match rustls_native_certs::load_native_certs() {
Ok(certs) => {
for cert in certs {
if let Err(e) = roots.add(cert) {
error!("failed to parse trust anchor: {}", e);
}
}
let CertificateResult { certs, errors, .. } = rustls_native_certs::load_native_certs();
for cert in certs {
if let Err(e) = roots.add(cert) {
error!("failed to parse trust anchor: {}", e);
}
Err(e) => {
error!("couldn't load any default trust roots: {}", e);
}
};
}
for e in errors {
error!("couldn't load default trust roots: {}", e);
}

// load certificate of CA who issues the server certificate
// NOTE that this should be used for dev only
Expand Down
4 changes: 3 additions & 1 deletion h3-datagram/src/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ where
B: Buf,
{
/// Creates a new datagram frame
// TODO: remove for MSRV >= 1.87 https://github.com/rust-lang/rust/issues/128101
#[allow(unknown_lints, clippy::manual_is_multiple_of)]
pub fn new(stream_id: StreamId, payload: B) -> Self {
assert!(
stream_id.into_inner() % 4 == 0,
Expand Down Expand Up @@ -106,7 +108,7 @@ where

fn chunk(&self) -> &[u8] {
if self.len - self.pos > 0 {
return &self.stream_id[self.pos..self.len];
&self.stream_id[self.pos..self.len]
} else {
self.payload.chunk()
}
Expand Down
2 changes: 1 addition & 1 deletion h3-quinn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "h3-quinn"
version = "0.0.10"
rust-version = "1.70"
rust-version = "1.74"
authors = ["Jean-Christophe BEGUE <jc.begue@pm.me>"]
edition = "2021"
documentation = "https://docs.rs/h3-quinn"
Expand Down
8 changes: 3 additions & 5 deletions h3-quinn/src/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<B: Buf> SendDatagram<B> for SendDatagramHandler {
let mut buf: EncodedDatagram<B> = data.into();
self.conn
.send_datagram(buf.copy_to_bytes(buf.remaining()))
.map_err(|err| convert_send_datagram_error(err))
.map_err(convert_send_datagram_error)
}
}

Expand All @@ -49,7 +49,7 @@ impl RecvDatagram for RecvDatagramHandler {
Poll::Ready(
ready!(self.datagrams.poll_next_unpin(cx))
.expect("self. datagrams never returns None")
.map_err(|e| convert_connection_error(e)),
.map_err(convert_connection_error),
)
}
}
Expand Down Expand Up @@ -90,9 +90,7 @@ fn convert_h3_error_to_datagram_error(
) -> h3_datagram::ConnectionErrorIncoming {
match error {
ConnectionErrorIncoming::ApplicationClose { error_code } => {
h3_datagram::ConnectionErrorIncoming::ApplicationClose {
error_code: error_code,
}
h3_datagram::ConnectionErrorIncoming::ApplicationClose { error_code }
}
ConnectionErrorIncoming::Timeout => h3_datagram::ConnectionErrorIncoming::Timeout,
ConnectionErrorIncoming::InternalError(err) => {
Expand Down
10 changes: 5 additions & 5 deletions h3-quinn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
) -> Poll<Result<Self::BidiStream, ConnectionErrorIncoming>> {
let (send, recv) = ready!(self.incoming_bi.poll_next_unpin(cx))
.expect("self.incoming_bi BoxStream never returns None")
.map_err(|e| convert_connection_error(e))?;
.map_err(convert_connection_error)?;
Poll::Ready(Ok(Self::BidiStream {
send: Self::SendStream::new(send),
recv: Self::RecvStream::new(recv),
Expand All @@ -93,7 +93,7 @@ where
) -> Poll<Result<Self::RecvStream, ConnectionErrorIncoming>> {
let recv = ready!(self.incoming_uni.poll_next_unpin(cx))
.expect("self.incoming_uni BoxStream never returns None")
.map_err(|e| convert_connection_error(e))?;
.map_err(convert_connection_error)?;
Poll::Ready(Ok(Self::RecvStream::new(recv)))
}

Expand Down Expand Up @@ -383,7 +383,7 @@ impl quic::RecvStream for RecvStream {
let (stream, chunk) = ready!(self.read_chunk_fut.poll(cx));
self.stream = Some(stream);
Poll::Ready(Ok(chunk
.map_err(|e| convert_read_error_to_stream_error(e))?
.map_err(convert_read_error_to_stream_error)?
.map(|c| c.bytes)))
}

Expand Down Expand Up @@ -450,7 +450,7 @@ where
{
fn new(stream: quinn::SendStream) -> SendStream<B> {
Self {
stream: stream,
stream,
writing: None,
}
}
Expand All @@ -466,7 +466,7 @@ where
while data.has_remaining() {
let stream = Pin::new(&mut self.stream);
let written = ready!(stream.poll_write(cx, data.chunk()))
.map_err(|err| convert_write_error_to_stream_error(err))?;
.map_err(convert_write_error_to_stream_error)?;
data.advance(written);
}
}
Expand Down
Loading
Loading