Commit Graph

1294 Commits

Author SHA1 Message Date
Loyalsoldier 6f8979d017
Style: format code by gofumpt (#1022) 2021-05-20 05:28:52 +08:00
Loyalsoldier f71b45f3e7
Chore: fix typos (#878) 2021-04-09 09:47:36 +08:00
Shelikhoo e413653b1d
show legacy warning only once 2021-04-05 18:55:44 +01:00
Shelikhoo 2604c7c375
Revert "move non-VMessAEAD warning to startup"
This reverts commit e87e3d6b
2021-04-05 18:50:07 +01:00
Loyalsoldier ae840dca6f
Chore: refine test (#855)
copy from branch v5
2021-04-04 09:33:38 +08:00
kslr e87e3d6b85 move non-VMessAEAD warning to startup 2021-04-02 22:19:52 +08:00
Loyalsoldier b50d692128
Chore: update protobuf & dependencies (#844) 2021-04-02 21:48:27 +08:00
Loyalsoldier c80a6df749
Chore: format code (#842) 2021-04-02 20:49:45 +08:00
Shelikhoo d55d5423fb
use shadowsocket's bloomring for shadowsocket's replay protection 2021-04-01 21:01:39 +01:00
Shelikhoo 7f5bc447d9
iv check should proceed after decryption 2021-04-01 20:59:36 +01:00
Shelikhoo b5e29ea14e
Rename to shadowsockets iv check 2021-04-01 20:59:35 +01:00
Shelikhoo e4681e8cd3
added shadowsockets iv check for tcp socket 2021-04-01 20:59:35 +01:00
Shelikhoo 531cd29e20
use shadowsocket's bloomring for shadowsocket's replay protection 2021-04-01 20:59:30 +01:00
Loyalsoldier 3db3ba5872
Fix: remove AA header flag in DNS query (#817) 2021-03-23 15:49:20 +08:00
Loyalsoldier e6aaa57def
Feat: add queryStrategy option for DNS (#794) 2021-03-19 15:55:18 +08:00
Loyalsoldier 7459e2c5ef
Fix: vprotogen loop dependency (#797)
* Chore: remove protoc-gen-gofast
* Fix: loop dependency
* Chore: regenerate VLESS pb.go file
* Fix: compare test
2021-03-18 18:32:40 +08:00
Loyalsoldier 9e9173acb4
Chore: update protobuf & dependencies (#793)
* Chore: update protobuf
* Chore: regenerate mock files
* Chore: update dependencies
* Chore: use Go v1.16.2 and later
2021-03-18 12:17:26 +08:00
Loyalsoldier e46204f828
Chore: fix lint according to golangci-lint errors (#781)
* Chore: fix lint according to golangci-lint errors
* Chore: regenerate pb.go files
2021-03-14 07:44:47 +08:00
Xiaokang Wang 0e5e5164ff
loopback outbound, allow you to redirect connection to the dispatcher again (#770)
* Added Loop back proxy

* Added json processing for lo proxy

* Fix bug for lo proxy

* Fix bug for lo proxy

* rename the outbound name

* Loopback: update naming and fix lint issues

* Chore: change lo to loopback

Co-authored-by: kslr <kslrwang@gmail.com>
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-03-13 17:25:56 +08:00
Loyalsoldier e03947e6b0
Chore: update protobuf & dependencies (#748) 2021-03-08 05:12:27 +08:00
Shelikhoo 7dabfb755e
merge vmess zero encryption support 2021-03-04 00:12:37 +00:00
Loyalsoldier 49cf614346
Chore: update dependencies & protobuf (#728) 2021-03-03 17:31:53 +08:00
Shelikhoo 1368e92605
Imaginary Security Lever: zero: turn off all security on payload data 2021-03-01 15:39:52 +00:00
Xiaokang Wang 733c5dea88
Deprecate legacy VMess header with a planned decommission (#717) 2021-03-01 21:26:54 +08:00
yuhan6665 afb8385a7e
Feat: routing and freedom outbound ignore Fake DNS (#696)
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.

Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-02-23 10:17:20 +08:00
Shelikhoo 232ba8c26f
Apply coding style 2021-02-22 13:49:36 +00:00
Shelikhoo 9c9c45fe4f
Add Test for the KDF value 2021-02-22 13:25:12 +00:00
Shelikhoo 0024c6e028
Fix incorrect HMac Chaining, further checking needed 2021-02-22 13:20:36 +00:00
Loyalsoldier a545bfe2c8
Feat: use Go v1.16 & support Apple Silicon (#686) 2021-02-19 13:24:19 +08:00
Loyalsoldier f94dd11a8c
Chore: change module name (#677) 2021-02-17 04:31:50 +08:00
Loyalsoldier f98944c9e0
Chore: update protobuf (#670) 2021-02-11 14:57:20 +08:00
Xiaokang Wang 38da831b75
Feature: Fake DNS support (#406)
* Add fake dns

A new config object "fake" in DnsObject for toggling fake dns function

Compare with sniffing, fake dns is not limited to http and tls traffic.
It works across all inbounds. For example, when dns request come
from one inbound, the local DNS server of v2ray will response with a
unique fake IP for every unique domain name. Then later on v2ray
received a request to one of the fake IP from any inbounds, it will
override the request destination with the previously saved domain.

By default, v2ray cache up to 65535 addresses. The old records will
be discarded bases on LRU. The fake IP will be 240.x.x.x

* fix an edge case when encounter a fake IP in use

* Move lru to common.cache package

* Added the necessary change to obtain request IP from sniffer

* Refactor the code so that it may stop depending on global variables in the future.

* Replace string manipulation code with more generic codes, hopefully this will work for both IPv4 and IPv6 networks.

* Try to use IPv4 version of address if possible

* Added Test Case for Fake Dns

* Added More Test Case for Fake Dns

* Stop user from creating a instance with LRU size more than subnet size, it will create a infinite loop

* Move Fake DNS to a separate package

* Generated Code for fakedns

* Encapsulate Fake DNS as a Instance wide service

* Added Support for metadata sniffer, which will be used for Fake DNS

* Dependency injection for fake dns

* Fake DNS As a Sniffer

* Remove stub object

* Remove global variable

* Update generated protobuf file for metadata only sniffing

* Apply Fake DNS config to session

* Loading for fake dns settings

* Bug fix

* Include fake dns in all

* Fix FakeDns Lint Condition

* Fix sniffer config

* Fix lint message

* Fix dependency resolution

* Fix fake dns not loaded as sniffer

* reduce ttl for fake dns

* Apply Coding Style

* Apply Coding Style

* Apply Coding Style

* Apply Coding Style

* Apply Coding Style

* Fix crashed when no fake dns

* Apply Coding Style

* Fix Fake DNS do not apply to UDP socket

* Fixed a bug prevent FakeDNS App Setting from become effective

* Fixed a caveat prevent FakeDNS App Setting from become effective

* Use log comparison to reduce in issue when it comes to really high value typical for ipv6 subnet

* Add build tag for fakedns

* Removal of FakeDNS specific logic at DNS client: making it a standard dns client

* Regenerate auto generated file

* Amended version of configure file

* Bug fixes for fakeDNS

* Bug fixes for fakeDNS

* Fix test: remove reference to removed attribute

* Test: fix codacy issue

* Conf: Remove old field support

* Test: fix codacy issue

* Change test scale for TestFakeDnsHolderCreateMappingAndRollOver

* Test: fix codacy issue

Co-authored-by: yuhan6665 <1588741+yuhan6665@users.noreply.github.com>
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: kslr <kslrwang@gmail.com>
2021-02-08 18:18:52 +08:00
dyhkwong d8bc41e653
support enforcing VMessAEAD via environment variable (#596)
* support enforcing VMessAEAD via env var

to prevent downgrade attack

* Add comments to make Codacy Production happy
2021-02-08 18:08:01 +08:00
Kslr 795a3f632d
Test: fix race issue (#598)
other "race" problems are only in the test, and so I deleted the detection
2021-01-11 20:50:58 +08:00
maskedeken 9f8cb8bc8b
Fix: trojan: do not panic when UDP dispatcher fails to write response (#599) 2021-01-11 17:13:59 +08:00
Kslr 42f0f5dfec
remove deprecate ciphers in shadowsocks (#566)
* remove deprecate ciphers in shadowsocks
2021-01-01 10:18:00 +08:00
database64128 29f16cd054
🎳 Refine socks5 server UdpAssociate response behavior (#523)
- Previously, without specifying the server IP, the remote address in the response to a UdpAssoicate command is `127.0.0.1`, which might break UDP for non-localhost clients.
- This commit changes it so that, localhost clients get responses with the corresponding loopback IP, non-localhost clients get responses with the corresponding `net.AnyIP` or `net.AnyIPv6`.
- The new behavior is also consistent with many other implementations. So the compatibility is guaranteed. It also makes specifying server IP optional.
2020-12-16 16:39:14 +08:00
database64128 0eccf52399
🧦 Fix socks client UDP outbound's wrong destination (#522)
- When you connect to a non-localhost socks5 server, in the response of a UdpAssociate from a socks5 server, the remote address may be `::` or `0.0.0.0`. The previous behavior is to connect to the remote address in the response, which obviously fails.
- This commit changes the behavior to dial to the outbound server's address when the remote address in the response is `::` or `0.0.0.0`.
- Rename `cmdUDPPort` to `cmdUDPAssociate` for clarity.
2020-12-16 04:23:40 +08:00
Loyalsoldier 5e99737c12
Fix: close response body (#484) 2020-12-03 16:07:41 +08:00
Loyalsoldier 8cb2db5321
Fix: security issues & overflow potentiality (#465) 2020-11-28 21:56:20 +08:00
Loyalsoldier b68f943c78
Fix lint according to golangci-lint (#439) 2020-11-22 05:05:01 +08:00
Kslr 623cb24644
Remove XTLS (#431)
* remove xtls

* generate pb

* Update protoc

* Clean up go.mod & go.sum

* format code

* restore vless flow

* fix codacy

* do NOT interfere with pb.go files

Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2020-11-20 15:53:10 +08:00
Chinsyo 2ac380788b
Some minor fixes (#433) 2020-11-20 01:02:52 +08:00
Chinsyo 32e0e6e484
Some minor fix (#430)
* fix typo pading to padding

* reorder common/buf/buffer.go code layout

* delete unused common/stack

Co-authored-by: Chinsyo <chinsyo@sina.cn>
2020-11-18 04:23:30 +08:00
Chinsyo dc78733196
Refactor common/antireplay, unexport unnecessary public fields. (#422)
* rename AuthIDDecoderHolder private fields

* ignore unused return value more clear

* change PoolSwap to private fields

* refactor Unlock to defer

* use const capacity, reorder code layout

* replace mismatch field name poolX with type Filter

* change AntiReplayTime to private fileds, protect to modify

* rename lastSwapTime to lastSwap

* merge duplicate time.Now.
Since the current unit is in seconds, there is no need to repeat the call

* refine negate expression

* rename antiReplayTime to interval

* add docs

* fix lint stutter issue, rename antireplay.AntiReplayWindow to antireplay.ReplayFilter

* rename fileds m,n to poolA,poolB

* rename antireplay.go to replayfilter.go

* fix build issue

Co-authored-by: Chinsyo <chinsyo@sina.cn>
2020-11-17 21:05:26 +08:00
RPRX f06ede1bc1
Fix stat 2020-11-12 08:45:03 +00:00
Arthur Morgan e2392491d6
Add V2RAY_TROJAN_XTLS_SHOW (#391)
When using trojan, you can set the environment variable V2RAY_TROJAN_XTLS_SHOW=true to display the output of XTLS
2020-11-07 14:32:42 +00:00
RPRX e8361016ae
VLESS XTLS ReadV 2020-11-03 14:32:17 +00:00
RPRX 21739e6f38
32 -> 0 2020-11-02 11:00:08 +00:00
單dar 于ɦʷa e3b96a1b56
Disable 0-rtt mechanism for http/1 outbound (#372)
Fix #357

Co-authored-by: August Njam Brong <longran1989@gmail.com>
2020-10-31 11:03:46 +08:00