1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 18:00:43 +00:00
Commit Graph

5394 Commits

Author SHA1 Message Date
Jebbs
ebbf31f07e
improve commands (#648)
* 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>
2021-02-21 23:02:42 +08:00
loyalsoldier
d581fb9c00
Merge branch 'master' into v5 2021-02-17 08:07:12 +08:00
Loyalsoldier
0000b60a36
Chore: update dependencies (#681) 2021-02-17 06:49:41 +08:00
Loyalsoldier
4aa536292e
Fix: codeql workflow alert (#682) 2021-02-17 06:36:02 +08:00
Loyalsoldier
612bf6a65d
Chore: update LICENSE year (#680) 2021-02-17 05:27:52 +08:00
Loyalsoldier
aa1cc3da0a
Chore: refine .gitignore (#679) 2021-02-17 05:23:08 +08:00
Loyalsoldier
07a63bc901
Chore: refine workflows (#678) 2021-02-17 05:16:31 +08:00
Loyalsoldier
f94dd11a8c
Chore: change module name (#677) 2021-02-17 04:31:50 +08:00
loyalsoldier
af9ffc70cb
Feat: use protobuf v2 2021-02-16 09:50:31 +08:00
loyalsoldier
02a8c41023
Merge branch 'master' into v5 2021-02-16 09:48:41 +08:00
dependabot[bot]
0957442e01
Chore: bump golangci/golangci-lint-action from v2.3.0 to v2.4.0 (#674)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from v2.3.0 to v2.4.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2.3.0...544d2efb307b3f205f34886f2787046abe7fb26e)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-15 15:49:24 +08:00
GitHub Action
f4f4e4280d update geoip, geosite 2021-02-12 00:09:59 +00:00
Loyalsoldier
afcbb4feb8
Chore: update dependencies (#671) 2021-02-11 15:14:18 +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
dyhkwong
d8bc41e653
support enforcing VMessAEAD via environment variable (#596)
* support enforcing VMessAEAD via env var

to prevent downgrade attack

* Add comments to make Codacy Production happy
2021-02-08 18:08:01 +08:00
dependabot[bot]
51af372bed
Chore: bump actions/cache from v2 to v2.1.4 (#659)
Bumps [actions/cache](https://github.com/actions/cache) from v2 to v2.1.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...26968a09c0ea4f3e233fdddbafd1166051a095f6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-08 14:56:22 +08:00
dependabot[bot]
986d3c44fa
Chore: bump actions/stale from v3.0.15 to v3.0.16 (#660)
Bumps [actions/stale](https://github.com/actions/stale) from v3.0.15 to v3.0.16.
- [Release notes](https://github.com/actions/stale/releases)
- [Commits](https://github.com/actions/stale/compare/v3.0.15...9d6f46564a515a9ea11e7762ab3957ee58ca50da)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-08 14:55:16 +08:00
GitHub Action
108546a8cd update geoip, geosite 2021-02-05 00:10:02 +00:00
dependabot[bot]
ee673062af
Chore: bump github.com/miekg/dns from 1.1.37 to 1.1.38 (#652) 2021-02-02 14:29:17 +08:00
dependabot[bot]
440509f930
Chore: bump github.com/miekg/dns from 1.1.35 to 1.1.37 (#647)
Bumps [github.com/miekg/dns](https://github.com/miekg/dns) from 1.1.35 to 1.1.37.
- [Release notes](https://github.com/miekg/dns/releases)
- [Changelog](https://github.com/miekg/dns/blob/master/Makefile.release)
- [Commits](https://github.com/miekg/dns/compare/v1.1.35...v1.1.37)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-01 21:32:45 +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
Jebbs
2c5a714903
v5: Health Check & LeastLoad Strategy (#589)
* 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
2021-01-30 08:31:11 +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
dependabot[bot]
74a8e0c71a
Chore: bump github.com/pires/go-proxyproto from 0.4.1 to 0.4.2 (#643)
Bumps [github.com/pires/go-proxyproto](https://github.com/pires/go-proxyproto) from 0.4.1 to 0.4.2.
- [Release notes](https://github.com/pires/go-proxyproto/releases)
- [Commits](https://github.com/pires/go-proxyproto/compare/v0.4.1...v0.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-29 17:14:42 +08:00
GitHub Action
45df9b9fdf update geoip, geosite 2021-01-29 00:14:37 +00:00
Loyalsoldier
08b0abe675
Chore: refine issue templates (#630) 2021-01-28 09:08:38 +08:00
dependabot[bot]
0b9a5443f7
Chore: bump google.golang.org/grpc from 1.34.1 to 1.35.0 (#606)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.34.1 to 1.35.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.34.1...v1.35.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-27 18:26:54 +08:00
dependabot[bot]
0d15e93917
Chore: bump actions/stale from v3.0.14 to v3.0.15 (#632) 2021-01-25 15:27:06 +08:00
GitHub Action
be14c6b46e update geoip, geosite 2021-01-22 00:41:07 +00:00
dependabot[bot]
daa87de9ea
Chore: bump github.com/pires/go-proxyproto from 0.4.0 to 0.4.1 (#623)
Bumps [github.com/pires/go-proxyproto](https://github.com/pires/go-proxyproto) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/pires/go-proxyproto/releases)
- [Commits](https://github.com/pires/go-proxyproto/compare/v0.4.0...v0.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-21 16:14:03 +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
dependabot[bot]
c89aae1380
Chore: bump github.com/stretchr/testify from 1.6.1 to 1.7.0 (#607)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-19 18:12:32 +08:00
dependabot[bot]
ef1f0a3ac3
Chore: bump github.com/pires/go-proxyproto from 0.3.3 to 0.4.0 (#618)
Bumps [github.com/pires/go-proxyproto](https://github.com/pires/go-proxyproto) from 0.3.3 to 0.4.0.
- [Release notes](https://github.com/pires/go-proxyproto/releases)
- [Commits](https://github.com/pires/go-proxyproto/compare/v0.3.3...v0.4.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-19 18:11:01 +08:00
GitHub Action
feec88c90a update geoip, geosite 2021-01-15 00:39:50 +00:00
dependabot[bot]
17592cb73d
Chore: bump google.golang.org/grpc from 1.34.0 to 1.34.1 (#602)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.34.0 to 1.34.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.34.0...v1.34.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-12 14:33:23 +08:00
loyalsoldier
c0c815bd52
Merge branch 'master' into v5 2021-01-12 10:46:59 +08:00
Loyalsoldier
f5ad09103f
Chore: format code (#600) 2021-01-12 10:44:12 +08:00
Kslr
795a3f632d
Test: fix race issue (#598)
other "race" problems are only in the test, and so I deleted the detection
2021-01-11 20:50:58 +08:00
maskedeken
9f8cb8bc8b
Fix: trojan: do not panic when UDP dispatcher fails to write response (#599) 2021-01-11 17:13:59 +08:00
Kslr
405a051c50
Test: fix http2 dial timeout (#570)
* fix http2 dial timeout
2021-01-11 17:03:03 +08:00
GitHub Action
78e01a37c7 update geoip, geosite 2021-01-08 00:26:54 +00:00
kslr
73e2887f6e Deb: only trigger debian when released 2021-01-05 08:58:46 +08:00
Kslr
d1b39398a9
Deb: only branch match 2021-01-04 22:20:55 +08:00
kslr
52f158d054 Deb: update version 2021-01-04 22:15:22 +08:00
database64128
a6efb4d60b
🆙 Bump version to v4.34.0 2021-01-04 19:19:44 +08:00
kslr
226416e81f Test: add race detector
ref: https://golang.org/doc/articles/race_detector.html
2021-01-04 10:51:31 +08:00
kslr
d04a786a85 Fix: http2: listen port failed use error level log
ref https://github.com/v2fly/v2ray-core/issues/576
2021-01-03 07:11:59 +08:00
CalmLong
3eb13868f2
Feature: android binary runtime default dns set 8.8.8.8:53 (#572)
ref https://github.com/golang/go/issues/8877
ref https://github.com/v2ray/v2ray-core/issues/1909
2021-01-02 15:48:13 +08:00
秋のかえで
36ba06837f
V5: Add TOML Support (#564) 2021-01-01 22:18:47 +08:00