Skip to content

Commit

Permalink
Merge branch 'programatik29:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxFangX authored Oct 12, 2024
2 parents cf4b31f + 76bb031 commit 6d7964c
Show file tree
Hide file tree
Showing 13 changed files with 509 additions and 285 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2

updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: daily

- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
groups:
github-actions:
patterns:
- "*"
ignore:
- dependency-name: 'dtolnay/rust-toolchain'
191 changes: 191 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches: [master]
tags: ["*"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
audit:
name: Audit
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install `cargo-audit`
uses: taiki-e/install-action@v2
with:
tool: cargo-audit
- name: Run Audit
run: cargo audit -D warnings

rustfmt:
name: Rustfmt
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Rust Rustfmt
run: cargo fmt --check

clippy:
name: Clippy ${{ matrix.features.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
features:
- { features: "" }
- { name: "(`tls-rustls`)", features: --features tls-rustls }
- { name: "(`tls-rustls-no-provider`)", features: --features tls-rustls-no-provider }
- { name: "(`tls-openssl`)", features: --features tls-openssl, openssl: true }
- { name: "(`--all-features`)", features: --all-features, openssl: true }

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenSSL
if: matrix.features.openssl == true
run: sudo apt-get install pkg-config libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run Clippy
run: cargo clippy --all-targets ${{ matrix.features.features }} -- -D warnings

rustdoc:
name: Rustdoc ${{ matrix.rust.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
rust:
- { version: stable }
- { name: "with `cfg(docsrs)`", version: nightly, flags: --cfg=docsrs }

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenSSL
run: sudo apt-get install pkg-config libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust.version }}
- name: Run Rustdoc
env:
RUSTDOCFLAGS: -D warnings ${{ matrix.rust.flags }}
run: cargo doc --no-deps --document-private-items --lib --examples --all-features

build:
name: Build ${{ matrix.rust.name }} ${{ matrix.features.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
rust:
- { version: stable, msrv: false }
- { name: "MSRV", version: 1.66, msrv: true }
features:
- { features: "" }
- { name: "(`tls-rustls`)", features: --features tls-rustls }
- { name: "(`tls-rustls-no-provider`)", features: --features tls-rustls-no-provider }
- { name: "(`tls-openssl`)", features: --features tls-openssl, openssl: true }
- { name: "(`--all-features`)", features: --all-features, openssl: true }

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenSSL
if: matrix.features.openssl == true
run: sudo apt-get install pkg-config libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust.version }}
- name: Fix MSRV dependencies
if: matrix.rust.msrv == true
run: |
cargo update -p tokio --precise 1.38.1
cargo update -p tokio-util --precise 0.7.11
- name: Run Cargo Build
run: cargo build ${{ matrix.features.features }}

test:
name: Test ${{ matrix.features.name }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
features:
- { features: "" }
- { name: "(`tls-rustls`)", features: --features tls-rustls }
- { name: "(`rustls/ring`)", features: "--features tls-rustls-no-provider,rustls/ring" }
- { name: "(`tls-openssl`)", features: --features tls-openssl, openssl: true }
- { name: "(`--all-features`)", features: --all-features, openssl: true }

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenSSL
if: matrix.features.openssl == true
run: sudo apt-get install pkg-config libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run Cargo Tests
run: cargo test --all-targets ${{ matrix.features.features }} --no-fail-fast
- name: Rust Documentation Tests
run: cargo test --doc ${{ matrix.features.features }} --no-fail-fast

minimal-versions:
name: Minimal Versions ${{ matrix.features.name }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: minimal-versions

strategy:
fail-fast: false
matrix:
features:
- { features: "" }
- { name: "(`tls-rustls`)", features: --features tls-rustls }
- { name: "(`tls-rustls-no-provider`)", features: --features tls-rustls-no-provider }
- { name: "(`tls-openssl`)", features: --features tls-openssl, openssl: true }
- { name: "(`--all-features`)", features: --all-features, openssl: true }

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenSSL
if: matrix.features.openssl == true
run: |
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu focal-updates main"
sudo apt update
sudo apt-get install --allow-downgrades pkg-config libssl-dev=1.1.1f-1ubuntu2.23
- name: Install Nightly Rust
uses: dtolnay/rust-toolchain@nightly
- name: Update to Minimal Versions
run: cargo update -Zminimal-versions
- name: Install Rust
uses: dtolnay/rust-toolchain@1.66
- name: Run Cargo Build
run: cargo build ${{ matrix.features.features }}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog], and this project adheres to
[Semantic Versioning].

# Unreleased

- **changed**: Updated `tower` from `0.4` to `0.5`.
- **added**: Support reading PKCS\#1 and SEC1 private keys with Rustls.

# 0.7.1 (31. July 2024)

- **added**: Crate feature `tls-rustls-no-provider`, which enables no `rustls::crypto::CryptoProvider`.
- **fixed**: Correct minimum required `hyper-util` to `0.1.2`.

# 0.7.0 (16. July 2024)

- **fixed**: Graceful shutdown now stops accepting requests from existing connections.
- **changed**: Updated `rustls` from `0.21` to `0.23`.
- **changed**: Updated `tokio-rustls` from `0.24` to `0.26`.
- **changed**: Updated `hyper` from `1.0.1` to `1.4`.
- **changed**: Updated `http` from `1.0.0` to `1.1`.
- **added**: `rustls-pki-types` dependency for the `tls-rustls` feature.
- **changed**: Replaced usage of `rustls::Certificate` and `rustls::PrivateKey` with `rustls_pki_types::CertificateDer` and `rustls_pki_types::PrivateKeyDer`.
- **changed**: Updated `ServerConfig` initialization to remove `with_safe_defaults()` call.
- **changed**: Updated `ClientConfig` initialization in tests to use `dangerous()` instead of `with_safe_defaults()`.
- **changed**: Updated `ServerCertVerifier` implementation in tests to match new rustls API.
- **changed**: Minor version bumps for various dependencies including `rustls-pemfile`, `serial_test`, and `tower-http`.

# 0.6.0 (21. December 2023)

- **added**: functionalities in `tls_openssl`, that were added as they appeared to be only in `tls_rustls`:
Expand Down
42 changes: 22 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,48 @@ license = "MIT"
name = "axum-server"
readme = "README.md"
repository = "https://github.com/programatik29/axum-server"
version = "0.6.0"
version = "0.7.1"
rust-version = "1.66"

[features]
default = []
tls-rustls = ["arc-swap", "rustls", "rustls-pemfile", "tokio/fs", "tokio/time", "tokio-rustls"]
tls-openssl = ["arc-swap", "openssl", "tokio-openssl"]
tls-rustls = ["tls-rustls-no-provider", "rustls/aws-lc-rs"]
tls-rustls-no-provider = ["arc-swap", "rustls", "rustls-pemfile", "tokio/fs", "tokio/time", "tokio-rustls", "rustls-pki-types", "dep:pin-project-lite"]
tls-openssl = ["arc-swap", "openssl", "tokio-openssl", "dep:pin-project-lite"]

[dependencies]
bytes = "1"
futures-util = { version = "0.3", default-features = false, features = [
"alloc",
] }
http = "1.0.0"
http-body = "1.0.0"
hyper = { version = "1.0.1", features = ["http1", "http2", "server"] }
http = "1.1"
http-body = "1.0"
hyper = { version = "1.4", features = ["http1", "http2", "server"] }
tokio = { version = "1", features = ["macros", "net", "sync"] }
tower-service = "0.3"
http-body-util = "0.1.0"
hyper-util = { version = "0.1.1", features = ["server-auto", "tokio"] }
pin-project-lite = "0.2"
tower = { version = "0.4", features = ["util"] }
hyper-util = { version = "0.1.2", features = ["server-auto", "service", "tokio"] }

# optional dependencies
## rustls
arc-swap = { version = "1", optional = true }
rustls = { version = "0.21", features = ["dangerous_configuration"], optional = true }
rustls-pemfile = { version = "2.0.0", optional = true }
tokio-rustls = { version = "0.24", optional = true }
rustls = { version = "0.23", default-features = false, optional = true }
rustls-pki-types = { version = "1.7", optional = true }
rustls-pemfile = { version = "2.1", optional = true }
tokio-rustls = { version = "0.26", default-features = false, optional = true }

## openssl
openssl = { version = "0.10", optional = true }
tokio-openssl = { version = "0.6", optional = true }

## rustls or openssl
pin-project-lite = { version = "0.2", optional = true }

[dev-dependencies]
serial_test = "2.0"
serial_test = "3.1"
futures-util = { version = "0.3", default-features = false }
http-body-util = "0.1"
axum = "0.7"
hyper = { version = "1.0.1", features = ["full"] }
hyper = { version = "1.4", features = ["full"] }
tokio = { version = "1", features = ["full"] }
tower = { version = "0.4", features = ["util"] }
tower-http = { version = "0.5.0", features = ["add-extension"] }
tower = { version = "0.5", features = ["util"] }
tower-http = { version = "0.5", features = ["add-extension"] }

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can find more examples [here](/examples).

## Minimum Supported Rust Version

axum-server's MSRV is `1.63`.
axum-server's MSRV is `1.66`.

## Safety

Expand Down
2 changes: 2 additions & 0 deletions minimal-versions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/Cargo.lock
15 changes: 15 additions & 0 deletions minimal-versions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
edition = "2021"
name = "minimal-versions"
publish = false
version = "0.0.0"

[features]
tls-rustls = ["axum-server/tls-rustls"]
tls-rustls-no-provider = ["axum-server/tls-rustls-no-provider"]
tls-openssl = ["axum-server/tls-openssl"]

[dependencies]
axum-server = { path = ".." }
# `tower` v0.5.0 incorrectly only requires `tower-layer` v0.3.0
tower-layer = "0.3.3"
1 change: 1 addition & 0 deletions minimal-versions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! Testing minimal versions of dependencies.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! # Guide
//!
//! axum-server can [`serve`] items that implement [`MakeService`] with some additional [trait
//! bounds](crate::service::MakeServiceRef). Make services that are [created] using [`axum`]
//! bounds](crate::service::MakeService). Make services that are [created] using [`axum`]
//! complies with those trait bounds out of the box. Therefore it is more convenient to use this
//! crate with [`axum`].
//!
Expand All @@ -31,6 +31,7 @@
//! # Features
//!
//! * `tls-rustls` - activate [rustls] support.
//! * `tls-rustls-no-provider` - activate [rustls] support without a default provider.
//! * `tls-openssl` - activate [openssl] support.
//!
//! # Example
Expand Down Expand Up @@ -107,12 +108,12 @@ pub use self::{
server::{bind, from_tcp, Server},
};

#[cfg(feature = "tls-rustls")]
#[cfg(feature = "tls-rustls-no-provider")]
#[cfg_attr(docsrs, doc(cfg(feature = "tls-rustls")))]
pub mod tls_rustls;

#[doc(inline)]
#[cfg(feature = "tls-rustls")]
#[cfg(feature = "tls-rustls-no-provider")]
pub use self::tls_rustls::export::{bind_rustls, from_tcp_rustls};

#[cfg(feature = "tls-openssl")]
Expand Down
Loading

0 comments on commit 6d7964c

Please sign in to comment.