Commit Graph

46 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] c1a47db0e6 Revert to original buffer processing order (input then rawInput)
Per RPRX's clarification, the original order was correct. Reverted the buffer processing order back to: input → rawInput. The issue is not an ordering problem as I misunderstood.

Awaiting clarification on the actual fix needed.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 09:57:56 +00:00
copilot-swe-agent[bot] d8dfcbdd73 Fix Vision by processing rawInput before input when switching to direct mode
Per RPRX's feedback, the original code logic was correct, but the processing order matters. When switching to direct copy mode, rawInput (encrypted TLS records from the outer layer) should be processed and merged into the buffer before input (decrypted application data).

This ensures proper ordering of data when transitioning from Vision-padded mode to direct copy mode, preventing SSL errors especially with testpre connections.

Fixes #4878

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 09:49:31 +00:00
copilot-swe-agent[bot] 6ae3bcbb3f Remove trailing whitespace per code review
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 08:56:50 +00:00
copilot-swe-agent[bot] 8ca8e07fe0 Fix Vision timing issue: ensure complete TLS records before switching to direct copy
The issue was in the timing/conditions for switching to direct copy mode. When Vision receives CommandPaddingDirect from the server, it would immediately switch to direct mode even if the current buffer contains incomplete TLS records. This caused SSL protocol errors, especially with testpre where connections may have fragmented data.

The fix: Before actually performing the switch to direct copy mode, check if the current buffer contains complete TLS records using IsCompleteRecord(). If records are incomplete, return the buffer and delay the switch until the next read cycle when complete records are available.

This ensures Vision only switches to direct mode at safe TLS record boundaries, preventing data corruption.

Fixes #4878

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 08:54:18 +00:00
copilot-swe-agent[bot] 85976a73af Add nil checks for input/rawInput pointers in Vision direct copy mode
When switching to direct copy mode, add defensive nil checks before reading from input and rawInput pointers. This prevents potential issues if these pointers are not set for certain connection types.

While the TLS library handles these buffers internally, adding nil safety ensures robust operation across different connection configurations.

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 01:32:15 +00:00
copilot-swe-agent[bot] aca75d5b80 Fix Vision SSL errors by clearing stale TLS buffers in pre-connections
When testpre is enabled, connections are pre-established and may sit idle for up to 2 minutes. During this time, TLS 1.3 post-handshake messages (NewSessionTicket, etc.) can accumulate in the TLS connection's internal buffers (input and rawInput).

These stale messages are not part of the proxied application data and should not be forwarded by Vision. The fix clears these buffers immediately after extracting them for Vision use, before any data transfer begins.

This prevents the SSL protocol errors that occur when Vision later reads and forwards these stale TLS control messages as if they were application data.

Fixes #4878

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 01:14:02 +00:00
copilot-swe-agent[bot] 7a71924ffe Improve comment clarity per code review
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 01:07:55 +00:00
copilot-swe-agent[bot] 7d70aefa5f Fix Vision SSL errors by not reading encrypted rawInput buffer
The issue occurs when switching to direct copy mode - Vision was incorrectly reading from rawInput buffer which contains ENCRYPTED outer TLS/Reality records and merging them with decrypted application data. This caused SSL protocol errors, especially with testpre where pre-established connections may have TLS session tickets or other post-handshake messages in rawInput.

The fix: Only read from input buffer (decrypted application data), skip rawInput (encrypted TLS records).

