1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 14:26:11 -04:00
v2fly/infra/conf
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
..
command Errorgen: support to run outside of GOPATH 2020-10-04 13:06:12 +08:00
json Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
serial revert: support yaml config 2020-10-20 14:01:16 +08:00
api.go API: Reflection Service Support (#435) 2020-11-20 01:57:31 +08:00
blackhole_test.go merge ext into core 2019-02-10 19:04:11 +01:00
blackhole.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
buildable.go merge ext into core 2019-02-10 19:04:11 +01:00
common_test.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
common.go Refine unix domain socket (#367) 2020-10-29 07:30:38 +00:00
conf.go Errorgen: support to run outside of GOPATH 2020-10-04 13:06:12 +08:00
dns_bootstrap_android.go Feature: android binary runtime default dns set 8.8.8.8:53 (#572) 2021-01-02 15:48:13 +08:00
dns_bootstrap_test.go Feature: android binary runtime default dns set 8.8.8.8:53 (#572) 2021-01-02 15:48:13 +08:00
dns_bootstrap.go Feature: android binary runtime default dns set 8.8.8.8:53 (#572) 2021-01-02 15:48:13 +08:00
dns_proxy_test.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
dns_proxy.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
dns_test.go DNS: add clientip for specific nameserver (#504) 2020-12-12 07:15:29 +08:00
dns.go Feature: android binary runtime default dns set 8.8.8.8:53 (#572) 2021-01-02 15:48:13 +08:00
dokodemo_test.go merge ext into core 2019-02-10 19:04:11 +01:00
dokodemo.go merge ext into core 2019-02-10 19:04:11 +01:00
errors.generated.go merge ext into core 2019-02-10 19:04:11 +01:00
fakedns.go Feature: Fake DNS support (#406) 2021-02-08 18:18:52 +08:00
freedom_test.go merge ext into core 2019-02-10 19:04:11 +01:00
freedom.go fix user level parsing in freedom. fixes #1555 2019-02-16 21:25:19 +01:00
general_test.go merge ext into core 2019-02-10 19:04:11 +01:00
http_test.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
http.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
init.go Feature: Fake DNS support (#406) 2021-02-08 18:18:52 +08:00
lint.go Feature: Fake DNS support (#406) 2021-02-08 18:18:52 +08:00
loader.go merge ext into core 2019-02-10 19:04:11 +01:00
log.go add: mute access/error logger seperately 2019-06-11 15:29:52 +08:00
mtproto_test.go merge ext into core 2019-02-10 19:04:11 +01:00
mtproto.go merge ext into core 2019-02-10 19:04:11 +01:00
policy_test.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
policy.go Add stats counter for outbounds 2020-06-27 00:31:46 -04:00
reverse_test.go merge ext into core 2019-02-10 19:04:11 +01:00
reverse.go merge ext into core 2019-02-10 19:04:11 +01:00
router_test.go Routing: consistent with domains key in DNS configuration (#502) 2020-12-11 21:16:52 +08:00
router.go DNS & Routing: refine rule parsing process (#528) 2020-12-18 08:36:34 +08:00
shadowsocks_test.go remove deprecate ciphers in shadowsocks (#566) 2021-01-01 10:18:00 +08:00
shadowsocks.go remove deprecate ciphers in shadowsocks (#566) 2021-01-01 10:18:00 +08:00
socks_test.go merge ext into core 2019-02-10 19:04:11 +01:00
socks.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
transport_authenticators.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
transport_internet.go Disable session resumption by default (#569) 2021-01-01 17:01:14 +08:00
transport_test.go merge ext into core 2019-02-10 19:04:11 +01:00
transport.go merge ext into core 2019-02-10 19:04:11 +01:00
trojan.go Refine Android build (#525) 2020-12-17 08:50:13 +08:00
v2ray_test.go Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
v2ray.go Feature: Fake DNS support (#406) 2021-02-08 18:18:52 +08:00
vless_test.go Remove XTLS (#431) 2020-11-20 15:53:10 +08:00
vless.go Refine Android build (#525) 2020-12-17 08:50:13 +08:00
vmess_test.go merge ext into core 2019-02-10 19:04:11 +01:00
vmess.go 32 -> 0 2020-11-02 11:00:08 +00:00