Commit Graph

204 Commits

Author SHA1 Message Date
mmmray ee2000f6e1
splithttp: Add support for H2C and http/1.1 ALPN on server (#3465)
* Add H2C support to server

* update comment

* Make http1.1 ALPN work on SplitHTTP client

Users that encounter protocol version issues will likely try to set the
ALPN explicitly. In that case we should simply grant their wish, because
the intent is obvious.
2024-06-23 13:05:37 -04:00
mmmray eb4f9429e6
Use ArrayBuffer in WS browser dialer binaryType (#3468)
On my machine, browserdialer speedtest gives 10 Mbit/s download. Now it
can do 300 Mbit/s.
2024-06-23 05:31:57 +08:00
mmmray 8fe976d7ee
Upgrade SplitHTTP Transport (#3462)
* move to paths instead of querystrings

* permit early data on serverside

* early data for the client, fix context cancellation
2024-06-20 23:30:51 +00:00
mmmray c1a7602412 fix compatibility issues with go 1.21 2024-06-18 10:23:29 -04:00
mmmray c10bd28731
Add SplitHTTP Transport (#3412) 2024-06-18 05:36:36 +00:00
风扇滑翔翼 3654c0d710 HTTPUpgrade send headers with specified capitalization (#3430)
* Fix HTTPUpgrade header capitalization

* Chore

* Remove excess host headers

Chore : change httpupgrade header "upgrade" to "Upgrade" #3435
2024-06-07 12:53:27 +00:00
mmmray f8ec93dfdd
drain buffer correctly in httpupgrade (#3428)
* drain buffer correctly in httpupgrade

it seems the recently added httupgrade testsuite is causing timeouts on master

i have no evidence this is the real issue, but it feels to me that the
server could accidentally over-read, and then the encapsulated
connection will block forever trying to read data

let's test it in CI a couple of times, i don't have a way to reproduce
the issue

* correctly drain buffer, again
2024-06-05 22:43:15 -04:00
mmmray 980236f2b6
preserve exact header casing when using httpupgrade (#3427)
* preserve exact header casing when using httpupgrade

* fix capitalization of websocket

* oops, we dont need net/url either

* restore old codepath when there are no headers
2024-06-05 20:43:44 -04:00
风扇滑翔翼 be29cc39d7
Add httpupgrade test 2024-06-05 17:39:55 +00:00
风扇滑翔翼 df53afceae Make ws_test uses random ports 2024-06-04 00:52:02 +08:00
AsenHu 459504300c
chore: Remove unnecessary `if` in httpupgrade (#3413) 2024-06-04 00:13:46 +08:00
isluckys 89074a14b6 Fix udp goroutine leak
v.conn.link.Reader is a pipe.Reader, doesn't implement Close(), it will fail assertion and cause the pipe to be left open
It can be fixed by using Interrupt()
2024-05-30 17:45:29 -04:00
RPRX ca07a705dc
Generate *.pb.go files with protoc v5.27.0
Download https://github.com/protocolbuffers/protobuf/releases/tag/v27.0
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.1
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
(Xray-core/) go run ./infra/vprotogen
2024-05-26 03:20:53 +00: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
mmmray 8ce2a0e245
Validate /websocket requests from browser dialer page (#3295)
Fixes https://github.com/XTLS/Xray-core/issues/3236

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2024-04-26 03:19:25 +00:00
RPRX 61800fcc66
Revert "nosni"
https://github.com/XTLS/Xray-core/pull/3214#issuecomment-2078502477
2024-04-26 02:27:22 +00:00
RPRX 080bd8241c
Fix https://github.com/XTLS/Xray-core/issues/3288 2024-04-21 19:43:27 +00:00
X-Oracle c85a91bc29 fix [ log ]: small fix for better readability. 2024-04-18 08:17:29 -04:00
yuhan6665 32f0017449 Add error log for ws host and path check 2024-04-17 21:31:57 -04:00
guangwu 12f5b05aca fix: close resp body 2024-04-17 09:40:37 -04:00
Allo fbc56b88da chore: remove the usage of some deprecated tls properties 2024-04-13 17:56:35 -04:00
风扇滑翔翼 021868afca Fix HTTPUpgrade init 2024-04-07 19:52:48 -04:00
风扇滑翔翼 ec2224974d Add "nosni" option to send empty SNI (#3214)
* Allow not to send SNI

* Allow reality not to send SNI
2024-04-01 11:08:37 -04:00
yuhan6665 7e3a8d3a04 Add separate host config for websocket 2024-03-30 07:43:05 +00:00
yuhan6665 e2302b421c Update proto file for websocket and httpupgrade (breaking) 2024-03-30 07:42:41 +00:00
风扇滑翔翼 9a619f9e7c Add support for HTTPupgrade custom headers 2024-03-23 07:53:36 -10:00
チセ 2cafb3ef89
Fix(httpupgrade): `X-Forwarded-For` header not read. (#3172) 2024-03-23 13:34:51 -04:00
yuhan6665 657c5c8570 Update HTTPUpgrade spelling and proto 2024-03-20 13:08:43 -04:00
风扇滑翔翼 bb48a2043d Fix HTTPUpgrade transport register 2024-03-20 12:05:01 -04:00
RPRX 18b823b4a6
HTTPUpgrade 0-RTT (#3152)
* Add ed to enable HTTPUpgrade 0-RTT

https://github.com/XTLS/Xray-core/issues/3128#issuecomment-2002563369

* WebSocket hub.go MaxHeaderBytes: 4096 -> 8192
2024-03-17 20:43:19 +00:00
RPRX 5c41292836
Add ConnRF to make HTTPUpgrade 0-RTT
https://github.com/XTLS/Xray-core/issues/3128#issuecomment-1991809113
2024-03-13 22:39:24 +00:00
RPRX d3a218f896
Fix https://github.com/XTLS/Xray-core/issues/3128 2024-03-12 11:58:29 +00:00
A1lo a994bf8b04
chore: fix some errors detected by staticcheck (#3089)
* chore: fix some errors detected by staticcheck

* feat: remove `rand.Seed()` usage for possibly using "fastrand64" runtime to avoid locking

ref: https://pkg.go.dev/math/rand#Seed
2024-03-03 10:52:22 -05:00
Eken Chan 173b03448f transport: add httpupgrade 2024-03-03 10:45:36 -05:00
RPRX 7184a8165f
Add Authority to gRPC Transport (#3076)
Why couldn't you have Host, for the last three years?
2024-02-29 14:22:14 +00:00
yuhan6665 3778a367c8 Fix and simplify SockOpt in UDP
https://github.com/golang/go/issues/29277
2024-02-21 13:59:09 -05:00
deorth-kku cae94570df Fixing tcp connestions leak
- always use HandshakeContext instead of Handshake

- pickup dailer dropped ctx

- rename HandshakeContextAddress to HandshakeAddressContext
2024-02-19 09:32:40 -05:00
yuhan6665 fa5d7a255b
Least load balancer (#2999)
* v5: Health Check & LeastLoad Strategy (rebased from 2c5a71490368500a982018a74a6d519c7e121816)

Some changes will be necessary to integrate it into V2Ray

* Update proto

* parse duration conf with time.Parse()

* moving health ping to observatory as a standalone component

* moving health ping to observatory as a standalone component: auto generated file

* add initialization for health ping

* incorporate changes in router implementation

* support principle target output

* add v4 json support for BurstObservatory & fix balancer reference

* update API command

* remove cancelled API

* return zero length value when observer is not found

* remove duplicated targeted dispatch

* adjust test with updated structure

* bug fix for observer

* fix strategy selector

* fix strategy least load

* Fix ticker usage

ticker.Close does not close ticker.C

* feat: Replace default Health Ping URL to HTTPS (#1991)

* fix selectLeastLoad() returns wrong number of nodes (#2083)

* Test: fix leastload strategy unit test

* fix(router): panic caused by concurrent map read and write (#2678)

* Clean up code

---------

Co-authored-by: Jebbs <qjebbs@gmail.com>
Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
Co-authored-by: 世界 <i@sekai.icu>
Co-authored-by: Bernd Eichelberger <46166740+4-FLOSS-Free-Libre-Open-Source-Software@users.noreply.github.com>
Co-authored-by: 秋のかえで <autmaple@protonmail.com>
Co-authored-by: Rinka <kujourinka@gmail.com>
2024-02-17 22:51:37 -05:00
yuhan6665 bf02392969 Temporarily turn off sockopt for UDP on windows 2024-02-17 13:22:39 -05:00
风扇滑翔翼 303beff5dd Fix SockOpt does not work in UDP 2024-02-06 10:41:39 -05:00
dyhkwong da5a28a088
Fix #2654 (#2941)
* fix udp dispatcher

* fix test
2024-01-15 10:33:15 -05:00
Qi Lin 0ea2a50264 Add option `realitySettings.masterKeyLog` 2024-01-11 10:57:04 -05:00
Qi Lin 2b08d8638e Let `tlsSettings.masterKeyLog` and `tlsSettings.fingerprint` work together 2024-01-10 11:34:52 -05:00
yuhan6665 eacdda3c93 Fix connecting to quic outbound with domain address 2023-12-25 22:25:22 -05:00
hossinasaadi b7f21be8bc fix ecdh crash in reality 2023-12-24 15:38:44 -05:00
yuhan6665 d60281d0a5 Add DestIpAddress() in Dialer interface
Android client prepares an IP before proxy connection is established. It is useful when connecting to wireguard (or quic) outbound with domain address. E.g. engage.cloudflareclient.com:2408
2023-12-18 18:36:56 -05:00
Zhang San 5a5e615b46
Enable interface setting for socketopt under Windows (#2819)
* allow set interface under windows

Signed-off-by: San Zhang <zhangan@mail.com>

* polish code

Signed-off-by: San Zhang <zhangan@mail.com>

---------

Signed-off-by: San Zhang <zhangan@mail.com>
Co-authored-by: San Zhang <zhangan@mail.com>
2023-12-17 17:56:15 -05:00
风扇滑翔翼 69cbb4c47a Change WS upgraderBufferSize
due to https://github.com/gorilla/websocket/issues/223
2023-11-28 11:28:58 -05:00
yuhan6665 6f092bd212
Add "masterKeyLog" in TLS config (#2758)
* Add "enableMasterKeyLog" in TLS config

Turn on the debug option for Wireshark to decrypt traffic

* Change to "masterKeyLog" to configure a path
2023-11-27 10:08:34 -05:00
cty123 f1c81557dc #2605: Add safety check for type casting for QUIC dialer
Issue #2605 brought up real problem that QUIC dialer doesn't support sockopt at the moment. Inside `internet.DialSystem(...)` function, one of the branch that involves `redirect(...)` returns `cnc.connection` instance that is currently unhandled by the code logic, and thus caused program panic during runtime.

It seems the sockopt support for QUIC protocol requires a couple changes including making `cnc.connection` public, such that we can handle in dialer, along with some thorough tests, this commit simply adds safety check to explicity state the fact that QUIC isn't working with sockopt. And the implementation of the feature can be scheduled later on.
2023-11-14 10:14:26 -05:00