Commit graph

200 commits

Author SHA1 Message Date
yuhan6665 9112cfd39c
Clean legacy vmess (#2199)
* Remove legacy Vmess

* validators

* protos
2023-06-12 10:32:25 -04:00
yuhan6665 d11d72be6c Update proto file and fix protoc version parsing
The new protoc cli return version v23.1,
so we parse the file version v4.23.1 without "4."
2023-06-11 13:36:06 -04:00
yuhan6665 c9f517108c Remove mtproto 2023-06-06 23:38:34 -04:00
sambali9 5f5ae37571
Added tcp fragmentation for freedom outbound (#2021)
* Added tcp fragmentation for freedom outbound

* Added TCP_NODELAY to outbound sockopt

* Changed fragment parameters to accept ranges and changed strategy to use length

* Changed packetNumber to packets, supporting range.

* Refactored the freedom fragment logic

* Refine Write()

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2023-05-22 02:59:58 +00:00
jcdong98 e7324700ed Fix memory leak caused by Wireguard outbound 2023-05-14 20:05:04 -04:00
Zeyu Chen bfd5da2f00 fix: dns empty response 2023-05-01 10:19:50 -04:00
世界 18e5b0963f
Update dependencies 2023-04-23 19:32:07 +08:00
RPRX 242f3b0e0b
XTLS protocol: Apply Vision's padding to XUDP Mux & Minor fixes
It's recommended to enable XUDP Mux when using XTLS Vision
Thank @yuhan6665 for testing
2023-04-16 21:15:36 +00:00
RPRX 4f601530fa
Allow multiple XUDP in Mux when using XTLS Vision (client side) 2023-04-14 22:51:09 +00:00
RPRX b33b0bc89d
Allow multiple XUDP in Mux when using XTLS Vision (server side) 2023-04-12 23:20:38 +08:00
yuhan6665 05d24d6827 Amend XUDP related logs
- Useful for debug XUDP improvements
- Move XUDP log in core log
- Freedom connection log show local port
2023-04-09 13:29:39 -04:00
RPRX be23d5d3b7
XUDP protocol: Add Global ID & UoT Migration
The first UoT protocol that supports UoT Migration
Thank @yuhan6665 for testing
2023-04-06 10:21:35 +00:00
世界 172f353bd7
Update dependencies 2023-03-20 15:01:38 +08:00
世界 55efac7236
Reformat code 2023-03-17 13:17:08 +08:00
世界 f57ec13880
Update UoT protocol 2023-03-17 13:17:08 +08:00
RPRX c04c333afc
They become a part of you 2023-03-04 15:39:27 +00:00
yuhan6665 9e5bc07bf2
Legends never die (#1725) 2023-03-04 10:39:26 +00:00
RPRX 4c8ee0af50
Set reserved to zero after Read()
Thank @IRN-Kawakaze for testing
2023-03-03 15:39:16 +00:00
yuhan6665 25ea69fc3a Fix Vision inserting multiple uuid headers
This happen for stream inbound like http
2023-03-03 09:45:10 -05:00
yuhan6665 a4790133d2 Fix padding extends out of bound again 2023-03-02 21:42:48 -05:00
RPRX ccba465590
Add reserved to WireGuard config
Fixes https://github.com/XTLS/Xray-core/issues/1730
2023-03-02 16:55:42 +00:00
yuhan6665 7b54255cc1 Fix padding extends out of bound 2023-03-01 08:43:00 -05:00
yuhan6665 2d898480be
Vision padding upgrade (#1646)
* Vision server allow multiple blocks of padding

* Fix Vision client to support multiple possible padding blocks

* Vision padding upgrade

- Now we have two types of padding: long (pad to 900-1400) and traditional (0-256)
- Long padding is applied to tls handshakes and first (empty) packet
- Traditional padding is applied to all beginning (7) packets of the connection (counted two-way)
- Since receiver changed its way to unpad buffer in fd6973b3c6, we can freely extend padding packet length easily in the future
- Simplify code

* Adjust receiver withinPaddingBuffers

Now default withinPaddingBuffers = true to give it a chance to do unpadding

* Fix magic numbers for Vision
Thanks @H1JK

Thanks @RPRX for guidance
2023-02-27 22:14:37 -05:00
RPRX c38179a67f
Upgrade github.com/xtls/reality to f34b4d174342
Fixes https://github.com/XTLS/Xray-core/issues/1712
2023-02-26 19:26:57 +08:00
Hellojack 267d93f7bd
Improve ReshapeMultiBuffer (#1636)
* Improve ReshapeMultiBuffer

* Improve again

* Always resize
2023-02-24 11:42:02 -05:00
RPRX 4d2e2b24d3
THE NEXT FUTURE becomes THE REALITY NOW
Thank @yuhan6665 for testing
2023-02-15 16:07:12 +00:00
yuhan6665 c3faa8b7ac
Insert padding with empty content to camouflage VLESS header (#1610)
This only affects the Vision client for protocols expecting server to send data first.
The change is compatible with existing version of Vision server.
2023-02-06 06:45:09 +00:00
RPRX 74416570d4
Format VLESS inbound.go and outbound.go 2023-01-31 18:02:12 +00:00
RPRX b70912799b
Generate *.pb.go files with protoc v3.21.12
https://github.com/protocolbuffers/protobuf/releases/tag/v21.12
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
go run ./infra/vprotogen
2023-01-30 04:35:30 +00:00
yuhan6665 15bb23e4ec
XTLS Vision rejects Mux except for XUDP (#1567)
* Xtls vision reject vless-tcp-tls+Mux

* Address review comment
2023-01-28 05:39:36 +00:00
yuhan6665 fb212905bd
XTLS Vision checks outer TLS version (#1554) 2023-01-27 03:43:58 +00:00
MP 77d2f9edd7
Revise the Code per XTLS#1515 (#1536)
* Use buf.FromBytes(make([]byte, 0, buf.Size)) to create `first`

Fixes https://github.com/XTLS/Xray-core/issues/1515

* Update server.go

* Update inbound.go

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
2023-01-16 22:18:58 -05:00
RPRX 8c0d3c0257
XTLS Vision supports acceptProxyProtocol (test needed)
Fixes https://github.com/XTLS/Xray-core/issues/1339
2023-01-07 11:01:53 +00:00
RPRX 6f61021f7a
XTLS Vision processes struct TLS Conn's input and rawInput
Fixes https://github.com/XTLS/Xray-core/issues/1444
2023-01-06 05:37:16 +00:00
yuhan6665 c4fbdf1b78 Run core/format.go 2022-12-25 19:47:53 -05:00
PMExtra c9b6fc0104 Add custom header support for HTTP proxy 2022-12-18 21:48:23 -05:00
pocketW a55cf1d0bf fix: email inconsistent 2022-12-15 08:35:07 -05:00
yuhan6665 f35ded79ad Vision only reject TCP command for VLESS-TCP-TLS
UDP and MUX command currently has no flow value.
Also the character is the same with or without XTLS
2022-12-12 21:20:01 -05:00
yuhan6665 bc4de6a026 Fix VLESS client doesn't handle traffic if not send data first
Certain ssh, mySQL and reverse proxy need server data first in a connection
2022-12-11 09:44:40 -05:00
yuhan6665 2e30093ffd Enforce specific none flow for xtls vision
In the past, when user open xtls vision on the server side, plain vless+tls can connect.
Pure tls is known to have certain tls in tls characters.
Now  server need to specify "xtls-rprx-vision,none" for it be able usable on the same port.
2022-12-04 23:15:36 -05:00
yuhan6665 1d7c40d728 Enable Xtls Vision (Direct not Splice) for any inbound connection
Before this change, Vision client need a pure inbound like socks or http.
After this change, it will support any inbound.
This is useful in traffic forwarder use case inside China.
2022-12-04 23:15:36 -05:00
Senis John 143229b148 update: Implement the proxy.UserManager of ss2022 2022-12-03 21:19:31 -05:00
yuhan6665 d87758d46f Parse big server hello properly 2022-11-27 18:28:38 -05:00
yuhan6665 e5e9e58d66 Fix direct flow on Windows 2022-11-27 18:28:38 -05:00
nanoda0523 e18b52a5df
Implement WireGuard protocol as outbound (client) (#1344)
* implement WireGuard protocol for Outbound

* upload license

* fix build for openbsd & dragonfly os

* updated wireguard-go

* fix up

* switch to another wireguard fork

* fix

* switch to upstream

* open connection through internet.Dialer (#1)

* use internet.Dialer

* maybe better code

* fix

* real fix

Co-authored-by: nanoda0523 <nanoda0523@users.noreply.github.com>

* fix bugs & add ability to recover during connection reset on UDP over TCP parent protocols

* improve performance

improve performance

* dns lookup endpoint && remove unused code

* interface address fallback

* better code && add config test case

Co-authored-by: nanoda0523 <nanoda0523@users.noreply.github.com>
2022-11-21 20:05:54 -05:00
yuhan6665 494a10971b Fix xtls vision issue with big server hello 2022-11-20 18:54:07 -05:00
yuhan6665 8006430c15 Add logic to filter TLS_AES_128_CCM_8_SHA256 2022-11-13 12:18:23 -05:00
yuhan6665 04278a8940 Refactor some variable names 2022-11-13 12:18:23 -05:00
yuhan6665 48f7cc2132 Reshape multi buffer to fix the padding when buffer is full 2022-11-13 12:18:23 -05:00
yuhan6665 8ef609ff46 Enable UTLS fingerprint for XTLS Vision 2022-11-06 21:50:19 -05:00
yuhan6665 fffd908db2 Fix direct and splice flow 2022-11-06 21:50:19 -05:00
yuhan6665 5e695327b1
Add XTLS RPRX's Vision (#1235)
* Add XTLS RPRX's Vision

* Add helpful warning when security is wrong

* Add XTLS padding (draft)

* Fix  number of packet to filter

* Xtls padding version 1.0 and unpadding logic
2022-10-29 00:51:59 -04:00
yuhan6665 8117b66949 Generate all protos 2022-10-10 13:17:32 -04:00
yuhan6665 c21595a937 Fix an issue with ss2022 generics 2022-09-16 21:54:37 -04:00
yuhan6665 debd2e3ba8 Remove compatibility code
The minimum support go version is already 1.18
2022-09-16 20:39:07 -04:00
yuhan6665 84537e98c4 Update xtls and go to 1.19 2022-09-15 22:06:59 -04:00
yuhan6665 71a9a6dd55 Update dependencies
- Sync with sing upstream
2022-08-27 22:57:14 -04:00
世界 7d52ded2a3
Update dependencies 2022-07-16 09:33:03 +08:00
世界 52930a16b2
Fix check ss bad udp request #1122 2022-06-28 07:50:18 +08:00
Shelikhoo d4f18b1342 Fix DoS attack vulnerability in VMess Option Processing 2022-06-19 19:13:37 -04:00
世界 ba4ce4c24f
Add shadowsocks 2022 relay service 2022-06-19 22:17:23 +08:00
世界 bd0cf955c7
Update shadowsocks-2022 multi-server usage 2022-06-07 11:17:08 +08:00
世界 c3505632fd
Add udp over tcp support for shadowsocks-2022 2022-06-01 11:49:02 +08:00
世界 f1d753f069
Fix build in legacy golang version 2022-05-31 15:55:38 +08:00
世界 91ce752405
Fix close pipe 2022-05-31 11:44:32 +08:00
世界 79f3057687
Migrate shadowsocks-2022 to protocol library 2022-05-26 07:35:17 +08:00
世界 1edce576ca
Fix missing user in shadowsocks-2022 inbound 2022-05-25 08:49:52 +08:00
世界 cf7e675c45
Add shadowsocks 2022 multi-user inbound 2022-05-24 07:37:14 +08:00
世界 087f0d1240
Add shadowsocks-2022 inbound/outbound (#1061) 2022-05-22 23:55:48 -04:00
世界 f046feb9ca
Reformat code 2022-05-18 15:29:01 +08:00
yuhan6665 41ce6ccf9f
Make reverse proxy compatible with v2fly (#924)
* Make reverse proxy compatible with v2fly

* Fix gitignore

* Regenerate proto files

- fix v2ray name in loopback

* Fix fly.org in unit tests
2022-02-04 21:59:50 -05:00
yuhan6665 578d903a9e
Quic related improvements (#915)
* DialSystem for Quic

DialSystem() is needed in case of Android client,
where the raw conn is protected for vpn service

* Fix client dialer log

Log such as:
tunneling request to tcp:www.google.com:80 via tcp:x.x.x.x:443
the second "tcp" is misleading when using mKcp or quic transport

Remove the second "tcp" and add the correct logging for transport dialer:
- transport/internet/tcp: dialing TCP to tcp:x.x.x.x:443
- transport/internet/quic: dialing quic to udp:x.x.x.x:443

* Quic new stream allocation mode

Currently this is how Quic works: client muxing all tcp and udp traffic through a single session, when there are more than 32 running streams in the session,
the next stream request will fail and open with a new session (port). Imagine lineup the session from left to right:
 |
 |  |
 |  |  |

As the streams finishes, we still open stream from the left, original session. So the base session will always be there and new sessions on the right come and go.
However, either due to QOS or bugs in Quic implementation, the traffic "wear out" the base session. It will become slower and in the end not receiving any data from server side.
I couldn't figure out a solution for this problem at the moment, as a workaround:
       |  |
    |  |  |
 |  |  |

I came up with this new stream allocation mode, that it will never open new streams in the old sessions, but only from current or new session from right.
The keeplive config is turned off from server and client side. This way old sessions will natually close and new sessions keep generating.
Note the frequency of new session is still controlled by the server side. Server can assign a large max stream limit. In this case the new allocation mode will be similar to the current mode.
2022-01-28 18:11:30 -05:00
Machtergreifung e96e5994d0 Update Vmess Warning Errors 2022-01-19 09:30:28 -05:00
yuhan6665 9ea1bf7c1d Fix shadowsocks xchacha cipher nonce size 2021-12-19 21:18:35 -05:00
yuhan6665 4e88a369c4 Fix vmess test with portList 2021-12-14 20:01:53 -05: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
yuhan6665 d5a7901601
Unified drain support for vmess and shadowsocks (#791)
* Added test for no terminate signal

* unified drain support for vmess and shadowsockets

* drain: add generated file

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
2021-12-14 19:27:31 -05:00
Shelikhoo 6fb5c887b2 Fix DoS attack vulnerability in CommandSwitchAccountFactory 2021-12-11 20:14:57 -05:00
lucifer9 d6ae4e9ba2 Make it easier to configure multiple listening ports 2021-11-17 23:13:15 -05:00
秋のかえで 63d0cb1bd6
Refactor: new Shadowsocks validator (#629)
* Refactor: new Shadowsocks validator

* Fix NoneCliper cannot work

* Feat: refine the size of drain

* fix: fix validator after merge 'main'

* fix: UDP user logic

* style: refine code style
2021-10-31 22:10:26 -04:00
Shelikhoo 7038bded7b
Added experiment to avoid sending the termination signal
(cherry picked from commit c5357e1f000054ba5836468922cae52a830c8019)
2021-10-22 18:34:57 +08:00
Shelikhoo ff35118af5
VMess AEAD based packet length
(cherry picked from commit 08221600082a79376bdc262f2ffec1a3129ae98d)
2021-10-22 18:34:57 +08:00
世界 707efd6d12
Add loopback outound 2021-10-22 17:58:37 +08:00
世界 77d0419aca
Add socks4/4a support 2021-10-22 13:27:31 +08:00
maskedeken 238bd5d050
Add xchacha20-ietf-poly1305 for Shadowsocks 2021-10-22 13:24:29 +08:00
秋のかえで 9b204ed99b
Fix: Trojan fallback
(cherry picked from commit 908408dd45a58c3c284ecf0dfef539c5681230d9)
2021-10-22 12:38:40 +08:00
yuhan6665 45dc97e2b6
Use shadowsocket's bloomring for shadowsocket's replay protection (#764)
* use shadowsocket's bloomring for shadowsocket's replay protection

* added shadowsockets iv check for tcp socket

* Rename to shadowsockets iv check

* shadowsocks iv check config file

* iv check should proceed after decryption

* use shadowsocket's bloomring for shadowsocket's replay protection

* Chore: format code (#842)

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-10-22 12:38:40 +08:00
yuhan6665 e286cdcaa8
Style: format code by gofumpt (#761) 2021-10-20 00:57:14 +08:00
世界 cd4631ce99
Merge dns (#722)
* DNS: add clientip for specific nameserver

* Refactoring: DNS App

* DNS: add DNS over QUIC support

* Feat: add disableCache option for DNS

* Feat: add queryStrategy option for DNS

* Feat: add disableFallback & skipFallback option for DNS

* Feat: DNS hosts support multiple addresses

* Feat: DNS transport over TCP

* DNS: fix typo & refine code

* DNS: refine code

* Add disableFallbackIfMatch dns option

* Feat: routing and freedom outbound ignore Fake DNS

Turn off fake DNS for request sent from Routing and Freedom outbound.
Fake DNS now only apply to DNS outbound.
This is important for Android, where VPN service take over all system DNS
traffic and pass it to core.  "UseIp" option can be used in Freedom outbound
to avoid getting fake IP and fail connection.

* Fix test

* Fix dns return

* Fix local dns return empty

* Apply timeout to dns outbound

* Update app/dns/config.go

Co-authored-by: Loyalsoldier <10487845+loyalsoldier@users.noreply.github.com>
Co-authored-by: Ye Zhihao <vigilans@foxmail.com>
Co-authored-by: maskedeken <52683904+maskedeken@users.noreply.github.com>
Co-authored-by: V2Fly Team <51714622+vcptr@users.noreply.github.com>
Co-authored-by: CalmLong <37164399+calmlong@users.noreply.github.com>
Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
Co-authored-by: 秋のかえで <autmaple@protonmail.com>
Co-authored-by: 朱聖黎 <digglife@gmail.com>
Co-authored-by: rurirei <72071920+rurirei@users.noreply.github.com>
Co-authored-by: yuhan6665 <1588741+yuhan6665@users.noreply.github.com>
Co-authored-by: Arthur Morgan <4637240+badO1a5A90@users.noreply.github.com>
2021-10-16 21:02:51 +08:00
KallyDev 4abf98c1be
Move from deprecated ioutil to os and io packages (#744) 2021-09-29 02:49:34 +08:00
世界 3b31189f13
Send shadowsocks handshake with payload if available (#736) 2021-09-27 13:30:58 +08:00
hmol233 7033f7cf5f
Fix: protobuf file (#724) 2021-09-20 22:41:09 +08:00
Arthur Morgan ffc2f7c4e2 Style: format code 2021-09-20 21:00:55 +08: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
yuhan6665 f2cb13a8ec
Deprecate legacy VMess header with a planned decommission (#712)
* Deprecate legacy VMess header with a planned decommission
* show legacy warning only once

Co-authored-by: Xiaokang Wang <xiaokangwang@outlook.com>
Co-authored-by: hmol233 <82594500+hmol233@users.noreply.github.com>
2021-09-20 14:46:05 +08:00
yuhan6665 42d158bd85
vprotogen refine (#717)
* Update all proto files with existing vprotogen
* Chore: remove protoc-gen-gofast
* Feat: vprotogen adds version detector to block generation code from old protobuf version
* Feat: vprotogen refine logic

Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-09-18 01:16:14 +08:00
yuhan6665 00bcd40c34
remove deprecate ciphers in shadowsocks (#710)
* remove deprecate ciphers in shadowsocks

Co-authored-by: Kslr <kslrwang@gmail.com>
2021-09-17 04:13:07 +08:00
RPRX 100edc370b
Stop at '?' when reading HTTP PATH before shunting 2021-03-12 11:50:59 +00:00
RPRX 924fe16077
Skip Port 53, 443 before using single XUDP for VLESS & VMess 2021-03-08 18:36:45 +00:00
yuhan6665 f50eff5ebb
Add Fake DNS support (#309)
Co-authored-by: Xiaokang Wang <xiaokangwang@outlook.com>
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: kslr <kslrwang@gmail.com>
2021-03-07 04:39:50 +00:00