From 3777cb3fe602103fcaba6d6b145262f2812afafd Mon Sep 17 00:00:00 2001 From: ArcticLampyrid Date: Tue, 2 May 2023 02:41:34 +0800 Subject: [PATCH] first commit --- .gitattributes | 2 ++ Dockerfile | 27 +++++++++++++++++++++++++++ README.md | 6 ++++++ entrypoint.sh | 15 +++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 .gitattributes create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 entrypoint.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6fa400d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +* eol=lf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf9ea88 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM rust:latest AS builder +RUN apt update && apt install -y git +RUN update-ca-certificates +WORKDIR /tcp-relay-rust +RUN git clone https://github.com/cedric05/tcp-relay-rust . --no-checkout && git checkout 6de9bd191fa97aa73e8696ebefd5a50286eb2b25 +RUN cargo build --release + +FROM debian:bullseye-slim +ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn +ENV DEBIAN_FRONTEND=noninteractive +COPY --from=builder /tcp-relay-rust/target/release/tcp-relay-rust /tcp-relay-rust + +RUN apt update \ + && apt install -y curl gnupg \ + && curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg \ + && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ bullseye main" | tee /etc/apt/sources.list.d/cloudflare-client.list \ + && apt update \ + && apt install -y cloudflare-warp \ + && apt remove -y curl \ + && apt autoremove -y \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* + +ADD entrypoint.sh /entrypoint.sh +EXPOSE 40000/tcp +ENTRYPOINT ["/bin/bash"] +CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..51b93a1 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# docker-warp-socks5 +![Docker Pulls](https://img.shields.io/docker/pulls/qiqiworld/warp-socks5) + +```bash +docker run -d -p 40000:40000 qiqiworld/warp-socks5 +``` \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..825c47f --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +( +while ! warp-cli --accept-tos register; do + sleep 1 + >&2 echo "Awaiting warp-svc become online..." +done +warp-cli --accept-tos set-mode proxy +warp-cli --accept-tos set-proxy-port 40001 +warp-cli --accept-tos connect +warp-cli --accept-tos enable-always-on +/tcp-relay-rust 127.0.0.1:40001 0.0.0.0:40000 +) & + +exec warp-svc