add unstable build for testing

This commit is contained in:
Jun Kurihara 2023-12-15 16:50:49 +09:00
commit 78a5487293
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
4 changed files with 36 additions and 10 deletions

View file

@ -2,6 +2,7 @@ name: Release - Build and publish docker, and trigger package release
on: on:
push: push:
branches: branches:
- "feat/*"
- "develop" - "develop"
pull_request: pull_request:
types: [closed] types: [closed]
@ -135,6 +136,23 @@ jobs:
# platforms: linux/amd64 # platforms: linux/amd64
# labels: ${{ steps.meta.outputs.labels }} # labels: ${{ steps.meta.outputs.labels }}
- name: Unstable build and push from develop branch
if: ${{ (github.ref_name == 'feat/*') && (github.event_name == 'push') }}
uses: docker/build-push-action@v5
with:
context: .
build-args: ${{ matrix.build-args }}
push: true
tags: |
${{ env.GHCR }}/${{ env.GHCR_IMAGE_NAME }}:unstable${{ matrix.tags-suffix }}
${{ env.DH_REGISTRY_NAME }}:unstable${{ matrix.tags-suffix }}
build-contexts: ${{ matrix.build-contexts }}
file: ${{ matrix.dockerfile }}
cache-from: type=gha,scope=rpxy-unstable-${{ matrix.target }}
cache-to: type=gha,mode=max,scope=rpxy-unstable-${{ matrix.target }}
platforms: ${{ matrix.platforms }}
labels: ${{ steps.meta.outputs.labels }}
- name: Nightly build and push from develop branch - name: Nightly build and push from develop branch
if: ${{ (github.ref_name == 'develop') && (github.event_name == 'push') }} if: ${{ (github.ref_name == 'develop') && (github.event_name == 'push') }}
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5

View file

@ -12,6 +12,8 @@ pub const MAX_CONCURRENT_STREAMS: u32 = 64;
pub const CERTS_WATCH_DELAY_SECS: u32 = 60; pub const CERTS_WATCH_DELAY_SECS: u32 = 60;
pub const LOAD_CERTS_ONLY_WHEN_UPDATED: bool = true; pub const LOAD_CERTS_ONLY_WHEN_UPDATED: bool = true;
pub const CONNECTION_TIMEOUT_SEC: u64 = 30; // timeout to serve a connection. this might limits the max length of response.
// #[cfg(feature = "http3")] // #[cfg(feature = "http3")]
// pub const H3_RESPONSE_BUF_SIZE: usize = 65_536; // 64KB // pub const H3_RESPONSE_BUF_SIZE: usize = 65_536; // 64KB
// #[cfg(feature = "http3")] // #[cfg(feature = "http3")]

View file

@ -1,5 +1,6 @@
use super::proxy_main::Proxy; use super::proxy_main::Proxy;
use crate::{ use crate::{
constants::CONNECTION_TIMEOUT_SEC,
crypto::CryptoSource, crypto::CryptoSource,
error::*, error::*,
hyper_ext::body::{IncomingLike, RequestBody}, hyper_ext::body::{IncomingLike, RequestBody},
@ -10,7 +11,7 @@ use bytes::{Buf, Bytes};
use http::{Request, Response}; use http::{Request, Response};
use http_body_util::BodyExt; use http_body_util::BodyExt;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
use std::net::SocketAddr; use std::{net::SocketAddr, time::Duration};
#[cfg(feature = "http3-quinn")] #[cfg(feature = "http3-quinn")]
use h3::{quic::BidiStream, quic::Connection as ConnectionQuic, server::RequestStream}; use h3::{quic::BidiStream, quic::Connection as ConnectionQuic, server::RequestStream};
@ -70,8 +71,10 @@ where
let self_inner = self.clone(); let self_inner = self.clone();
let tls_server_name_inner = tls_server_name.clone(); let tls_server_name_inner = tls_server_name.clone();
self.globals.runtime_handle.spawn(async move { self.globals.runtime_handle.spawn(async move {
if let Err(e) = self_inner if let Err(e) = tokio::time::timeout(
.h3_serve_stream(req, stream, client_addr, tls_server_name_inner) Duration::from_secs(CONNECTION_TIMEOUT_SEC + 1), // just in case...
self_inner.h3_serve_stream(req, stream, client_addr, tls_server_name_inner),
)
.await .await
{ {
warn!("HTTP/3 error on serve stream: {}", e); warn!("HTTP/3 error on serve stream: {}", e);

View file

@ -1,6 +1,6 @@
use super::socket::bind_tcp_socket; use super::socket::bind_tcp_socket;
use crate::{ use crate::{
constants::TLS_HANDSHAKE_TIMEOUT_SEC, constants::{CONNECTION_TIMEOUT_SEC, TLS_HANDSHAKE_TIMEOUT_SEC},
crypto::{CryptoSource, ServerCrypto, SniServerCryptoMap}, crypto::{CryptoSource, ServerCrypto, SniServerCryptoMap},
error::*, error::*,
globals::Globals, globals::Globals,
@ -88,9 +88,11 @@ where
let message_handler_clone = self.message_handler.clone(); let message_handler_clone = self.message_handler.clone();
let tls_enabled = self.tls_enabled; let tls_enabled = self.tls_enabled;
let listening_on = self.listening_on; let listening_on = self.listening_on;
let timeout_sec = Duration::from_secs(CONNECTION_TIMEOUT_SEC + 1); // just in case...
self.globals.runtime_handle.clone().spawn(async move { self.globals.runtime_handle.clone().spawn(async move {
server_clone timeout(
.serve_connection_with_upgrades( timeout_sec + Duration::from_secs(1), // just in case...
server_clone.serve_connection_with_upgrades(
stream, stream,
service_fn(move |req: Request<Incoming>| { service_fn(move |req: Request<Incoming>| {
serve_request( serve_request(
@ -102,6 +104,7 @@ where
tls_server_name.clone(), tls_server_name.clone(),
) )
}), }),
),
) )
.await .await
.ok(); .ok();