Commit Graph

858 Commits

Author SHA1 Message Date
Loyalsoldier f94dd11a8c
Chore: change module name (#677) 2021-02-17 04:31:50 +08:00
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
database64128 484d740800
🔙 Revert "Add traffic stat of every request in access log (#642)" (#644)
This reverts commit af0120e771.
2021-01-30 20:32:34 +08:00
刘志龙 af0120e771
Add traffic stat of every request in access log (#642)
* Add traffic stat of every request in access log

* Fix: record pointer may be null

* Clarify the data unit in access log
2021-01-30 01:47:13 +08:00
DarthVader de618121ad
Refactor: A faster DomainMatcher implementation (#587)
* a faster DomainMatcher implementation

* rename benchmark name

* fix linting errors
2021-01-20 15:53:07 +08:00
loyalsoldier 87e857ee3f
Chore: minor fixes 2021-01-01 12:52:04 +08:00
V2Fly Team 66e203f156
DNS: refine skipRoutePick (#558) 2020-12-30 18:35:19 +08:00
maskedeken 8c5b392f27
DNS: add DNS over QUIC support (#534) 2020-12-25 19:13:50 +08:00
Loyalsoldier c27ed16e6a
Fix: DNS compatible with `localhost` nameserver (#530) 2020-12-19 12:17:55 +08:00
Ye Zhihao d8c03f10b5
Refactoring: DNS App (#169)
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2020-12-18 17:24:33 +08:00
Loyalsoldier d9db22093b
Fix: write to log without clientIP (#517) 2020-12-15 16:59:23 +08:00
Loyalsoldier 166d1afee5
DNS: add clientip for specific nameserver (#504) 2020-12-12 07:15:29 +08:00
Loyalsoldier b68f943c78
Fix lint according to golangci-lint (#439) 2020-11-22 05:05:01 +08:00
Ye Zhihao 5b2a9e8769
API: Reflection Service Support (#435) 2020-11-20 01:57:31 +08:00
Chinsyo 2ac380788b
Some minor fixes (#433) 2020-11-20 01:02:52 +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
loyalsoldier 784775f689
Refine code according to golangci-lint results 2020-10-11 19:22:46 +08:00
Loyalsoldier 807922f883
Reduce timeout & fix ineffassign (#290) 2020-10-09 16:32:12 +08:00
Loyalsoldier 454528353d
Fix misspelling according to goreportcard result (#282) 2020-10-08 08:53:15 +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
loyalsoldier b181045b0c
Errorgen: support to run outside of GOPATH 2020-10-04 13:06:12 +08:00
loyalsoldier f184d16918
Fix golangci nolint 2020-10-04 06:29:35 +08:00
Loyalsoldier 088ce4ed95
Refine proto.go due to protoc-gen-go-grpc update (#257)
* Refine: remove protoc-gen-go-grpc specific version
* pb.go: regenerate due to proto.go refresh
2020-10-04 05:43:26 +08:00
Ye Zhihao 67f409de04
Stats: Implements blocking/non-blocking messaging of Channel (#250) 2020-10-03 03:06:32 +08:00
Kslr 211cc67426
Merge pull request #208 from Vigilans/vigilans/stats-routing
API: Implements RoutingService
2020-09-26 23:23:38 +08:00
loyalsoldier ec0c3f181d
DNS: refine local TLDs for localhost DNS 2020-09-26 22:30:44 +08:00
Vigilans cd9ac1bac7 API: Implements RoutingService 2020-09-24 10:24:26 +08:00
Vigilans fa37f82b89 Stats: Add ChannelConfig & Return error on subscription 2020-09-23 22:35:13 +08:00
Kslr 525d4e13a9
Merge pull request #197 from Vigilans/vigilans/stats-channel-runnable
Stats: Implement common.Runnable for Channel feature
2020-09-20 22:39:46 +08:00
Vigilans 4d5a4f4cb6 Routing: Implement Route interface as the routing result of Router 2020-09-18 17:30:59 +08:00
Vigilans 4fca2fe940 Implement common.Runnable for stats.Channel feature 2020-09-15 23:04:26 +08:00
Vigilans 5a497890e6 Routing Context: Fix GetUser() & Use string for Attributes Value 2020-09-13 00:34:35 +08:00
Vigilans 0406cd896b Add UnregisterChannel & Modify unregistering logic 2020-09-09 11:33:29 +08:00
Loyalsoldier d7c99c901a
Fix: app/stats.Manager does not implement features/stats.Manager (#171) 2020-09-09 11:26:23 +08:00
Vigilans bff96a7a52 Support Channel (Observer Pattern) in Stats Manager 2020-09-04 15:07:42 +08:00
Vigilans f9d37b724c Extract session information during routing as routing context 2020-09-04 11:32:19 +08:00
Felix Yan 7001483b62
Don't copy assets if they are already present
They can now reside in system path (like /usr/share/v2ray), so it's not
possible to copy into there.
2020-09-03 16:17:44 +08:00
loyalsoldier 323ef03f02
Minor fixes 2020-09-01 08:46:55 +08:00
Vigilans c973b5a484 Fix github.com/v2fly/v2ray-core/issues/146 2020-08-31 12:40:27 +08:00
Vigilans 47c997d75e Fix github.com/v2fly/v2ray-core/issues/146 2020-08-31 12:21:56 +08:00
loyalsoldier f12f76582f
Fix according to staticcheck result
staticcheck repo: https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
2020-08-30 23:41:15 +08:00
loyalsoldier 1fa89b32d4
Format: run go fmt ./... 2020-08-30 21:17:22 +08:00
loyalsoldier f9175e3bc8
Fix according to go vet results 2020-08-26 19:35:33 +08:00
Loyalsoldier ef460f68f8
Adjust Protocol Buffers (#109)
* Update protoc binary executable files to v3.13.0

* Write proto files in more standard way

* Make go generate & vprotogen compatible with protoc-gen-gofast

* Regenerate pb.go files according to new proto files

* Clean go.sum by running go mod tidy

* Implement mustEmbedUnimplementedServiceServer for gPRC services
2020-08-24 12:10:26 +00:00
loyalsoldier 00b4217aab
Fix: loging empty rules & DNS 2020-08-22 19:07:14 +08:00
Vigilans 22b4e68a2d Log matched rules and DNS to use during priority matching
2. Dotless domain support in static host & modify first letter's captial in log
2020-08-16 22:18:28 +08:00
Vigilans dfeaef75e7 Refactor DNS Server to record original rule of domain matchers 2020-08-16 22:18:12 +08:00
Vigilans 1e222425b6 Amend domain matcher with returning values of all matched subdomains 2020-08-13 15:26:30 +08:00