Commit graph

63 commits

Author SHA1 Message Date
Toby
2412f23646
Merge commit from fork
The UDP relay treated the destination address as packet-scoped while
applying ACL/outbound policy only once when a new session was created.
After an authenticated client opened a UDP session using a permitted
first destination, later packets carrying a different Addr in the same
SessionID were written via the established outbound socket without
re-checking policy, allowing the client to reach destinations that ACL
should reject — including localhost and RFC1918 from the server's
network perspective. See GHSA-vgrc-hq28-p3xp.

Add a no-I/O CheckUDP method to the Outbound / PluggableOutbound
chain. The UDP session entry now consults CheckUDP for every packet
whose destination differs from the session's first one, dropping
rejected packets before WriteTo. Decisions are cached per destination
within the session (bounded at 256 entries with simple eviction) so
steady-state cost is one map lookup per packet and no extra sockets
or dials. CheckUDP propagates through the existing chain:

  - aclEngine routes through the matched outbound's CheckUDP, with
    aclRejectOutbound returning the rejection error.
  - directOutbound / socks5Outbound / speedtestHandler return nil.
  - httpOutbound returns errHTTPUDPNotSupported.
  - Resolvers (system / dot / doh) run resolve() then forward to
    Next.CheckUDP so IP-based ACL rules keep matching.