Fixes #4878

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-11 01:05:15 +00:00
copilot-swe-agent[bot] ca12c4d909 Revert incorrect fix - restore original RemainingServerHello logic
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-10 22:43:48 +00:00
copilot-swe-agent[bot] 0a7aeb7cda Fix XTLS Vision incomplete TLS record handling - correct RemainingServerHello calculation
Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2026-01-10 22:25:06 +00:00
风扇滑翔翼 fa64775f07 Tunnel/Dokodemo: Fix stats conn unwrap (#5440)
Fixes https://github.com/XTLS/Xray-core/issues/5439
2025-12-23 09:44:54 +00:00
RPRX bd7503d506 XTLS Vision: LogInfo() -> LogDebug()
https://t.me/projectXray/4543105
2025-12-08 13:19:59 +00:00
yuhan6665 903214a0f0 XTLS Vision: Fix enabled uplink splice flag by mistake (#5391)
Fixes https://github.com/XTLS/Xray-core/issues/5379
2025-12-08 13:13:43 +00:00
风扇滑翔翼 93312d29e5 XTLS Vision: Fix IsCompleteRecord() (#5365)
Fixes https://github.com/XTLS/Xray-core/pull/5179
2025-12-02 13:01:44 +00:00
RPRX cadcb47074 XTLS Vision: Add testpre (outbound pre-connect) and testseed (outbound & inbound) (#5270)
https://t.me/projectXtls/1034

---------

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
2025-12-01 13:27:27 +00:00
yuhan6665 c6afcd5fb6 XTLS Vision: Check TLS record isComplete (#5179)
Fixes https://github.com/XTLS/Xray-core/discussions/5169#discussioncomment-14482684
2025-11-30 10:28:01 +00:00
patterniha 9f5dcb1591 MUX: Prevent goroutine leak (#5110) 2025-09-10 00:33:19 +00:00
RPRX e943de5300 proxy/proxy.go: IsRAWTransport() -> IsRAWTransportWithoutSecurity() 2025-09-02 18:15:08 +00:00
yuhan6665 4064f8dd80 XTLS Vision: Refactor code to use DispatchLink() in VLESS inbound (#5076)
* Xtls: code refactor

- Move more logic to VisionReader/Writer
- Remove XtlsWrite()
- XtlsRead now only handle splice at the outbound
- This helps VLESS inbound to have simple buf.copy() so that we can remove pipe next

* Add bufferFlushNext; Use DispatchLink() in VLESS inbound

* Use TimeoutWrapperReader; clean up timer/buffer
2025-09-01 15:15:32 +00:00
patterniha 593ededd3e Trojan-UoT & UDP-nameserver: Fix forgotten release buffer; UDP dispatcher: Simplified and optimized (#5050) 2025-08-29 14:31:46 +00:00
RPRX 7951a5c4bf VLESS protocol: Add lightweight, Post-Quantum ML-KEM-768-based PFS 1-RTT / anti-replay 0-RTT AEAD Encryption (#5067)
https://opensea.io/collection/vless
2025-08-28 10:40:48 +00:00
风扇滑翔翼 b38a53e629 UDS: Use UnixListenerWrapper & UnixConnWrapper (#4413)
Fixes https://github.com/XTLS/Xray-core/issues/4411

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2025-02-19 11:31:29 +00:00
RPRX 8cb63db6c0 XHTTP server: Set remoteAddr & localAddr correctly
Completes https://github.com/XTLS/Xray-core/commit/22c50a70c61f18b54f9e9de82962a053261a398c
2025-02-18 10:50:50 +00:00
yuhan6665 eef74b2c7d XTLS: More separate uplink/downlink flags for splice copy (#4407)
- In 03131c72db new flags were added for uplink/downlink, but that was not suffcient
- Now that the traffic state contains all possible info
- Each inbound and outbound is responsible to set their own CanSpliceCopy flag. Note that this also open up more splice usage. E.g. socks in -> freedom out
- Fixes https://github.com/XTLS/Xray-core/issues/4033
2025-02-18 08:37:52 +00:00
yuhan6665 03131c72db XTLS Vision: Use separate uplink/downlink flag for direct copy (#4329)
Fixes https://github.com/XTLS/Xray-core/issues/4033
2025-01-27 20:44:33 +00:00
zonescape 83bab5dd90 Chore: Run gofmt (#3990) 2024-11-09 11:16:11 +00:00
yuhan6665 85a1c33709 API: Add new Get Inbound User (#3644)
* Add GetInboundUser in proto

* Add get user logic for all existing inbounds

* Add inbounduser command

* Add option to get all users

* Fix shadowsocks2022 config

* Fix init users in shadowsocks2022

* Fix copy

* Add inbound user count command

This api costs much less than get inbound user, could be useful in some case

* Update from latest main
2024-11-03 00:25:23 -04:00
curlwget 790f908f0b chore: fix some comment typos (#3716)
Signed-off-by: curlwget <curlwget@icloud.com>
2024-08-22 17:32:38 +08:00
MHSanaei 16de0937a8 Fix typos (#3527) 2024-07-12 00:20:06 +02:00
yuhan6665 079d0bd8a9 Refactor log (#3446)
* Refactor log

* Add new log methods

* Fix logger test

* Change all logging code

* Clean up pathObj

* Rebase to latest main

* Remove invoking method name after the dot
2024-06-29 14:32:57 -04:00
yuhan6665 121eb7b4fc Splice update timer to 8 hours for inbound timer 2024-05-19 23:56:42 -04:00
yuhan6665 3168d27b0b Splice update timer to 8 hours 2024-05-18 11:57:11 -04:00
yuhan6665 017f53b5fc Add session context outbounds as slice (#3356)
* Add session context outbounds as slice

slice is needed for dialer proxy where two outbounds work on top of each other
There are two sets of target addr for example
It also enable Xtls to correctly do splice copy by checking both outbounds are ready to do direct copy

* Fill outbound tag info

* Splice now checks capalibility from all outbounds

* Fix unit tests
2024-05-13 21:52:24 -04:00
yuhan6665 9b5c3f417e Fix user download stats with splice 2024-03-09 23:40:42 -05:00
yuhan6665 09656bd5d1 Add back sleep for freedom splice 2024-02-15 21:18:56 -05:00
yuhan6665 d21e9b0abd Try a better fix for rare ssl error with freedom splice
It seems the root cause is if the flag set at the inbound pipe reader, it is a race condition and freedom outbound can possibly do splice at the same time with inbound xtls writer.
Now we set the flag at the earliest and always do splice at the next buffer cycle.
2024-01-26 04:42:45 -05:00
yuhan6665 3167a70ff8 Try to fix rare ssl error with freedom splice 2024-01-26 02:29:26 -05:00
yuhan6665 291061e9da Fix an edge case reshaping buffer too long 2023-10-21 03:20:51 -04:00
yuhan6665 cf575be678 Fix unwrap tls conn 2023-09-21 15:35:56 -04:00
yuhan6665 585d5ba7c8 Fix Vision reader 2023-09-17 12:56:29 -04:00
yuhan6665 d6d225c698 Refactor Vision reader writer
- Vision now use traffic states to capture two-way info about a connection
- XTLS is de-couple with Vision, it only read traffic states to switch to direct copy mode
- fix a edge case error when Vision unpadding read 5 command bytes
2023-09-13 08:01:34 -04:00
yuhan6665 efd32b0fb2 Enable splice for freedom outbound (downlink only)
- Add outbound name
- Add outbound conn in ctx
- Refactor splice: it can be turn on from all inbounds and outbounds
- Refactor splice: Add splice copy to vless inbound
- Fix http error test
- Add freedom splice toggle via env var
- Populate outbound obj in context
- Use CanSpliceCopy to mark a connection
- Turn off splice by default
2023-09-07 14:17:39 -04:00
yuhan6665 e93da4bd02 Fix some tests and format code (#830)
* Increase some tls test timeout

* Fix TestUserValidator

* Change all tests to VMessAEAD

Old VMess MD5 tests will be rejected and fail in 2022

* Chore: auto format code
2021-12-14 19:28:47 -05:00
Arthur Morgan 24b637cd5e Fix: CounterConnection with ReadV/WriteV (#720)
Co-authored-by: JimhHan <50871214+JimhHan@users.noreply.github.com>
2021-09-20 20:11:21 +08:00
RPRX 16544c18ab v1.1.0 2020-12-04 09:36:16 +08:00
RPRX c7f7c08ead v1.0.0 2020-11-25 19:01:53 +08:00