feat: add control center, multiple relay nodes and P2P-first transport

This commit is contained in:
tongtong committed 2026-11-12 16:56:06 +08:00
1 parent 0988e9c363
commit 2abfb63da9
44 files changed
+3477 -67

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# Process management examples
Actual `ttstd.com` deployment and startup commands are documented in `docs/deployment-ttstd.md`.
Actual multi-node deployment is documented in [docs/cluster.md](../docs/cluster.md). Earlier single-node deployment and startup commands are in [docs/deployment-ttstd.md](../docs/deployment-ttstd.md).
Examples are templates, not installed automatically. Replace paths, domain, user and tokens before use. Public endpoints require HTTPS/WSS.
+23
View File
@@ -0,0 +1,23 @@
[Unit]
Description=ADS control center
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ads
WorkingDirectory=/opt/ads
EnvironmentFile=/etc/ads/server.env
Environment=GOMEMLIMIT=128MiB
ExecStart=/opt/ads/ads-server --listen 127.0.0.1:18081 --cluster-config /etc/ads/cluster.json
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
MemoryMax=256M
LimitNOFILE=8192
[Install]
WantedBy=multi-user.target
+25
View File
@@ -0,0 +1,25 @@
[Unit]
Description=ADS relay node
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ads
WorkingDirectory=/opt/ads
EnvironmentFile=/etc/ads/relay.env
Environment=GOMEMLIMIT=64MiB
ExecStart=/opt/ads/ads-relay --id relay-2 --listen 0.0.0.0:443 --capacity 128 --tls-cert /etc/ads/tls/fullchain.pem --tls-key /etc/ads/tls/privkey.pem
Restart=on-failure
RestartSec=3
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
MemoryMax=128M
LimitNOFILE=8192
[Install]
WantedBy=multi-user.target
+23
View File
@@ -0,0 +1,23 @@
[Unit]
Description=ADS relay node
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ads
WorkingDirectory=/opt/ads
EnvironmentFile=/etc/ads/relay.env
Environment=GOMEMLIMIT=64MiB
ExecStart=/opt/ads/ads-relay --id relay-1 --listen 127.0.0.1:18082 --capacity 128
Restart=on-failure
RestartSec=3
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
MemoryMax=128M
LimitNOFILE=8192
[Install]
WantedBy=multi-user.target
+8
View File
@@ -0,0 +1,8 @@
{
"nodes": [
{"id":"relay-1","url":"wss://ttstd.com/ads-relay-1","connect_address":"175.178.213.60:443","priority":10},
{"id":"relay-2","url":"wss://ttstd.com","connect_address":"47.242.112.133:443","priority":20}
],
"ice_servers": ["stun:47.242.112.133:3478", "stun:175.178.213.60:3478"],
"p2p_timeout_ms": 10000
}
+23
View File
@@ -0,0 +1,23 @@
# Include inside the existing ttstd.com HTTPS server block.
# URI prefix /ads-relay-1/ is stripped before forwarding to the relay.
location = /ads-relay-1 {
return 308 /ads-relay-1/;
}
location ^~ /ads-relay-1/ {
proxy_pass http://127.0.0.1:18082/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_request_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
# Do not cache authenticated requests or log tickets in query strings.
proxy_cache off;
proxy_hide_header Cache-Control;
add_header Cache-Control "no-store" always;
access_log off;
}