Regression tests in core/internal/integration_tests/udp_acl_test.go
use an in-package stub Outbound to assert that a rejected destination
is not relayed after the session is opened on a permitted one, and
that multi-destination sessions over permitted addresses still work.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 14:09:41 -07:00
白日梦主义
d6f24e13d7
Merge commit from fork
Signed-off-by: Cherrling <me@cherr.cc>
2026-05-21 13:11:40 -07:00
Toby
97a341690a chore: log server address on connect, log realm peer address candidates 2026-05-09 13:24:13 -07:00
Toby
93f68c526b
feat: Hysteria Realms (#1560)
* feat(wip): hysteria realms

* feat: port prediction for punching symmetric NAT

* feat: add "cert" subcommand for easy self signed cert generation

* refactor: update address scheme from "hysteria2+realm" to just "realm"

* fix: give up on realm register fatal errors

* chore: update formatting (gofumpt)

* perf: realm proxy UDP methods on PunchPacketConn so quic-go and obfs keep DF/PMTU and buffer sizing

* feat: add support for local UDP source port config in realm addresses

* doc: README for realm pkg
2026-05-08 14:16:21 -07:00
Toby
14500fdb40 ci: test workflow 2026-03-29 14:52:14 -07:00
Toby
b3f2193f10 feat: add configurable congestion modes and BBR profiles 2026-03-28 13:11:17 -07:00
Toby
61c75a260f fix: BBR scale window for datagram size 2026-03-27 18:13:57 -07:00
Hari
275bcccaa4
feat: quic-go v0.59.0 2026-02-17 17:37:20 +08:00
tobyxdd
f68d036bff feat: migrate to new monotime congestion interface 2026-01-11 11:06:12 -08:00
tobyxdd
4bf55a99ed fix: logic issues with BBR impl 2025-12-29 19:24:30 -08:00
tobyxdd
44235d3de9 feat: quic-go v0.54.0 2025-09-13 16:17:59 -07:00
dropbigfish
5239a23aee chore: fix function name in comment
Signed-off-by: dropbigfish <fillfish@foxmail.com>
2025-04-20 12:06:13 +08:00
Haruue
7ac8d87dda
test: fix integration_tests for trafficlogger 2024-11-08 16:03:48 +09:00
Haruue
0681638568
feat(trafficlogger): dump streams stats 2024-11-08 15:28:50 +09:00
Toby
947701897b fix: TestClientServerHookUDP 2024-10-04 10:29:25 -07:00
Toby
c78dbb38a1 feat: add a Check method to let the implementation decide whether to hook a request 2024-06-18 21:46:25 -07:00
Toby
2c62a1a1b4 fix: do not require client-side fast open 2024-06-16 13:26:02 -07:00
Toby
506d8e01b8 Merge branch 'master' into wip-reqhook 2024-06-16 13:10:23 -07:00
Toby
a852febc1f fix: incorrect speed conversion base 2024-06-15 15:42:39 -07:00
Toby
feacb1f85e feat(core): server RequestHook support 2024-06-15 14:15:56 -07:00
Toby
09b08fa494 fix: try to fix maybeAppLimited 2 2024-05-20 14:19:04 -07:00
Toby
cd512ce1c6 chore: various tweaks 2024-05-19 11:46:52 -07:00
Toby
5b0ab76d44 Merge branch 'master' into wip-rbq 2024-05-18 15:59:56 -07:00
Toby
e0e75c4630 wip: BBR experimental changes 2024-05-18 15:01:16 -07:00
Haruue
0c198abd2e
fix: mod name major version suffix v2
ref: https://go.dev/ref/mod#major-version-suffixes
2024-05-18 11:28:47 +08:00
Toby
9d4b3e608a chore: small changes to TrafficLogger function names & update all mocks to mockery v2.43.0 2024-05-11 13:55:55 -07:00
Haruue
6a34a9e7a0
test: fix unit tests
mock files regenerated with mockery v2.43.0
2024-05-11 15:08:44 +08:00
Toby
b79c43171a fix: update in quic-go (http3) broke UDP functionality 2024-04-28 20:22:11 -07:00
Toby
2408301c98 feat: pacer code improvements 2024-04-14 15:07:43 -07:00
Toby
89a99a08bf fix: flaky tests caused by occasionally closing channel multiple times 2024-03-23 11:17:51 -07:00
Haruue
9c51995cc4
fix: cwnd undersize in extremely-low rtt scenarios
Prevent the congestion window from falling below the size of single
packet in scenarios with extremely low RTT, which previously led to
transmission stalls.
2024-03-10 23:06:38 +08:00
Toby
0a77ce4d64 feat: client handshake info 2023-11-18 16:19:08 -08:00
Toby
c62dc51017 feat: quic-go v0.40.0 2023-11-12 15:42:46 -08:00
Toby
131306b72b fix: tweak 2023-10-19 19:30:45 -07:00
tako
d513ae115b fix: Fix slice out-of-bounds issues in ParseUDPMessage. 2023-10-20 09:54:41 +08:00
Toby
994cef32ea feat: increase brutal congestion window multiplier to 2 2023-10-10 19:56:17 -07:00
Toby
7c46e845a6 fix: BBR memory leak 2023-10-10 19:54:43 -07:00
Toby
5597b482a9 feat: add RTT to brutal sender debug 2023-10-06 20:26:51 -07:00
Toby
89429598bf fix: BBR bandwidth estimation edge case 2023-10-06 18:27:30 -07:00
Toby
86c8b3845f feat: HYSTERIA_BRUTAL_DEBUG 2023-10-05 15:38:45 -07:00
Toby
6f1807a376 feat: brutal cc fixes & tweaks 2023-10-05 13:53:59 -07:00
Toby
844e94d6ca fix: reworked BBR to replace the broken old one 2023-09-29 22:18:24 -07:00
Toby
31dca9476d feat: bump quic-go (GSO fix) 2023-09-15 12:57:55 -07:00
Toby
cc0d0181e1 feat: ignoreClientBandwidth 2023-08-07 16:34:35 -07:00
Toby
45c3fc54bd feat: BBR 2023-08-04 17:29:15 -07:00
Toby
02fca02ddc feat: update to quic-go v0.37.2 & enable PMTUD on macOS 2023-08-04 15:34:05 -07:00
Toby
c64b36b8f4 feat: update to quic-go v0.37.1, module renamed to github.com/apernet/quic-go 2023-07-31 17:27:23 -07:00
Toby
ddc7fa8456 feat: traffic logger tests 2023-07-26 21:30:48 -07:00
Toby
1629f0fc8e feat: add 2 new shutdown tests 2023-07-26 19:12:30 -07:00
Toby
37385f623f feat(wip): more test reworks 2023-07-26 16:35:25 -07:00