From c3dd837e6ccab7aefd305393e71dc4b56a35d15f Mon Sep 17 00:00:00 2001 From: WGOS Date: Fri, 23 Aug 2024 14:34:08 +0400 Subject: [PATCH 1/4] Build with layer4 module --- Caddyfile.sniproxy | 16 ++++++++++++++++ Dockerfile | 6 ++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Caddyfile.sniproxy diff --git a/Caddyfile.sniproxy b/Caddyfile.sniproxy new file mode 100644 index 0000000..fbb8c14 --- /dev/null +++ b/Caddyfile.sniproxy @@ -0,0 +1,16 @@ +{ + layer4 { + udp/:443 { + route { + proxy {l4.tls.server_name}:443 + } + } + + tcp/:443 { + @secure tls + route @secure { + proxy {l4.tls.server_name}:443 + } + } + } +} diff --git a/Dockerfile b/Dockerfile index 64115da..6913797 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ -ARG CADDY_VERSION=2.7 +ARG CADDY_VERSION=2.8 FROM caddy:${CADDY_VERSION}-builder AS builder RUN xcaddy build \ --with github.com/lucaslorentz/caddy-docker-proxy/v2 \ --with github.com/yroc92/postgres-storage \ - --with github.com/ss098/certmagic-s3 + --with github.com/ss098/certmagic-s3 \ + --with github.com/mholt/caddy-l4 FROM caddy:${CADDY_VERSION}-alpine COPY --from=builder /usr/bin/caddy /usr/bin/caddy +ADD ./Caddyfile.sniproxy /etc/caddy CMD ["caddy", "docker-proxy"] From d39182cdab7c956b04fb8b73b769b965557770bc Mon Sep 17 00:00:00 2001 From: WGOS Date: Fri, 23 Aug 2024 14:34:14 +0400 Subject: [PATCH 2/4] Add multiarch --- .github/workflows/build-docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 2b8cc60..2546508 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -41,4 +41,7 @@ jobs: context: . file: ./Dockerfile tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + platforms: | + linux/amd64 + linux/arm64 \ No newline at end of file From ddacdcb6ace0d58e9d81f8b46e5ebf01bd0dcbd8 Mon Sep 17 00:00:00 2001 From: WGOS Date: Fri, 23 Aug 2024 14:38:00 +0400 Subject: [PATCH 3/4] rename sniproxy caddyfile --- Dockerfile | 2 +- Caddyfile.sniproxy => sniproxy.Caddyfile | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Caddyfile.sniproxy => sniproxy.Caddyfile (100%) diff --git a/Dockerfile b/Dockerfile index 6913797..7f805fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ RUN xcaddy build \ FROM caddy:${CADDY_VERSION}-alpine COPY --from=builder /usr/bin/caddy /usr/bin/caddy -ADD ./Caddyfile.sniproxy /etc/caddy +ADD ./sniproxy.Caddyfile /etc/caddy CMD ["caddy", "docker-proxy"] diff --git a/Caddyfile.sniproxy b/sniproxy.Caddyfile similarity index 100% rename from Caddyfile.sniproxy rename to sniproxy.Caddyfile From 849c6d853aeae11b6bcfa70a532119ef5f1663c2 Mon Sep 17 00:00:00 2001 From: WGOS Date: Fri, 23 Aug 2024 14:47:17 +0400 Subject: [PATCH 4/4] Add http route --- sniproxy.Caddyfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sniproxy.Caddyfile b/sniproxy.Caddyfile index fbb8c14..a12d841 100644 --- a/sniproxy.Caddyfile +++ b/sniproxy.Caddyfile @@ -6,7 +6,12 @@ } } - tcp/:443 { + tcp/:443 tcp/:80 { + @insecure http + route @insecure { + proxy {l4.http.host}:80 + } + @secure tls route @secure { proxy {l4.tls.server_name}:443