feat: add Minecraft proxy and refresh dependencies

This commit is contained in:
Loki 2026-10-16 23:04:41 +02:00
parent a4d0880a0a
commit cfaad47948
Signed by: boba
GPG key ID: 6CDE87BC9A778D97
47 changed files with 2671 additions and 1005 deletions

View file

@ -0,0 +1,56 @@
# Minecraft Java edge configuration for deploy/docker-compose.yml.
whitelist = ["127.0.0.1", "::1"]
[bind]
address = "0.0.0.0"
port = 25565
[backend]
# Docker host address; expose this backend port only to trusted Rampart nodes.
upstreams = ["host.docker.internal:25566"]
[protocol.minecraft]
enabled = true
max_frame_bytes = 8192
timeout_secs = 5
send_proxy_protocol = false
[workers]
count = 4
[limits]
handshake_timeout_secs = 5
max_connections_per_ip = 10
rate_limit_pps = 5.0
rate_limit_burst = 10.0
[ban]
ban_duration_secs = 3600
[store]
redis_url = "redis://redis:6379/0"
blacklist_cache_ttl_secs = 300
clickhouse_url = ""
[xdp]
enabled = false
interface = "eth0"
[logging]
level = "info"
format = "text"
[metrics]
enabled = true
port = 9090
[pow]
enabled = false
difficulty = 4
# Enable only when a trusted upstream TCP proxy sends PROXY protocol v2.
[proxy_protocol]
ingress_enabled = false
trusted_cidrs = []
ingress_timeout_ms = 750
max_header_bytes = 512

View file

@ -0,0 +1,42 @@
# Generic HTTP/1.1 edge configuration.
whitelist = ["127.0.0.1", "::1"]
[bind]
address = "0.0.0.0"
port = 25565
[backend]
upstreams = ["127.0.0.1:25566"]
[workers]
count = 4
[limits]
handshake_timeout_secs = 5
max_connections_per_ip = 10
rate_limit_pps = 5.0
rate_limit_burst = 10.0
[ban]
ban_duration_secs = 3600
[store]
redis_url = ""
blacklist_cache_ttl_secs = 300
clickhouse_url = ""
[xdp]
enabled = false
interface = "eth0"
[logging]
level = "info"
format = "text"
[metrics]
enabled = true
port = 9090
[pow]
enabled = false
difficulty = 4

View file

@ -1,13 +1,23 @@
# Rampart edge — единый конфиг (схема: src/config/sections.rs)
# Rampart edge для Minecraft Java (схема: src/config/sections/)
# whitelist — корневое поле, поэтому оно задаётся до любых TOML-секций.
whitelist = ["127.0.0.1", "::1"]
[bind]
address = "0.0.0.0"
port = 25565
[backend]
# Generic TCP-бэкенды за edge-нодой (addr:port)
# Адрес Paper за доверенным прокси; закрой этот порт firewall-ом от интернета.
upstreams = ["127.0.0.1:25566"]
[protocol.minecraft]
enabled = true
max_frame_bytes = 8192
timeout_secs = 5
# Outbound: включай вместе с proxies.proxy-protocol: true на Paper и firewall,
# разрешающим backend-порт только от этого Rampart.
send_proxy_protocol = false
[workers]
count = 4
@ -41,4 +51,10 @@ port = 9090
enabled = false
difficulty = 4
whitelist = ["127.0.0.1", "::1"]
# Inbound: включай только если входящий TCP-прокси передаёт PROXY v2.
# Укажи точные адреса/CIDR этого прокси; не добавляй сюда адреса игроков.
[proxy_protocol]
ingress_enabled = false
trusted_cidrs = []
ingress_timeout_ms = 750
max_header_bytes = 512

View file

@ -44,11 +44,13 @@ services:
dockerfile: deploy/docker/Dockerfile.edge
ports:
- "25565:25565"
- "9090:9090"
- "127.0.0.1:9090:9090"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
RAMPART_CONFIG: /etc/rampart/config.toml
volumes:
- ./config/edge.toml:/etc/rampart/config.toml:ro
- ./config/edge-docker.toml:/etc/rampart/config.toml:ro
depends_on:
redis:
condition: service_healthy

View file

@ -13,7 +13,7 @@ RUN if command -v clang >/dev/null; then \
clang -O2 -g -target bpf -c xdp/core/universal_filter.c -o /app/target/xdp/universal_filter.o; \
fi
RUN cargo build --release --features xdp --bin rampart && \
RUN cargo build --release --features xdp,protocol-minecraft --bin rampart && \
cp target/release/rampart /app/rampart && \
strip /app/rampart