fix: bugfix when switching features from http3-quinn to http3-s2n

This commit is contained in:
Jun Kurihara 2023-07-30 17:53:10 +09:00
commit e751bd34ac
5 changed files with 17 additions and 12 deletions

View file

@ -15,6 +15,10 @@ WORKDIR /tmp
COPY . /tmp/ COPY . /tmp/
ARG TARGETARCH ARG TARGETARCH
ARG CARGO_FEATURES
ENV CARGO_FEATURES ${CARGO_FEATURES}
ARG ADDITIONAL_DEPS
ENV ADDITIONAL_DEPS ${ADDITIONAL_DEPS}
RUN if [ $TARGETARCH = "amd64" ]; then \ RUN if [ $TARGETARCH = "amd64" ]; then \
echo "x86_64" > /arch; \ echo "x86_64" > /arch; \
@ -29,13 +33,13 @@ ENV RUSTFLAGS "-C link-arg=-s"
RUN update-ca-certificates 2> /dev/null || true RUN update-ca-certificates 2> /dev/null || true
RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \ RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS ${ADDITIONAL_DEPS} && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \ curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \
export PATH="$HOME/.cargo/bin:$PATH" && \ export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Install toolchain" && \ echo "Install toolchain" && \
rustup target add $(cat /arch)-unknown-linux-gnu &&\ rustup target add $(cat /arch)-unknown-linux-gnu &&\
echo "Building rpxy from source" && \ echo "Building rpxy from source" && \
cargo build --release --target=$(cat /arch)-unknown-linux-gnu && \ cargo build --release --target=$(cat /arch)-unknown-linux-gnu ${CARGO_FEATURES} && \
strip --strip-all /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy &&\ strip --strip-all /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy &&\
cp /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy /tmp/target/release/rpxy cp /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy /tmp/target/release/rpxy

View file

@ -10,10 +10,13 @@ services:
- 127.0.0.1:8443:8443 - 127.0.0.1:8443:8443
build: build:
context: ../ context: ../
args:
- "CARGO_FEATURES=--no-default-features --features http3-s2n"
- "ADDITIONAL_DEPS=pkg-config libssl-dev cmake libclang1 gcc g++"
dockerfile: ./docker/Dockerfile dockerfile: ./docker/Dockerfile
platforms: # Choose your platforms platforms: # Choose your platforms
- "linux/amd64" # - "linux/amd64"
# - "linux/arm64" - "linux/arm64"
environment: environment:
- LOG_LEVEL=debug - LOG_LEVEL=debug
- LOG_TO_FILE=true - LOG_TO_FILE=true

View file

@ -12,8 +12,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]
default = ["http3"] default = ["http3-quinn"]
http3 = ["rpxy-lib/http3"]
http3-quinn = ["rpxy-lib/http3-quinn"] http3-quinn = ["rpxy-lib/http3-quinn"]
http3-s2n = ["rpxy-lib/http3-s2n"] http3-s2n = ["rpxy-lib/http3-s2n"]

View file

@ -21,7 +21,7 @@ pub struct ConfigToml {
pub experimental: Option<Experimental>, pub experimental: Option<Experimental>,
} }
#[cfg(feature = "http3")] #[cfg(any(feature = "http3-quinn", feature = "http3-s2n"))]
#[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)] #[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)]
pub struct Http3Option { pub struct Http3Option {
pub alt_svc_max_age: Option<u32>, pub alt_svc_max_age: Option<u32>,
@ -34,7 +34,7 @@ pub struct Http3Option {
#[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)] #[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)]
pub struct Experimental { pub struct Experimental {
#[cfg(feature = "http3")] #[cfg(any(feature = "http3-quinn", feature = "http3-s2n"))]
pub h3: Option<Http3Option>, pub h3: Option<Http3Option>,
pub ignore_sni_consistency: Option<bool>, pub ignore_sni_consistency: Option<bool>,
} }
@ -128,7 +128,7 @@ impl TryInto<ProxyConfig> for &ConfigToml {
// experimental // experimental
if let Some(exp) = &self.experimental { if let Some(exp) = &self.experimental {
#[cfg(feature = "http3")] #[cfg(any(feature = "http3-quinn", feature = "http3-s2n"))]
{ {
if let Some(h3option) = &exp.h3 { if let Some(h3option) = &exp.h3 {
proxy_config.http3 = true; proxy_config.http3 = true;

View file

@ -12,8 +12,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]
default = ["http3", "sticky-cookie"] default = ["http3-quinn", "sticky-cookie"]
http3 = ["http3-s2n"]
http3-quinn = ["quinn", "h3", "h3-quinn", "socket2"] http3-quinn = ["quinn", "h3", "h3-quinn", "socket2"]
http3-s2n = ["h3", "s2n-quic", "s2n-quic-rustls", "s2n-quic-h3"] http3-s2n = ["h3", "s2n-quic", "s2n-quic-rustls", "s2n-quic-h3"]
sticky-cookie = ["base64", "sha2", "chrono"] sticky-cookie = ["base64", "sha2", "chrono"]
@ -67,7 +66,7 @@ h3 = { path = "../h3/h3/", optional = true }
h3-quinn = { path = "../h3-quinn/", optional = true } # Tentative to support rustls-0.21 h3-quinn = { path = "../h3-quinn/", optional = true } # Tentative to support rustls-0.21
# for UDP socket wit SO_REUSEADDR when h3 with quinn # for UDP socket wit SO_REUSEADDR when h3 with quinn
socket2 = { version = "0.5.3", features = ["all"], optional = true } socket2 = { version = "0.5.3", features = ["all"], optional = true }
s2n-quic = { path = "../s2n-quic/quic/s2n-quic/", features = [ s2n-quic = { path = "../s2n-quic/quic/s2n-quic/", default-features = false, features = [
"provider-tls-rustls", "provider-tls-rustls",
], optional = true } ], optional = true }
s2n-quic-h3 = { path = "../s2n-quic/quic/s2n-quic-h3/", optional = true } s2n-quic-h3 = { path = "../s2n-quic/quic/s2n-quic-h3/", optional = true }