Commit Graph
119 Commits
Author SHA1 Message Date
Shelikhoo 3ef7feaeaf update version: auto replacement to v5 path 2022-01-02 15:16:23 +00:00
OvearandShelikhoo 36df3b035c Remove unnecessary log.
(cherry picked from commit b3e0d54630)
2021-09-30 15:30:21 +01:00
OvearandShelikhoo 9a8e113ad3 Fix: Remove udp conn twice
(cherry picked from commit 75eead5a6e)

See Also: https://github.com/v2fly/v2ray-core/pull/1305
https://github.com/v2fly/v2ray-core/issues/1297
2021-09-30 15:29:51 +01:00
Shelikhoo ba2dd5995d replace TypedMessage with anypb.Any 2021-09-04 11:13:28 +01:00
LoyalsoldierandGitHub 6f8979d017 Style: format code by gofumpt (#1022) 2021-05-20 05:28:52 +08:00
LoyalsoldierandGitHub f94dd11a8c Chore: change module name (#677) 2021-02-17 04:31:50 +08:00
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
luciferandGitHub 770b994337 Refine unix domain socket (#367) 2020-10-29 07:30:38 +00:00
loyalsoldier 784775f689 Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
loyalsoldier b181045b0c Errorgen: support to run outside of GOPATH 2020-10-04 13:06:12 +08:00
Vigilans 30e312f72b Apply sockopt from inbound config to dokodemo tproxy's response connection 2020-08-01 02:04:06 +08:00
yuhan6665 f34c092a06 Rename fields in StatCouterConnection
The fields will be used by Outbounds as well in the next commit
2020-06-27 00:31:46 -04:00
Shelikhoo 3e13d79af7 Fix TProxy Process Logic 2020-06-18 13:40:48 +08:00
Shelikhoo 85bd352bc1 propagate context 2020-06-18 12:37:10 +08:00
zhuobixinandGitHub dc906cf68a LocalAddr() should return local address 2020-06-05 11:17:02 +08:00
Kirill Motkov 0401a91ef4 Some code improvements
* Rewrite empty string checks more idiomatically.
* Change strings.ToLower comparisons to strings.EqualFold.
* Rewrite switch statement with only one case as if.
2019-06-28 17:53:44 +03:00
Darien Raymond 3828a463ea move sniffing request to session 2019-02-23 00:27:21 +01:00
Darien Raymond b52725cf65 DialUDP function 2019-01-05 21:43:22 +01:00
Darien Raymond bea521537e errors.Combine 2018-12-04 14:17:08 +01:00
Darien Raymond 3eac22c27d add missing changes 2018-11-21 14:55:05 +01:00
Darien Raymond 769f770cf7 migrate NetworkList to []Network 2018-11-20 16:58:26 +01:00
Darien Raymond a01fdc29a6 remove NewMultiBufferValue 2018-11-16 11:08:12 +01:00
Darien Raymond 838f2919ab move mux to common 2018-10-23 12:21:12 +02:00
Darien Raymond a5dcb0f13e refactor dependency resolution 2018-10-21 10:27:13 +02:00
Darien Raymond d730637239 Require Type() for Feature 2018-10-12 23:57:56 +02:00
Darien Raymond 273342d0b9 move stats and inbound to features directory 2018-10-11 21:14:53 +02:00
Darien Raymond b6dc31d3fe first part to move feature interfaces into dedicated directory 2018-10-11 20:43:37 +02:00
Darien Raymond 091fa6ad23 use new errorgen 2018-09-30 23:08:41 +02:00
Darien Raymond d55fbd7f8d simplify error creation 2018-09-30 18:39:53 +02:00
Darien Raymond 9d646d6039 support tproxy in tcp connections 2018-09-23 20:14:07 +02:00
Darien Raymond 94b880d060 move session based info into session package 2018-09-18 23:09:54 +02:00
Darien Raymond 383b84e7dd unified tproxy option 2018-09-17 15:12:58 +02:00
Darien Raymond b3847fb7c0 MemoryStreamSettings 2018-09-07 14:50:25 +02:00
Darien Raymond 91109f3657 replace channel with pipe in udp conn 2018-09-03 00:56:43 +02:00
Darien Raymond 1be86e6e3a update activity in ReadMultiBuffer 2018-09-01 21:19:01 +02:00
Darien Raymond eb05a92592 dont start periodic task until necessary 2018-08-29 23:00:01 +02:00
Darien Raymond 053fc38d38 refine udp hub api 2018-08-11 22:35:01 +02:00
Darien Raymond c0e37ef34a prototype for new sniffing mechanism 2018-07-16 13:47:00 +02:00
Darien Raymond 9977eadf8c remove dependency from errors to session 2018-06-25 01:09:02 +02:00
Darien Raymond b01180b913 fix lint warnings 2018-06-04 14:29:43 +02:00
Darien Raymond ee0ca6cbd2 fix a deadlock 2018-05-31 13:12:36 +02:00
Darien Raymond adade2bffd fix lint warnings 2018-05-31 11:55:11 +02:00
Darien Raymond daa790582f update uplink traffic in read multibuffer 2018-05-29 00:47:22 +02:00
Darien Raymond ac6a0f7511 update activity timer 2018-05-27 14:42:53 +02:00
Darien Raymond 46dbbfff8c fix reading in udp conn 2018-05-27 13:23:41 +02:00
Darien Raymond 13f3c356ca unified task package 2018-05-27 13:02:29 +02:00
Darien Raymond cad07c3a83 faster udp reading 2018-05-27 01:19:05 +02:00
Darien Raymond 68da956fc4 re-generate code 2018-05-25 11:56:01 +02:00
Darien Raymond d6dc88860b simplify done api 2018-04-15 20:40:47 +02:00
Darien Raymond c76d492c0f stats counter for inbound traffic 2018-04-12 00:10:14 +02:00