feat(xtream-proxy): rewrite proxy logic and update configuration format
Build and Push Docker Images / build-and-push (push) Successful in 39s

Refactor the xtream-proxy from a single-file Express-based server to a
modular Node.js application using native http/https modules. This
change introduces a major version bump to 2.0.0.

- Replace `hosts.txt` with `upstreams.json` for configuration
- Remove heavy dependencies (`express`, `ws`) in favor of native modules
- Implement new environment variables for proxy credentials and timeouts
- Add `src/` directory for modular code structure
- Add `docker-compose.example.yml` for easier deployment
- Update Dockerfile to support the new directory structure and environment
- Improve error handling and probe logic for upstream selection
This commit is contained in:
Bram committed 2026-11-03 22:36:41 +01:00
1 parent baaae2b850
commit 4bd2088edd
18 files changed
+1173 -1223

No files matched your search

+11 -8
View File
@@ -2,10 +2,9 @@ FROM node:22-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY package.json ./
COPY server.js ./
COPY src ./src/
RUN addgroup -g 1001 -S nodejs \
&& adduser -S nodejs -u 1001 \
@@ -15,11 +14,15 @@ USER nodejs
EXPOSE 8080
ENV LISTEN_PORT=8080
ENV HOSTS_FILE=/config/hosts.txt
ENV CHECK_INTERVAL_SEC=30
ENV PING_TIMEOUT_MS=8000
ENV HEALTH_PATH=/
ENV LISTEN_PORT=8080 \
CONFIG_FILE=/config/upstreams.json \
PROXY_USERNAME="" \
PROXY_PASSWORD="" \
PROBE_INTERVAL_SEC=30 \
PROBE_TIMEOUT_MS=8000 \
UPSTREAM_TIMEOUT_MS=15000 \
ALLOW_BUSY_FALLBACK=1 \
PROXY_INSECURE_TLS=0
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD node -e "require('http').get('http://127.0.0.1:'+(process.env.LISTEN_PORT||8080)+'/health',(r)=>{let d='';r.on('data',c=>d+=c);r.on('end',()=>{try{process.exit(JSON.parse(d).ok?0:1)}catch{process.exit(1)}})}).on('error',()=>process.exit(1))"