1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-11-23 12:02:58 -05:00
Commit Graph

1264 Commits

Author SHA1 Message Date
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
lucifer
770b994337 Refine unix domain socket (#367) 2020-10-29 07:30:38 +00:00
Loyalsoldier
f17063a08a Update vprotogen (#366)
* Refine vprotogen
* Regenerate pb.go files
2020-10-29 09:27:05 +08:00
RPRX
3e87b187c4 Adjust VLESS & Trojan Validator 2020-10-22 04:53:27 +00:00
maskedeken
24f688cc20 Trojan Protocol Handler implements UserManager (#344)
* Trojan Protocol Handler implements UserManager

* Update validator.go

Co-authored-by: RPRX <63339210+rprx@users.noreply.github.com>
2020-10-22 04:01:26 +00:00
RPRX
c325faef38 Adjust Trojan over XTLS 2020-10-21 09:32:16 +00:00
RPRX
13ae4c25ac Add flow to Trojan config.proto 2020-10-21 03:12:44 +00:00
ekenchan
3fc985dd0e Add trojan over xtls support (#334)
* Add trojan over xtls support

* Add comments

* improve PR quality

* improve PR quality

* add xtls-rprx-origin-udp443 and xtls-rprx-direct-udp443

Co-authored-by: Eken Chan <maskedeken@yahoo.com>
2020-10-20 10:44:31 +00:00
Kslr
f7ed96f5d4 Merge pull request #292 from Loyalsoldier/refine-code
Refine code according to golangci-lint results
2020-10-13 13:50:04 +08:00
RPRX
95e7e0dee7 AtWarning() -> AtInfo() 2020-10-13 04:53:34 +00:00
loyalsoldier
784775f689 Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
Loyalsoldier
bb44d01096 Format proto files using clang-format according to google style (#264)
* Format proto files using clang-format according to google style
* Regenerate pb.go files
2020-10-05 08:36:40 +08:00
RPRX
a308620073 Fix 2020-10-05 00:52:03 +08:00
RPRX
b8a78038a2 VLESS PREVIEW 2.3 2020-10-04 10:51:29 +00:00
loyalsoldier
b181045b0c Errorgen: support to run outside of GOPATH 2020-10-04 13:06:12 +08:00
loyalsoldier
7a789fed37 Run go fmt 2020-10-04 06:29:21 +08:00
RPRX
36f0b7d6e4 Fix Trojan inbound access log (#255) 2020-10-03 15:24:04 +00:00
RPRX
271532fc84 Add full VLESS fallbacks support to Trojan (#254)
* Add full VLESS fallbacks support to Trojan

* Adjustments according to linter

* Use common.Must2() for pro.Write()
2020-10-03 13:12:35 +00:00
RPRX
60909dad31 VLESS PREVIEW 2.2 2020-10-03 03:23:24 +00:00
Kslr
9f344fa1c9 remove shadowsosks ota (#238)
* remove shadowsosks ota

* remove unused buf.Reader
2020-10-02 16:13:31 +08:00
RPRX
65565572d3 VLESS UDP over TCP struct breaking change (#239)
具体改变:每个 UDP 载荷前加两字节长度的 length,最大值为 2048-2=2046。若不使用 Mux,服务端与客户端均需升级至 v4.30.0+。这是 VLESS 公测版(0)协议结构本身唯一一次 breaking change,正式版(1)的服务端预计会长期同时支持该版本,第三方客户端的实现应当尽快跟进。
2020-09-30 01:39:03 +00:00
maskedeken
e445d21f4b Add trojan protocol support (#181)
* Add trojan protocol support

Co-authored-by: Eken Chan <ekenchan@msn.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
2020-09-26 23:31:24 +08:00
RPRX
f55e05c166 int -> int32 2020-09-24 12:18:11 +00:00
RPRX
4b0aea1dca Fix bug 2020-09-24 11:22:12 +00:00
RPRX
0e8e23897c Tiny adjustment 2020-09-24 11:09:14 +00:00
RPRX
3072cdccf4 Add return 2020-09-24 11:02:27 +00:00
RPRX
648d4180aa VLESS PREVIEW 2 2020-09-24 01:59:14 +00:00
RPRX
010fbf4d8b Make isAEAD more efficient 2020-09-21 03:20:04 +00:00
RPRX
470dc8523b Make isAEAD more efficient 2020-09-21 01:10:56 +00:00
Kslr
0cbed7e265 Merge pull request #187 from wwqgtxx/master
support disable vmess aead by os environ
2020-09-14 18:04:12 +08:00
wwqgtxx
43174d6951 support disable vmess aead by os environ 2020-09-14 17:49:59 +08:00