mirror of
https://github.com/go-gost/gost.git
synced 2026-10-08 03:55:45 +00:00
tests/e2e: concurrent UDP endpoints must share a reverse tunnel intact
Covers gost#911 at the wire level: four UDP source sockets send through one RUDP reverse tunnel bound on a relay server, and every datagram must come back byte-identical to its own endpoint. A frame torn by an interleaved writer shows up twice — as a corrupted payload, and as the torn frame leaving half a header in the stream, which the far end reads as "unexpected EOF" and answers by rebuilding the whole tunnel. So the suite asserts both: no endpoint sees a corrupted datagram, and no endpoint sees a receive gap long enough to be a teardown and rebind. Verified against a binary built before the fix (4 endpoints, 35% loss, 1.4s gaps, suite fails) and after it (0% loss, no corruption, 0.2s gaps, passes).
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
# Internal client behind NAT for gost#911: a UDP forward service that sends all
|
||||
# traffic to the port the host bound through the reverse tunnel.
|
||||
#
|
||||
# The forwarder target is gost-server:8432 — that is where the reverse tunnel is
|
||||
# actually bound (the host's rudp listener asked the relay server to bind it, so
|
||||
# the port lives on the relay server, not on the host). Datagrams go there and
|
||||
# are carried back to the internal host over the one shared tunnel stream.
|
||||
services:
|
||||
- name: service-0
|
||||
addr: ":8432"
|
||||
handler:
|
||||
type: udp
|
||||
listener:
|
||||
type: udp
|
||||
metadata:
|
||||
keepalive: true
|
||||
ttl: 5m
|
||||
forwarder:
|
||||
nodes:
|
||||
- name: tunnel
|
||||
addr: gost-server:8432
|
||||
|
||||
chains:
|
||||
- name: chain-0
|
||||
hops:
|
||||
- nodes:
|
||||
- addr: gost-server:8430
|
||||
connector:
|
||||
type: relay
|
||||
dialer:
|
||||
type: tcp
|
||||
|
||||
log:
|
||||
level: debug
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# Internal host behind NAT for gost#911: binds a reverse UDP tunnel (rudp)
|
||||
# through the relay server and forwards it to the local UDP echo server.
|
||||
#
|
||||
# The rudp listener opens no local port — it binds the UDP port remotely through
|
||||
# the chain. service-1 is a dummy TCP listener purely so the e2e harness has a
|
||||
# stable port to wait on for container readiness.
|
||||
services:
|
||||
- name: service-0
|
||||
addr: "0.0.0.0:8432"
|
||||
handler:
|
||||
type: rudp
|
||||
listener:
|
||||
type: rudp
|
||||
chain: chain-0
|
||||
metadata:
|
||||
ttl: 5m
|
||||
forwarder:
|
||||
nodes:
|
||||
- name: echo
|
||||
addr: udp-echo:5679
|
||||
|
||||
# Dummy TCP service on a fixed port: the rudp reverse-tunnel listener binds
|
||||
# remotely through the chain and opens no local port, so this gives the e2e
|
||||
# harness a stable port to wait on. Nothing ever targets it — the harness
|
||||
# only opens and immediately closes the connection.
|
||||
- name: service-1
|
||||
addr: ":8431"
|
||||
handler:
|
||||
type: tcp
|
||||
listener:
|
||||
type: tcp
|
||||
|
||||
chains:
|
||||
- name: chain-0
|
||||
hops:
|
||||
- nodes:
|
||||
- addr: gost-server:8430
|
||||
connector:
|
||||
type: relay
|
||||
dialer:
|
||||
type: tcp
|
||||
|
||||
log:
|
||||
level: debug
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
# Public-facing relay server for gost#911: allows UDP BIND so an internal host
|
||||
# can bind a reverse UDP tunnel through it. The host asks the server to bind
|
||||
# the tunnel's UDP port, so that port lives here — on the relay server, not on
|
||||
# the host behind NAT.
|
||||
services:
|
||||
- name: service-0
|
||||
addr: ":8430"
|
||||
handler:
|
||||
type: relay
|
||||
metadata:
|
||||
bind: true
|
||||
listener:
|
||||
type: tcp
|
||||
|
||||
log:
|
||||
level: debug
|
||||
Reference in New Issue
Block a user