Commit Graph
55 Commits
Author SHA1 Message Date
VigilansandGitHub f8ac919d66 [app/dns] Support per-client configuration for fakedns (#2212)
* Move `filterIP` from `hosts.go` to `dnscommon.go`

* Implement adding pools for fakedns.HolderMulti

* Implement per-client fakedns for DNS app

* Remove `dns.ClientWithIPOption` and replace with new programming model

* Implement JSON config support for new fakedns config

* Fix lint and tests

* Fix some codacy analysis
2022-12-15 10:38:28 +08:00
VigilansandGitHub d3b50bb989 Feat: [app/dns] Support per-client configuration (#1977)
* DNS: Support per-client configuration

* Add deprecated feature warnings for `skipFallback`, `disableCache`, `disableFallback`, `disableFallbackIfMatch`
2022-11-30 08:43:39 +08:00
Shelikhoo 3ef7feaeaf update version: auto replacement to v5 path 2022-01-02 15:16:23 +00:00
JebbsandShelikhoo b05a469488 v5: Remove v2ctl & wv2ray (rebased from 7c1ab06206) 2021-09-04 11:09:55 +01:00
database64128andGitHub c78ee5aac7 🏡 Housekeeping: Update to Go 1.17 (#1215)
* ⬆ Update to Go 1.17

* 🏗 Update workflows and add windows-arm64

* 💾 Update generated files

* 📛 Update not-so-friendly filenames
2021-08-21 13:20:40 +08:00
LoyalsoldierandGitHub a783cd5f08 DNS: refine code (#1193) 2021-08-10 11:08:05 +08:00
f84a401704 Feat: DNS transport over TCP (#983)
* feat: DNS over TCP

* fix: DNS over TCP misbehaving

* fix: add a blank line after +build tag

* style: rename NewTCPLNameServer to NewTCPLocalNameServer

* style: add some comments

* style: format

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
2021-06-04 20:09:06 +01:00
LoyalsoldierandGitHub 3f40089caf Feat: add disableFallback & skipFallback option for DNS (#864) 2021-04-09 10:35:26 +08:00
LoyalsoldierandGitHub 45740be4af Fix panic: index out of range (#727) 2021-03-03 16:53:42 +08:00
7ebf3afc31 Feat: add disableCache option for DNS (#705)
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2021-02-24 16:03:50 +08:00
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
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
maskedekenandGitHub 8c5b392f27 DNS: add DNS over QUIC support (#534) 2020-12-25 19:13:50 +08:00
d8c03f10b5 Refactoring: DNS App (#169)
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2020-12-18 17:24:33 +08:00
loyalsoldier 784775f689 Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
vcptr ceb77ac8f5 only add to ipIndexMap if GeoIP is configured
clearer logging for expectIPs

refactor dns init code

optimal to default port logic

clear message exit if doh met error
2019-11-26 13:05:19 +08:00
Darien Raymond 95ed5a5ff8 comments 2019-02-23 00:01:23 +01:00
Darien Raymond 1ab94fed79 optimize v2ctl size 2019-02-01 20:08:21 +01:00
Darien Raymond daa8c9c5da rename NameServerInterface to Client 2018-12-28 20:28:31 +01:00
Darien Raymond 1cc3a4832d fix logic for adding localhost dns 2018-11-22 16:29:09 +01:00
Darien Raymond bb1efdebd1 support querying either IPv4 or IPv6 dns 2018-11-19 20:42:02 +01:00
Darien Raymond f227e85b54 support per-domain prioritized name server 2018-08-24 21:51:03 +02:00
Darien Raymond c9e35bb1ba fix localnameserver creation 2018-06-27 11:23:39 +02:00
Darien Raymond 2fb77d6911 consume context in local nameserver. 2018-06-26 15:16:45 +02:00
Darien Raymond 9cfb2bfd51 simplify classic dns server 2018-06-26 15:04:47 +02:00
Darien Raymond 13f3c356ca unified task package 2018-05-27 13:02:29 +02:00
Darien Raymond 9f198d7e3d fix lint errors 2018-04-04 00:29:30 +02:00
Darien Raymond 649119493b remove pending request from cache when error. fixes #942 2018-03-10 09:34:38 +01:00
Darien Raymond 0a3b3d0b6d refactor UDPNameServer clean up task 2018-02-22 17:29:21 +01:00
Darien Raymond 6a7887b655 fix LocalNameServer 2018-01-10 13:32:48 +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 e736c08794 report pack error instead of panic 2017-12-23 21:11:17 +01:00
Darien Raymond ab4f245313 overrideable dns 2017-12-19 23:55:09 +01:00
Darien Raymond c4144af223 decouple dns server 2016-12-16 16:20:12 +01:00
Darien Raymond eee23e6718 fix api usage 2016-12-11 21:43:16 +01:00
dd 20c330d03c fix dns query 2016-12-12 00:12:58 +08:00
Darien Raymond 055023fdd5 refactor buffer 2016-12-09 12:08:25 +01:00
Darien Raymond 7a80409e30 rename alloc to buf 2016-12-09 11:35:27 +01:00
Darien Raymond cf3eb0e77d refine buffer usage 2016-12-05 15:19:14 +01:00
Darien Raymond f95c322677 rename 'this' 2016-11-27 21:39:09 +01:00
Darien Raymond 9471b5b066 refine dispatcher 2016-11-13 14:33:00 +01:00
Darien Raymond e6e0419958 format private annotation 2016-08-24 11:17:42 +02:00
v2ray 07a86f549b unified import path 2016-08-20 20:55:45 +02:00
v2ray a9d583b92f connection session 2016-08-14 17:08:01 +02:00
v2ray bcd27ba36f option to allow passive connection 2016-08-12 23:37:21 +02:00
v2ray ea39a6fde6 format code 2016-07-24 13:44:29 +02:00
v2ray 98cc28a4c4 leverage dice.Roll 2016-06-29 23:53:50 +02:00
v2ray 9b6dc6bcea massive refactoring for kcp 2016-06-14 22:54:08 +02:00