Commit graph

28 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
Toby
97a341690a chore: log server address on connect, log realm peer address candidates 2026-05-09 13:24:13 -07:00
tobyxdd
44235d3de9 feat: quic-go v0.54.0 2025-09-13 16:17:59 -07:00
Haruue
7ac8d87dda
test: fix integration_tests for trafficlogger 2024-11-08 16:03:48 +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
feacb1f85e feat(core): server RequestHook support 2024-06-15 14:15:56 -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
89a99a08bf fix: flaky tests caused by occasionally closing channel multiple times 2024-03-23 11:17:51 -07: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
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
Toby
6172f2ac53 feat(wip): test reworks (need to add back traffic logger tests) 2023-07-26 15:51:48 -07:00
Toby
dd836b4496 feat(wip): test reworks 2023-07-26 13:48:08 -07:00
Toby
55fb903192 feat(wip): test reworks 2023-07-25 16:42:37 -07:00
Toby
cbedb27f0f feat(wip): udp rework client side 2023-07-24 16:32:25 -07:00
Toby
a2fbcc6507 feat(wip): udp rework server side 2023-07-23 11:42:52 -07:00
tobyxdd
4334d8afb8 feat: traffic logger with disconnect 2023-06-08 20:55:08 -07:00
tobyxdd
5b54edd09a feat: traffic logger (wip, disconnect not done) 2023-06-07 22:37:09 -07:00
tobyxdd
5586303825 feat: bump quic-go version to v0.35.1 (mod wip), change client config format for sni 2023-06-02 16:51:17 -07:00
tobyxdd
9f54aade8f hysteria 2 prototype first public release 2023-05-25 20:24:24 -07:00