Commit graph

55 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
prudhvi
0e2b37ad6c
Reuse 32KB buffers in copyBufferLog with sync.Pool (#1572)
* Bolt: Reuse 32KB buffers in copyBufferLog with sync.Pool

Delete .jules directory

* Add benchmark test for copyBufferLog function
2026-05-15 22:19:36 -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
697203f49d feat: omit datagram TP 2026-04-25 17:07:05 -07:00
Toby
6476d21c59
feat: client & server use quic.Transport (#1550) 2026-04-21 14:02:37 -07:00
Toby
5fd6d4d887 feat: server side UDP port range listening (nftables/iptables) 2026-03-29 11:47:09 -07:00
Toby
b3f2193f10 feat: add configurable congestion modes and BBR profiles 2026-03-28 13:11:17 -07:00
Hari
6da70e80aa
fix: consume TCP request frame type with StreamDispatcher 2026-02-18 10:18:52 +08:00
Hari
275bcccaa4
feat: quic-go v0.59.0 2026-02-17 17:37:20 +08:00
tobyxdd
44235d3de9 feat: quic-go v0.54.0 2025-09-13 16:17:59 -07:00
tobyxdd
36370ffbbb fix: race in udpSessionManager cleanup & update code formatting (gofumpt) 2025-09-11 20:14:41 -07:00
shadow
6cb18ff5ad Add optional mTLS support for client & server 2025-08-27 12:17:24 +08:00
Toby
b5ddcb5bc4 feat: quic-go v0.52.0 2025-06-07 11:59:30 -07:00
Toby
3e8c20518d chore: minor code tweaks 2024-11-08 14:29:50 -08:00
Haruue
0681638568
feat(trafficlogger): dump streams stats 2024-11-08 15:28:50 +09:00
Haruue
1001b2b1ad
chore: fix comments 2024-10-05 10:23:43 +08:00
Toby
b3116c6268 feat: update TestUDPSessionManager to cover the fragmented msg hook 2024-10-04 10:47:41 -07:00
Haruue
4e2f138008
chore: fix comments 2024-10-04 16:57:32 +08:00
Haruue
dc023ae13a
fix: udpSessionManager.mutex reentrant by cleanup 2024-10-04 16:33:41 +08:00
Haruue
931fc2fdb2
chore: replace guard routine with CloseWithErr() 2024-10-04 11:27:36 +08:00
Haruue
4ecbd57294
fix: quic sniff not work if udp msg fragmentated 2024-09-22 22:53:47 +08:00
Haruue
604132f8d0
fix(test): signature mismatch of udpIO.Hook
ref: #1125
2024-08-04 14:38:36 +08: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
Haruue
ba9b3cdebb
refactor(online): track count instead of raddr 2024-05-11 11:23:20 +08:00
HynoR
88eef7617f refactor getOnline feature 2024-05-09 14:05:45 +08:00
Toby
b79c43171a fix: update in quic-go (http3) broke UDP functionality 2024-04-28 20:22:11 -07:00
Toby
00813c4622 feat: quic-go v0.43.0 2024-04-27 13:04:51 -07:00
Toby
e648321b96 feat: quic-go v0.41.0 2024-01-21 16:58:22 -08:00
Toby
c62dc51017 feat: quic-go v0.40.0 2023-11-12 15:42:46 -08:00
Toby
cc0d0181e1 feat: ignoreClientBandwidth 2023-08-07 16:34:35 -07:00
Toby
3b4af8035b chore: some code fixes 2023-08-04 17:48:07 -07:00
Toby
45c3fc54bd feat: BBR 2023-08-04 17:29:15 -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
d4e3833641 feat: rework udp stuff 2023-07-27 18:51:33 -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
1c7cb23389 feat(wip): test reworks 2023-07-25 16:11:11 -07:00
Toby
27460960ab feat(wip): udp rework client side tests & server tests update 2023-07-24 20:12:48 -07:00
Toby
cbedb27f0f feat(wip): udp rework client side 2023-07-24 16:32:25 -07:00
Toby
f142a24047 chore: more naming adjustments 2023-07-23 12:27:27 -07:00
Toby
1f499f07c7 chore: naming adjustments 2023-07-23 12:10:10 -07:00
Toby
a2fbcc6507 feat(wip): udp rework server side 2023-07-23 11:42:52 -07:00
tobyxdd
7e177a22f7 feat: port forwarding 2023-07-02 15:40:16 -07:00
tobyxdd
cc8a889503 feat: quic close error code 2023-06-27 22:39:16 -07:00
tobyxdd
bacc8ff5ed feat: add a 10 sec timeout to default outbound dialer 2023-06-15 20:02:55 -07:00