Per address and minute: connects and forwarded signaling, so reconnecting doesn't reset a client's allowance. X-Forwarded-For only counts from PROXIES, checked with net.BlockList, with one warning when an uncovered peer sends it. Plain requests get timeouts and a closing 404, silent connections go after 30 s and all queues together share a budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
3.0 KiB
YAML
80 lines
3.0 KiB
YAML
# HellCon's own servers: a tracker behind Caddy and a STUN server. Neither is needed, the client works
|
|
# with any WebTorrent tracker and STUN server. Copy .env.example to .env and set ORIGINS there, then
|
|
# `docker compose up -d --build`. Caddy, in its own compose
|
|
# project, proxies to the tracker over its network (CADDY_NETWORK, "caddy" unless set):
|
|
#
|
|
# tracker.example.org {
|
|
# reverse_proxy hellcon-tracker:8000
|
|
# }
|
|
|
|
name: hellcon
|
|
|
|
x-logging: &logging
|
|
driver: json-file
|
|
options: { max-size: 10m, max-file: '2' }
|
|
|
|
services:
|
|
tracker:
|
|
build: .
|
|
environment:
|
|
ORIGINS: ${ORIGINS:?set ORIGINS in .env to where HellCon is served from}
|
|
# Whose X-Forwarded-For the tracker believes, addresses or CIDRs, see clientIp in tracker.mjs.
|
|
# Caddy reaches it over the shared network, whose subnet is Docker's choice, so the default
|
|
# trusts every private range: nothing public should reach the tracker besides Caddy. Set
|
|
# PROXIES in .env to narrow it, e.g. to your Caddy's address in that network. If it doesn't
|
|
# cover Caddy's address, all clients count as Caddy's and share its limits, nearly all are refused.
|
|
PROXIES: ${PROXIES:-172.16.0.0/12 192.168.0.0/16 10.0.0.0/8 fd00::/8}
|
|
networks:
|
|
caddy:
|
|
aliases: [hellcon-tracker]
|
|
init: true
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
cpus: 0.5
|
|
mem_limit: 96m
|
|
memswap_limit: 96m
|
|
pids_limit: 32
|
|
logging: *logging
|
|
restart: unless-stopped
|
|
|
|
# On the host network, so Docker's NAT can't change the source address clients get back. UDP 3478
|
|
# on IPv4 and IPv6, stun.example.org needs an A and an AAAA record. Browsers hide their own addresses,
|
|
# only STUN reports an IPv6 one, and mobile networks behind carrier NAT often only connect over IPv6.
|
|
coturn:
|
|
image: coturn/coturn:4.18.0
|
|
network_mode: host
|
|
# Off by default since 4.18, their --no- options are gone: DTLS, the admin CLI, the software
|
|
# attribute, the RFC 3489 MAPPED-ADDRESS and logging each binding request. The image has no config
|
|
# file, -n would only fail with "Unknown argument".
|
|
command:
|
|
- --log-file=stdout
|
|
- --listening-ip=0.0.0.0
|
|
- --listening-ip=::
|
|
- --listening-port=3478
|
|
- --stun-only
|
|
- --no-tcp
|
|
- --no-tls
|
|
# One per CPU core otherwise, more than cpus allows.
|
|
- --relay-threads=1
|
|
# The pid file lands in /var/tmp, coturn can't write /var/run. The image declares /var/lib/coturn
|
|
# a volume, the tmpfs keeps an anonymous one from piling up.
|
|
tmpfs: [/var/lib/coturn, /var/tmp]
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
# turnserver has it as file capability, without it the kernel refuses to run it. 3478 doesn't need
|
|
# it, no-new-privileges keeps it from being granted.
|
|
cap_add: [NET_BIND_SERVICE]
|
|
security_opt: [no-new-privileges:true]
|
|
cpus: 1
|
|
mem_limit: 128m
|
|
memswap_limit: 128m
|
|
pids_limit: 64
|
|
logging: *logging
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|
|
name: ${CADDY_NETWORK:-caddy}
|