1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-20 04:29:32 -04:00
Commit Graph

72 Commits

Author SHA1 Message Date
Loyalsoldier
f94dd11a8c Chore: change module name (#677) 2021-02-17 04:31:50 +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
lucifer
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
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
zhuobixin
dc906cf68a LocalAddr() should return local address 2020-06-05 11:17:02 +08: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
3eac22c27d add missing changes 2018-11-21 14:55:05 +01:00
Darien Raymond
a01fdc29a6 remove NewMultiBufferValue 2018-11-16 11:08:12 +01: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
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
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
cad07c3a83 faster udp reading 2018-05-27 01:19:05 +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
Darien Raymond
59958fed68 refactor udp worker 2018-03-01 14:58:13 +01:00
Darien Raymond
6b872c266c session id 2018-02-22 15:26:00 +01:00
Darien Raymond
1e0b35f869 fix nil reference in udp worker 2018-02-14 13:41:21 +01:00
Darien Raymond
31d1fb6cc3 fix lint errors 2018-02-12 21:35:10 +01:00
Darien Raymond
ae395bbe1f increase udp hub capacity 2018-02-12 15:08:20 +01:00
Darien Raymond
7391b2439e simplify udp hub 2018-02-12 13:14:11 +01:00
Darien Raymond
862f9a152e comments and refactoring 2018-02-08 22:09:55 +01:00
Darien Raymond
efcb567273 remove context in struct 2018-02-08 15:39:46 +01:00
Darien Raymond
384844f898 fix #840 2018-02-02 22:35:18 +01:00
Darien Raymond
292d7cc353 massive refactoring for interoperability 2018-01-10 12:22:37 +01:00
Darien Raymond
2bf5a008f0 fix error levels 2017-12-27 22:25:12 +01:00
Darien Raymond
f4c35db968 merge log into common log 2017-12-19 21:28:12 +01:00
Darien Raymond
5901192a58 fix udp in transparent proxy 2017-10-27 17:13:43 +02:00
Darien Raymond
1c856a46ab step 1 to remove reference to net package 2017-08-29 12:56:57 +02:00
Darien Raymond
e7aaba0c30 refactor 2017-07-25 23:12:54 +02:00
Darien Raymond
5829b45bbe close timer faster 2017-05-09 00:01:15 +02:00
Darien Raymond
77521029b1 support for http and tls header sniffing 2017-04-25 00:19:22 +02:00
Darien Raymond
6a90ce3c43 comments 2017-04-21 15:36:05 +02:00