* stat show json refactor
> will show {} since scripts should expect it, its the json style of blank value
* combine statistics commands to one
* code optimize
* fix runtime flag
* remove json indent
* change overridden to override
* api bi -json
* convert stdin support
code optimize
* writeRow() code optimize
add stats tittle
revert back to restartlogger
* api log -restart
* follow log
* codeql
* move -json to shared flags
* flags optimize
* update flag descriptions
* change "-v" of "api bo" to duration
* change "-expire" of "tls cert" to days
* cmds short description optimize
* fix multiple log followers
* Format loader refactor
* "infra/conf/merge" refactor
* "LoadConfig" refactor
* add "infra/conf/mergers"
* contribute to it will benifit `v2ray run`,`v2ray test`,`v2ray convert`
* easily add new formats, by just adding a converter like json.FromTOML
* default format auto, to all cmds above
* auto detect input format
* mixed formats support
* better stdin behavior
* don't wait if no content
* don't use 'stdin:' placeholder
* `v2ray test` now behaves exactly the same with `v2ray run`, including stdin reading
* api ado, adi, rmo, rmi refactor
* support folders to files resolving, mixed formats
* remove remaining 'stdin:' placeholders
* fix tests
* os.Stdin.Stat() behaves different in platforms, removed
* code optimize
Co-authored-by: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
* 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>
* generate .pb.go
* health checker conf
* check logic
* implement ping
* fix check interval
* improve check results
* health check on add outbounds
* fix tests
* fix ping handler
* fix min rtt < 0
* random alive
* fix check all on add outbounds
* least load strategy
* conf codes optimize
* improve least load strategy
* improve health check on AddOutboundHandler
* cleanup results with scheduler
code optimize
* health ping timeout default 5s
* remove config of health ping round
round 1 seems to be good enough
* fix TestSimpleBalancer
* add TestLeastLoadBalancer
* add todos
* lint and test fix
* balancer fallback
* api health stats command
* add hc cmd to perform health checks
* rename 'health stats' cmd to hci
* many code optimizations
* fix typo
* select none if no match for baselines only config
> prev 'select 1' behavior can achieved by baselines+expected=1
* add LeastLoadStrategy tests
* don't select alive on no match, go to fallback
* api hci refactor
* more detailed info
* ready for future new strategies
* apply lint style
* refactor: strategies don't need ref of balancer
* change check interval unit to seconds
> to reduce influence caused by what is described by new added FIXME
* fix test
* RouterService->RoutingService
* Revert "generate .pb.go"
This reverts commit 0e6fa1be889470d0ad9692f7279da45c030e1919.
* make checks distributed
> but `api hc` is the exception
* BalancingStrategy interface optimize
* fix random selects unchecked
* upgrade cmd hci to bi & rename hc to bc
* bi shows all balancers, while hci shows only heath-check-enabled ones
* shows more info
* fix test
* api bi sort output
* update according to review
* remove checks on add outbound
* refactor: move health checker inside to strategy
* enables rounds setting for health ping
* restore the random behavior, no ping, no pick alive
> if future strategy based on HealthPing, just embed it like what LeastLoad does
* apply lint style
* code optimize
* fix typo
* update desc of bc bi
* ping with head
code optimize
* force rouds to 1 if checks not distributed
* leatload: select by standard deviations
* health ping refactor
* continuously applying results
* config is easier to understand
* checker interfaces simplifying
* add maxRTT config to filter away high delay nodes
* apply lint
* cost for leastload
* api bo to override balancer selecting
* fix health ping statistics & fix test
* check connectivity if ping fail
* add tolerance setting & more detailed bi output
* fix connectivity check
* optimize bi output
* should not put results when network is down
* fixes @_@
* mux optimize
* remove pause option of selecting overriding
> it causes data racing
* update bo desc
* fix potential racing
* simplify locking
* switch sync.Mutex to avoid potential racing
* add more tests
* code optimize
* code optimize
* fix connectivity check when url not set