├── .github
├── dependabot.yml
└── workflows
│ ├── deploy.yml
│ └── stale.yml
├── .gitignore
├── LICENSE
├── README.md
├── docs
├── .vuepress
│ ├── components
│ │ ├── Tool.vue
│ │ └── Uuid.vue
│ ├── config.ts
│ ├── public
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon.png
│ │ ├── arch.svg
│ │ ├── browserconfig.xml
│ │ ├── dns_flowchart.svg
│ │ ├── dns_flowchart_20210418.svg
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ ├── mstile-144x144.png
│ │ ├── mstile-150x150.png
│ │ ├── mstile-310x150.png
│ │ ├── mstile-310x310.png
│ │ ├── mstile-70x70.png
│ │ ├── readme-logo.png
│ │ ├── safari-pinned-tab.svg
│ │ ├── site.webmanifest
│ │ ├── tools
│ │ │ ├── android.svg
│ │ │ ├── apple.svg
│ │ │ ├── ios.svg
│ │ │ ├── linux.svg
│ │ │ └── win.svg
│ │ └── v2ray.png
│ └── styles
│ │ └── index.scss
├── README.md
├── awesome
│ └── tools.md
├── config
│ ├── api.md
│ ├── browserforwarder.md
│ ├── dns.md
│ ├── env.md
│ ├── fakedns.md
│ ├── inbounds.md
│ ├── multiple_config.md
│ ├── observatory.md
│ ├── outbounds.md
│ ├── overview.md
│ ├── policy.md
│ ├── protocols
│ │ ├── blackhole.md
│ │ ├── dns.md
│ │ ├── dokodemo.md
│ │ ├── freedom.md
│ │ ├── http.md
│ │ ├── hy2.md
│ │ ├── loopback.md
│ │ ├── shadowsocks.md
│ │ ├── socks.md
│ │ ├── trojan.md
│ │ ├── vless.md
│ │ └── vmess.md
│ ├── reverse.md
│ ├── routing.md
│ ├── service.md
│ ├── service
│ │ ├── backgroundObservatory.md
│ │ ├── browser.md
│ │ ├── burstObservatory.md
│ │ ├── policy.md
│ │ ├── stats.md
│ │ ├── subscription.md
│ │ └── tun.md
│ ├── stats.md
│ ├── transport.md
│ └── transport
│ │ ├── domainsocket.md
│ │ ├── grpc.md
│ │ ├── h2.md
│ │ ├── hy2.md
│ │ ├── mkcp.md
│ │ ├── quic.md
│ │ ├── tcp.md
│ │ └── websocket.md
├── developer
│ ├── intro
│ │ ├── compile.md
│ │ ├── design.md
│ │ ├── guide.md
│ │ ├── releasearchive.md
│ │ └── releasesigning.md
│ └── protocols
│ │ ├── mkcp.md
│ │ ├── muxcool.md
│ │ └── vmess.md
├── en_US
│ ├── README.md
│ ├── awesome
│ │ └── tools.md
│ ├── config
│ │ ├── api.md
│ │ ├── browserforwarder.md
│ │ ├── dns.md
│ │ ├── env.md
│ │ ├── fakedns.md
│ │ ├── inbounds.md
│ │ ├── multiple_config.md
│ │ ├── observatory.md
│ │ ├── outbounds.md
│ │ ├── overview.md
│ │ ├── policy.md
│ │ ├── protocols
│ │ │ ├── blackhole.md
│ │ │ ├── dns.md
│ │ │ ├── dokodemo.md
│ │ │ ├── freedom.md
│ │ │ ├── http.md
│ │ │ ├── hy2.md
│ │ │ ├── loopback.md
│ │ │ ├── shadowsocks.md
│ │ │ ├── socks.md
│ │ │ ├── trojan.md
│ │ │ ├── vless.md
│ │ │ └── vmess.md
│ │ ├── reverse.md
│ │ ├── routing.md
│ │ ├── service.md
│ │ ├── service
│ │ │ ├── backgroundObservatory.md
│ │ │ ├── browser.md
│ │ │ ├── burstObservatory.md
│ │ │ ├── policy.md
│ │ │ ├── stats.md
│ │ │ ├── subscription.md
│ │ │ └── tun.md
│ │ ├── stats.md
│ │ ├── transport.md
│ │ └── transport
│ │ │ ├── domainsocket.md
│ │ │ ├── grpc.md
│ │ │ ├── h2.md
│ │ │ ├── hy2.md
│ │ │ ├── mkcp.md
│ │ │ ├── quic.md
│ │ │ ├── tcp.md
│ │ │ └── websocket.md
│ ├── developer
│ │ ├── intro
│ │ │ ├── compile.md
│ │ │ ├── design.md
│ │ │ ├── guide.md
│ │ │ ├── releasearchive.md
│ │ │ └── releasesigning.md
│ │ └── protocols
│ │ │ ├── mkcp.md
│ │ │ ├── muxcool.md
│ │ │ └── vmess.md
│ ├── guide
│ │ ├── command.md
│ │ ├── faq.md
│ │ ├── help.md
│ │ ├── install.md
│ │ ├── start.md
│ │ └── workflow.md
│ └── v5
│ │ └── config
│ │ ├── dns.md
│ │ ├── geo.md
│ │ ├── inbound.md
│ │ ├── outbound.md
│ │ ├── overview.md
│ │ ├── protocol
│ │ ├── server_spec.md
│ │ └── user.md
│ │ ├── proxy.md
│ │ ├── proxy
│ │ ├── blackhole.md
│ │ ├── dns.md
│ │ ├── dokodemo.md
│ │ ├── freedom.md
│ │ ├── http.md
│ │ ├── hy2.md
│ │ ├── loopback.md
│ │ ├── shadowsocks.md
│ │ ├── shadowsocks2022.md
│ │ ├── socks.md
│ │ ├── trojan.md
│ │ ├── vless.md
│ │ ├── vlite.md
│ │ └── vmess.md
│ │ ├── router.md
│ │ ├── service.md
│ │ ├── service
│ │ ├── backgroundObservatory.md
│ │ ├── browser.md
│ │ ├── burstObservatory.md
│ │ ├── filesystemstorage.md
│ │ ├── policy.md
│ │ ├── stats.md
│ │ ├── subscription.md
│ │ └── tun.md
│ │ ├── stream.md
│ │ └── stream
│ │ ├── grpc.md
│ │ ├── httpupgrade.md
│ │ ├── hy2.md
│ │ ├── kcp.md
│ │ ├── meek.md
│ │ ├── mekya.md
│ │ ├── quic.md
│ │ ├── tcp.md
│ │ └── websocket.md
├── guide
│ ├── command.md
│ ├── faq.md
│ ├── help.md
│ ├── install.md
│ ├── start.md
│ └── workflow.md
└── v5
│ └── config
│ ├── dns.md
│ ├── geo.md
│ ├── inbound.md
│ ├── outbound.md
│ ├── overview.md
│ ├── protocol
│ ├── server_spec.md
│ └── user.md
│ ├── proxy.md
│ ├── proxy
│ ├── blackhole.md
│ ├── dns.md
│ ├── dokodemo.md
│ ├── freedom.md
│ ├── http.md
│ ├── hy2.md
│ ├── loopback.md
│ ├── shadowsocks.md
│ ├── shadowsocks2022.md
│ ├── socks.md
│ ├── trojan.md
│ ├── vless.md
│ ├── vlite.md
│ └── vmess.md
│ ├── router.md
│ ├── service.md
│ ├── service
│ ├── backgroundObservatory.md
│ ├── browser.md
│ ├── burstObservatory.md
│ ├── filesystemstorage.md
│ ├── policy.md
│ ├── stats.md
│ ├── subscription.md
│ └── tun.md
│ ├── stream.md
│ └── stream
│ ├── grpc.md
│ ├── httpupgrade.md
│ ├── hy2.md
│ ├── kcp.md
│ ├── meek.md
│ ├── mekya.md
│ ├── quic.md
│ ├── tcp.md
│ └── websocket.md
├── package.json
└── yarn.lock
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "github-actions"
9 | directory: "/"
10 | schedule:
11 | interval: "daily"
12 | timezone: "Asia/Shanghai"
13 | time: "07:00"
14 | pull-request-branch-name:
15 | separator: "-"
16 |
17 | - package-ecosystem: "npm"
18 | directory: "/"
19 | schedule:
20 | interval: "daily"
21 | timezone: "Asia/Shanghai"
22 | time: "07:00"
23 | pull-request-branch-name:
24 | separator: "-"
25 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy Vuepress
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v3
14 | with:
15 | fetch-depth: 0
16 |
17 | - name: Install and Build
18 | run: |
19 | yarn install
20 | yarn build
21 |
22 | - name: Upload artifact
23 | uses: actions/upload-pages-artifact@v3
24 | with:
25 | path: docs/.vuepress/dist
26 |
27 | deploy:
28 | runs-on: ubuntu-latest
29 | needs: build
30 | permissions:
31 | pages: write
32 | id-token: write
33 | environment:
34 | name: github-pages
35 | url: ${{ steps.deployment.outputs.page_url }}
36 | steps:
37 | - name: Deploy to GitHub Pages
38 | id: deployment
39 | uses: actions/deploy-pages@v4
40 |
--------------------------------------------------------------------------------
/.github/workflows/stale.yml:
--------------------------------------------------------------------------------
1 | name: Mark stale issues and pull requests
2 |
3 | on:
4 | schedule:
5 | - cron: "30 1 * * *"
6 |
7 | jobs:
8 | stale:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/stale@v8
14 | with:
15 | repo-token: ${{ secrets.GITHUB_TOKEN }}
16 | stale-issue-label: 'no-issue-activity'
17 | stale-pr-label: 'no-pr-activity'
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 |
4 | # VSCode
5 | .vscode
6 |
7 | # Vuepress generated static page
8 | docs/.vuepress/dist
9 | docs/.vuepress/.cache
10 | docs/.vuepress/.temp
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # V2Fly Website & Documentation
2 |
3 | Translation contribution is on [Transifex](https://explore.transifex.com/v2fly/v2fly-docs/).
4 |
--------------------------------------------------------------------------------
/docs/.vuepress/components/Tool.vue:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
72 |
73 |
78 |
--------------------------------------------------------------------------------
/docs/.vuepress/components/Uuid.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
30 |
67 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/android-chrome-192x192.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/android-chrome-512x512.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #da532c
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/favicon-16x16.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/favicon-32x32.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/favicon.ico
--------------------------------------------------------------------------------
/docs/.vuepress/public/mstile-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/mstile-144x144.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/mstile-150x150.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/mstile-310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/mstile-310x150.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/mstile-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/mstile-310x310.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/mstile-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/mstile-70x70.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/readme-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/readme-logo.png
--------------------------------------------------------------------------------
/docs/.vuepress/public/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Project V",
3 | "short_name": "Project V",
4 | "icons": [
5 | {
6 | "src": "/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/tools/android.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/tools/apple.svg:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/tools/win.svg:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/docs/.vuepress/public/v2ray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/v2fly/v2fly-github-io/bf70ca944671fa12dbaca45ec0dbcd1924861664/docs/.vuepress/public/v2ray.png
--------------------------------------------------------------------------------
/docs/.vuepress/styles/index.scss:
--------------------------------------------------------------------------------
1 | div.theme-default-content:not(.custom) {
2 | max-width: 100%;
3 | }
4 | html:not(.dark) blockquote {
5 | color: #000;
6 | }
7 | blockquote {
8 | border-left: 4px solid #64b5f6;
9 | border-top: 1px solid #64b5f6;
10 | }
11 | .home .hero img {
12 | max-height: 240px !important;
13 | }
14 | :root, html.dark {
15 | scroll-behavior: smooth;
16 |
17 | --c-brand: #ea0880;
18 | --c-brand-light: #ea0880cc;
19 | }
20 | html.dark .home .hero .action-button.primary {
21 | color: white;
22 | }
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | home: true
3 | heroImage: /v2ray.png
4 | heroText: Project V
5 | tagline: 助你打造专属基础通信网络
6 | actions:
7 | - text: 快速开始 →
8 | link: /guide/start.html
9 | type: primary
10 | features:
11 | - title: 多入口多出口
12 | details: 一个 V2Ray 进程可并发支持多个入站和出站协议,每个协议可独立工作。
13 | - title: 定制化路由
14 | details: 入站流量可按配置由不同地出口发出。轻松实现按区域或按域名分流,以达到最优的网络性能。
15 | - title: 多协议支持
16 | details: V2Ray 可同时开启多个协议支持,包括 Socks、HTTP、Shadowsocks、Trojan、Vmess、VLESS 等。每个协议可单独设置传输载体,比如 TCP、mKCP、QUIC、gPRC 和 WebSocket 等。
17 | - title: 隐蔽和安全
18 | details: V2Ray 的节点可以伪装成正常的网站(HTTPS),将其流量与正常的网页流量混淆,以避开第三方干扰,并提供数据包伪装和重放保护等功能。
19 | - title: 负载均衡
20 | details: 入站流量按照探测策略和加权算法自动分发到最合适的出口。
21 | - title: 多平台支持
22 | details: 原生支持所有常见平台,如 Windows、macOS 和 Linux,并已有第三方支持移动平台。
23 | footer: Licensed under CC-BY-SA 4.0 | Copyleft 2015-Present V2Fly Community
24 | ---
25 |
26 | ## Project V 由谁主导开发
27 |
28 | 我们是一群爱好自由的人们。我们倾向于保持匿名,尽可能地不透露任何身份信息。
29 |
30 | 你可以通过 GitHub、Telegram、Email [与我们讨论](guide/help.md)。
31 |
32 | ## 贡献
33 |
34 | 欢迎参与该项目的贡献中来!就算你不懂如何写代码,也还是有许多种方法可以帮助完善的。 这里有一些例子:
35 |
36 | - 🌐 **翻译**。帮助 V2Ray 翻译成更多语言的版本,或者提高目前已有的翻译的质量。
37 | - 🐛 **报告 Bug**。报告 V2Ray 的 bug 或其他使用时产生的问题,请给我们提交 [issue](https://github.com/v2fly/v2ray-core)
38 | - ⚙️ **帮助开发 V2Fly**! 克隆仓库,签出代码,提交高质量的 Pull request!
39 | - 📆 **社区维护** 帮助我们创建、维护 V2Fly 的社区!
40 | - ...你还可以做更多!
41 |
42 | ## 授权
43 |
44 | - Core 使用 MIT 协议
45 | - 网站([v2fly.org](https://www.v2fly.org/))以 [CC BY SA 4.0 国际许可协议](https://creativecommons.org/licenses/by-sa/4.0/deed.zh) 授权。
46 | * 包括网站中所有可见的文字内容和图片。
47 | * 包括 Project V 图标文件。
48 | * 包括生成网站所使用到的源代码,即 [v2fly/v2fly-github-io](https://github.com/v2fly/v2fly-github-io)。
49 | - 第三方所创作的内容,其版权归其创作者所有。Project V 放弃对这些内容的所有权。
50 | * 包括 Project V 使用过程中的截图。
51 | * 包括运行 Project V 所需的配置文件。
52 | * 包括 Project V 运行时产生的日志文件。
53 |
--------------------------------------------------------------------------------
/docs/awesome/tools.md:
--------------------------------------------------------------------------------
1 | # 神一样的工具们
2 |
3 | ## 在线工具
4 |
5 | > UUID 生成器
6 |
7 |
8 |
9 | 另有第三方的 UUID 生成器 [uuidgenerator.net](https://www.uuidgenerator.net)
10 |
11 | ## 第三方图形客户端
12 |
18 |
19 |
25 |
26 |
32 |
33 |
39 |
45 |
46 |
52 |
53 |
59 |
60 | ## 路由规则
61 |
62 | > V2Ray Rules Dat
63 |
64 | V2Ray 路由规则文件加强版,可代替官方 `geoip.dat` 和 `geosite.dat` [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat)
65 |
--------------------------------------------------------------------------------
/docs/config/api.md:
--------------------------------------------------------------------------------
1 | # API 远程控制
2 |
3 | V2Ray 中可以开放一些 API 以便远程调用。这些 API 都基于 [gRPC](https://grpc.io/)。大多数用户并不会用到此 API,新手可以直接忽略这一项。
4 |
5 | 当远程控制开启时,V2Ray 会自建一个出站代理,以 `tag` 配置的值为标识。用户必须手动将所有的 gRPC 入站连接通过 [路由](routing.md) 指向这一出站代理。
6 |
7 | ## ApiObject
8 |
9 | `ApiObject` 对应配置文件的 `api` 项。
10 |
11 | ```json
12 | {
13 | "tag": "api",
14 | "services": [
15 | "HandlerService",
16 | "LoggerService",
17 | "StatsService"
18 | ]
19 | }
20 | ```
21 |
22 | > `tag`: string
23 |
24 | 出站代理标识。
25 |
26 | > `services`: \[string\]
27 |
28 | 开启的 API 列表,可选的值见 [API 列表](#支持的-api-列表)。
29 |
30 | ## 支持的 API 列表
31 |
32 | ### HandlerService
33 |
34 | 一些对于入站出站代理进行修改的 API,可用的功能如下:
35 |
36 | * 添加一个新的入站代理;
37 | * 添加一个新的出站代理;
38 | * 删除一个现有的入站代理;
39 | * 删除一个现有的出站代理;
40 | * 在一个入站代理中添加一个用户(仅支持 VMess、VLESS、Trojan);
41 | * 在一个入站代理中删除一个用户(仅支持 VMess、VLESS、Trojan);
42 |
43 | ### LoggerService
44 |
45 | 支持对内置 Logger 的重启,可配合 logrotate 进行一些对日志文件的操作。
46 |
47 | ### StatsService
48 |
49 | 内置的数据统计服务,详见 [统计信息](stats.md)。
50 |
51 | ### ObservatoryService
52 |
53 | [连接观测](observatory.md) 组件 API (v4.38.0+) 。
54 |
--------------------------------------------------------------------------------
/docs/config/browserforwarder.md:
--------------------------------------------------------------------------------
1 | # 浏览器转发模块
2 |
3 | 浏览器转发模块可以使用浏览器网页页面转发受到支持的连接。
4 |
5 | ## BrowserForwarderObject
6 |
7 | `BrowserForwarderObject` 对应配置文件的 `browserForwarder` 项。 (4.37.0+)
8 |
9 |
10 | ```json
11 | {
12 | "listenAddr": "127.0.0.1",
13 | "listenPort": 8080
14 | }
15 | ```
16 |
17 | > `listenAddr`: string
18 |
19 | 浏览器转发页面的本地监听地址。
20 |
21 | > `listenPort`: number
22 |
23 | 浏览器转发页面的本地监听端口。
24 |
25 |
26 | ## 运行机制
27 |
28 | 浏览器转发程序利用浏览器的内构功能转发连接到对应的服务器,避免 V2Ray 直接建立到远程的 TLS 连接,减少了可供识别的特征。
29 |
30 | 在使用时,需要打开浏览器访问相应的网页服务器以便使用转发功能。
31 |
32 | 应该在资源文件夹放置转发页面和脚本的文件夹,这个内容必须随 V2Ray 本体同时更新,且和发布的内容一致。V2Ray 不会向浏览器发送无法识别的转发页面和脚本。
33 |
34 | 此资源数据在二进制分发版本中位于可选的 extra 包 (v2ray-extra.zip) 中。
35 |
--------------------------------------------------------------------------------
/docs/config/env.md:
--------------------------------------------------------------------------------
1 | # 环境变量
2 |
3 | V2Ray 提供以下环境变量以供修改 V2Ray 的一些底层配置。
4 |
5 | ## 每个连接的缓存大小
6 |
7 | * 名称:`v2ray.ray.buffer.size` 或 `V2RAY_RAY_BUFFER_SIZE`。
8 | * 单位:MBytes。
9 | * 默认值:在 x86、amd64、arm64 和 s390x 上为 2,其它平台上禁用该缓存。
10 | * 特殊值:0 表示缓存无上限。
11 |
12 | **已过时,请使用本地策略中的 bufferSize**
13 |
14 | 对于一个代理连接,当上下游网络速度有差距时,V2Ray 会缓存一部分数据,以减小对网络传输的影响。这个配置设置了缓存的大小,越大的缓存会占用更多的内存,也会使网络性能越好。
15 |
16 | ## 资源文件路径
17 |
18 | * 名称:`v2ray.location.asset` 或 `V2RAY_LOCATION_ASSET`。
19 | * 默认值:和 v2ray 文件同路径。
20 |
21 | 这个环境变量指定了一个文件夹位置,这个文件夹应当包含 geoip.dat 和 geosite.dat 文件。
22 |
23 | ## 配置文件位置
24 |
25 | * 名称:`v2ray.location.config` 或 `V2RAY_LOCATION_CONFIG`。
26 | * 默认值:和 v2ray 文件同路径。
27 |
28 | 这个环境变量指定了一个文件夹位置,这个文件夹应当包含 config.json 文件。
29 |
30 | ## 多配置目录
31 |
32 | * 名称:`v2ray.location.confdir` 或 `V2RAY_LOCATION_CONFDIR`。
33 | * 默认值:`""`。
34 |
35 | V2Ray 4.23.0 开始增加的多配置文件目录项。这个目录内的 `.json` 文件会按文件名顺序读取,作为多配置选项。
36 |
37 | ## 分散读取
38 |
39 | * 名称:`v2ray.buf.readv` 或 `V2RAY_BUF_READV`。
40 | * 默认值:`auto`。
41 |
42 | V2Ray 3.37 开始使用 Scatter/Gather IO,这一特性可以在大流量(超过 100 MByte/s)的时候依然使用较低的内存。可选的值有 `auto`、`enable` 和 `disable`。
43 |
44 | * `enable`:强制开启分散读取特性。
45 | * `disable`:强制关闭分散读取特性。
46 | * `auto`:仅在 Windows、macOS 和 Linux,并且 CPU 平台为 x86、AMD64 和 s390x 时,开启此特性。
47 |
48 | 在流量没有达到 100 MByte/s 时,开启与否在内存使用上没有明显的差异。
49 |
50 | ## Geodata 文件加载器
51 |
52 | * 名称:`v2ray.conf.geoloader` 或 `V2RAY_CONF_GEOLOADER`。
53 | * 默认值:`standard`。
54 |
55 | 自 v4.39.0 起,V2Ray 内置了多种读取和解码 `geoip.dat` 和 `geosite.dat` 文件的加载器。可选的加载器如下:
56 |
57 | * `standard`:标准加载器(默认值)
58 | * `memconservative`:专为内存受限(小内存)设备优化的加载器 (v4.39.0+)
59 |
--------------------------------------------------------------------------------
/docs/config/observatory.md:
--------------------------------------------------------------------------------
1 | # Observatory 连接观测
2 |
3 | 连接观测组件通过定时通过指定的出站连接建立连接来确定出站代理的状态。 (v4.38.0+)
4 | 连接观测组件的观测结果可以被其他组件使用,如负载均衡程序及API。
5 |
6 | 默认连接 `api.v2fly.org` 进行连接状态检测。由于探测连接会定时发出,此功能可能会使处于特权网络路径的攻击者获得更多信息,请酌情使用。
7 |
8 | ## ObservatoryObject
9 |
10 | ```json
11 | {
12 | "subjectSelector":[
13 | "outbound"
14 | ]
15 | }
16 | ```
17 |
18 | > `subjectSelector`: \[string\]
19 |
20 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"selector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
21 |
22 | 被匹配到的出站连接将被定时连接以确定是否可用。
23 |
24 | > `probeURL`: string
25 |
26 | 用于检测连接状态的网址。默认会使用内构的连接状态检测地址。(4.41.1+)
27 |
28 | :::tip
29 | 此目标地址的服务器可以推断出您使用了本程序。如果您使用了第三方提供的服务器,该服务器的运营商可能基于此信息作出不利于您的决定,如展示更多验证码,拒绝服务或封禁您的帐号。
30 | :::
31 |
32 | > `probeInterval`: string
33 |
34 | 发起探测的间隔。每经过这个时间,就会对一个服务器进行服务器状态检测。时间格式为数字+单位,比如`"10s"`, `"2h45m"`,支持的时间单位有 `ns`, `us`, `ms`, `s`, `m`, `h`, 分别对应纳秒、微秒、毫秒、秒、分、时。(4.41.1+)
35 |
36 | :::tip
37 | 此配置项目的名称于 v4.42.0 发生了修改。
38 | :::
39 |
--------------------------------------------------------------------------------
/docs/config/outbounds.md:
--------------------------------------------------------------------------------
1 | # Outbounds
2 |
3 | 出站连接用于向远程网站或下一级代理服务器发送数据,可用的协议请见协议列表。
4 |
5 | ## OutboundObject
6 |
7 | `OutboundObject` 对应配置文件中 `outbounds` 项的一个子元素。
8 |
9 | ```json
10 | {
11 | "sendThrough": "0.0.0.0",
12 | "protocol": "协议名称",
13 | "settings": {},
14 | "tag": "标识",
15 | "streamSettings": {},
16 | "proxySettings": {
17 | "tag": "another-outbound-tag",
18 | "transportLayer": false
19 | },
20 | "mux": {}
21 | }
22 | ```
23 |
24 | > `sendThrough`: address
25 |
26 | 用于发送数据的 IP 地址,当主机有多个 IP 地址时有效,默认值为 `"0.0.0.0"`。
27 |
28 | > `protocol`: string
29 |
30 | 连接协议名称,可选的值见协议列表。
31 |
32 | > `settings`: OutboundConfigurationObject
33 |
34 | 具体的配置内容,视协议不同而不同。详见每个协议中的 `OutboundConfigurationObject`。
35 |
36 | > `tag`: string
37 |
38 | 此出站连接的标识,用于在其它的配置中定位此连接。当其值不为空时,必须在所有 tag 中唯一。
39 |
40 | > `streamSettings`: [StreamSettingsObject](transport.md#streamsettingsobject)
41 |
42 | [底层传输配置](transport.md#streamsettingsobject)
43 |
44 | > `proxySettings`: [ProxySettingsObject](#proxysettingsobject)
45 |
46 | 出站代理配置。当出站代理生效时,此出站协议的 `streamSettings` 将不起作用。
47 |
48 | > `mux`: [MuxObject](#muxobject)
49 |
50 | [Mux 配置](#muxobject)。
51 |
52 | ## ProxySettingsObject
53 |
54 | ```json
55 | {
56 | "tag": "another-outbound-tag",
57 | "transportLayer": false
58 | }
59 | ```
60 |
61 | > `tag`: string
62 |
63 | 当指定另一个出站连接的标识时,此出站连接发出的数据,将被转发至所指定的出站连接发出。
64 |
65 | > `transportLayer`: true | false
66 |
67 | 是否启用传输层转发支持。在启用后,此出站连接的传输层协议将保持生效(如果传输层协议支持)。(v4.35.0+)
68 |
69 | 如果不启用此选项, 在转发时传输层协议将失效,只能使用默认的 TCP 传输协议。
70 |
71 | ## MuxObject
72 |
73 | Mux 功能是在一条 TCP 连接上分发多个 TCP 连接的数据。实现细节详见 [Mux.Cool](../developer/protocols/muxcool.md)。Mux 是为了减少 TCP 的握手延迟而设计,而非提高连接的吞吐量。使用 Mux 看视频、下载或者测速通常都有反效果。Mux 只需要在客户端启用,服务器端自动适配。
74 |
75 | `MuxObject` 对应 `OutboundObject` 中的 `mux` 项。
76 |
77 | ```json
78 | {
79 | "enabled": false,
80 | "concurrency": 8
81 | }
82 | ```
83 |
84 | > `enabled`: true | false
85 |
86 | 是否启用 Mux 转发请求,默认值 `false`。
87 |
88 | > `concurrency`: number
89 |
90 | 最大并发连接数。最小值 `1`,最大值 `1024`,默认值 `8`。
91 |
92 | 填负数,如 `-1`,不加载 mux 模块(v4.22.0+)。
93 |
94 | 这个数值表示了一个 TCP 连接上最多承载的 Mux 连接数量。当客户端发出了 8 个 TCP 请求,而 `concurrency=8` 时,V2Ray 只会发出一条实际的 TCP 连接,客户端的 8 个请求全部由这个 TCP 连接传输。
95 |
--------------------------------------------------------------------------------
/docs/config/overview.md:
--------------------------------------------------------------------------------
1 | # 配置文件格式
2 |
3 | ## 概述
4 |
5 | V2Ray 的配置文件形式如下,客户端和服务器通用一种形式,只是实际的配置不一样。
6 |
7 | 如果你刚接触 V2Ray,应当从了解 Inbounds 和 Outbounds 开始,只填必须的选项即可启动程序。接下来循序渐进了解其它组件,你会发现 V2Ray 并不难掌握。
8 |
9 | ```json
10 | {
11 | "log": {},
12 | "api": {},
13 | "dns": {},
14 | "routing": {},
15 | "policy": {},
16 | "inbounds": [],
17 | "outbounds": [],
18 | "transport": {},
19 | "stats": {},
20 | "reverse": {},
21 | "fakedns": [],
22 | "browserForwarder": {},
23 | "observatory": {}
24 | }
25 | ```
26 |
27 | > `log`: [LogObject](#logobject)
28 |
29 | 日志配置,表示 V2Ray 如何输出日志。
30 |
31 | > `api`: [ApiObject](api.md)
32 |
33 | 远程控制。
34 |
35 | > `dns`: [DnsObject](dns.md)
36 |
37 | 内置的 DNS 服务器,若此项不存在,则默认使用本机的 DNS 设置。
38 |
39 | > `routing`: [RoutingObject](routing.md)
40 |
41 | 路由功能。
42 |
43 | > `policy`: [PolicyObject](policy.md)
44 |
45 | 本地策略,可进行一些权限相关的配置。
46 |
47 | > `inbounds`: \[ [InboundObject](inbounds.md) \]
48 |
49 | 一个数组,每个元素是一个入站连接配置。
50 |
51 | > `outbounds`: \[ [OutboundObject](outbounds.md) \]
52 |
53 | 一个数组,每个元素是一个出站连接配置。列表中的第一个元素作为主出站协议。当路由匹配不存在或没有匹配成功时,流量由主出站协议发出。
54 |
55 | > `transport`: [TransportObject](transport.md)
56 |
57 | 用于配置 V2Ray 如何与其它服务器建立和使用网络连接。
58 |
59 | > `stats`: [StatsObject](stats.md)
60 |
61 | 统计信息。
62 |
63 | > `reverse`: [ReverseObject](reverse.md)
64 |
65 | 反向代理。
66 |
67 | > `fakedns`: \[ [FakeDnsObject](fakedns.md) \]
68 |
69 | 虚拟 DNS 服务器。
70 |
71 |
72 | > `browserForwarder`: [BrowserForwarderObject](browserforwarder.md)
73 |
74 | 浏览器转发模块。
75 |
76 | > `observatory`: [ObservatoryObject](observatory.md)
77 |
78 | 连接观测模块。
79 |
80 | ## LogObject
81 |
82 | `LogObject` 对应配置文件的 `log` 项。
83 |
84 | ```json
85 | {
86 | "access": "文件地址",
87 | "error": "文件地址",
88 | "loglevel": "warning"
89 | }
90 | ```
91 |
92 | > `access`: string
93 |
94 | 访问日志的文件地址,其值是一个合法的文件地址,如`"/var/log/v2ray/access.log"`(Linux)或者`"C:\\Temp\\v2ray\\_access.log"`(Windows)。当此项不指定或为空值时,表示将日志输出至 stdout。V2Ray 4.20 加入了特殊值`none`,即关闭 access log。
95 |
96 | > `error`: string
97 |
98 | 错误日志的文件地址,其值是一个合法的文件地址,如`"/var/log/v2ray/error.log"`(Linux)或者`"C:\\Temp\\v2ray\\_error.log"`(Windows)。当此项不指定或为空值时,表示将日志输出至 stdout。V2Ray 4.20 加入了特殊值`none`,即关闭 error log(跟`loglevel: "none"`等价)。
99 |
100 | > `loglevel`: "debug" | "info" | "warning" | "error" | "none"
101 |
102 | 日志的级别。默认值为 `"warning"`。
103 |
104 | * `"debug"`:详细的调试性信息。同时包含所有 `"info"` 内容。
105 | * `"info"`:V2Ray 在运行时的状态,不影响正常使用。同时包含所有 `"warning"` 内容。
106 | * `"warning"`:V2Ray 遇到了一些问题,通常是外部问题,不影响 V2Ray 的正常运行,但有可能影响用户的体验。同时包含所有 `"error"` 内容。
107 | * `"error"`:V2Ray 遇到了无法正常运行的问题,需要立即解决。
108 | * `"none"`:不记录任何内容。
109 |
--------------------------------------------------------------------------------
/docs/config/policy.md:
--------------------------------------------------------------------------------
1 | # Policy 本地策略
2 |
3 | 本地策略可以配置一些用户相关的权限,比如连接超时设置。V2Ray 处理的每一个连接都对应一个用户,按照用户的等级(level)应用不同的策略。本地策略可根据等级的不同而变化。
4 |
5 | ## PolicyObject
6 |
7 | `PolicyObject` 对应配置文件的 `policy` 项。
8 |
9 | ```json
10 | {
11 | "levels": {
12 | "0": {
13 | "handshake": 4,
14 | "connIdle": 300,
15 | "uplinkOnly": 2,
16 | "downlinkOnly": 5,
17 | "statsUserUplink": false,
18 | "statsUserDownlink": false,
19 | "bufferSize": 10240
20 | }
21 | },
22 | "system": {
23 | "statsInboundUplink": false,
24 | "statsInboundDownlink": false,
25 | "statsOutboundUplink": false,
26 | "statsOutboundDownlink": false
27 | }
28 | }
29 | ```
30 |
31 | > `level`: map{string: [LevelPolicyObject](#levelpolicyobject)}
32 |
33 | 一组键值对,每个键是一个字符串形式的数字(JSON 的要求),比如 `"0"`、`"1"` 等,双引号不能省略,此数字对应用户等级。每一个值是一个 [LevelPolicyObject](#levelpolicyobject).
34 |
35 | :::tip
36 | 每个入站出站代理现在都可以设置用户等级,V2Ray 会根据实际的用户等级应用不同的本地策略。
37 | :::
38 |
39 | > `system`: [SystemPolicyObject](#systempolicyobject)
40 |
41 | V2Ray 系统的策略
42 |
43 | ## LevelPolicyObject
44 |
45 | ```json
46 | {
47 | "handshake": 4,
48 | "connIdle": 300,
49 | "uplinkOnly": 2,
50 | "downlinkOnly": 5,
51 | "statsUserUplink": false,
52 | "statsUserDownlink": false,
53 | "bufferSize": 10240
54 | }
55 | ```
56 |
57 | > `handshake`: number
58 |
59 | 连接建立时的握手时间限制。单位为秒。默认值为 `4`。在入站代理处理一个新连接时,在握手阶段(比如 VMess 读取头部数据,判断目标服务器地址),如果使用的时间超过这个时间,则中断该连接。
60 |
61 | > `connIdle`: number
62 |
63 | 连接空闲的时间限制。单位为秒。默认值为 `300`。在入站出站代理处理一个连接时,如果在 `connIdle` 时间内,没有任何数据被传输(包括上行和下行数据),则中断该连接。
64 |
65 | > `uplinkOnly`: number
66 |
67 | 当连接下行线路关闭后的时间限制。单位为秒。默认值为 `2`。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 `uplinkOnly` 时间后中断连接。
68 |
69 | > `downlinkOnly`: number
70 |
71 | 当连接上行线路关闭后的时间限制。单位为秒。默认值为 `5`。当客户端(如浏览器)关闭上行连接时,入站代理会在等待 `downlinkOnly` 时间后中断连接。
72 |
73 | :::tip
74 | 在 HTTP 浏览的场景中,可以将 `uplinkOnly` 和 `downlinkOnly` 设为 `0`,以提高连接关闭的效率。
75 | :::
76 |
77 | > `statsUserUplink`: true | false
78 |
79 | 当值为 `true` 时,开启当前等级的所有用户的上行流量统计。
80 |
81 | > `statsUserDownlink`: true | false
82 |
83 | 当值为 `true` 时,开启当前等级的所有用户的下行流量统计。
84 |
85 | > `bufferSize`: number
86 |
87 | 每个连接的内部缓存大小。单位为 kB。当值为 `0` 时,内部缓存被禁用。
88 |
89 | 默认值 (V2Ray 4.4+):
90 |
91 | * 在 ARM、MIPS、MIPSLE 平台上,默认值为 `0`。
92 | * 在 ARM64、MIPS64、MIPS64LE 平台上,默认值为 `4`。
93 | * 在其它平台上,默认值为 `512`。
94 |
95 | 默认值 (V2Ray 4.3-):
96 |
97 | * 在 ARM、MIPS、MIPSLE、ARM64、MIPS64、MIPS64LE 平台上,默认值为 `16`。
98 | * 在其它平台上,默认值为 `2048`。
99 |
100 | :::tip
101 | `bufferSize` 选项会覆盖 [环境变量](env.md#每个连接的缓存大小)中 `v2ray.ray.buffer.size` 的设定。
102 | :::
103 |
104 | ## SystemPolicyObject
105 |
106 | ```json
107 | {
108 | "statsInboundUplink": false,
109 | "statsInboundDownlink": false,
110 | "statsOutboundUplink": false,
111 | "statsOutboundDownlink": false
112 | }
113 | ```
114 |
115 | > `statsInboundUplink`: true | false
116 |
117 | 当值为 `true` 时,开启所有入站代理的上行流量统计。
118 |
119 | > `statsInboundDownlink`: true | false
120 |
121 | 当值为 `true` 时,开启所有入站代理的下行流量统计。
122 |
123 | > `statsOutboundUplink`: true | false
124 |
125 | ( V2Ray 4.26.0+ )当值为 `true` 时,开启所有出站代理的上行流量统计。
126 |
127 | > `statsOutboundDownlink`: true | false
128 |
129 | ( V2Ray 4.26.0+ ) 当值为 `true` 时,开启所有出站代理的下行流量统计。
130 |
--------------------------------------------------------------------------------
/docs/config/protocols/blackhole.md:
--------------------------------------------------------------------------------
1 | # Blackhole
2 |
3 | * 名称:`blackhole`
4 | * 类型:出站协议
5 |
6 | Blackhole(黑洞)是一个出站数据协议,它会阻碍所有数据的出站,配合 [路由(Routing)](../routing.md) 一起使用,可以达到禁止访问某些网站的效果。
7 |
8 | ## OutboundConfigurationObject
9 |
10 | ```json
11 | {
12 | "response": {
13 | "type": "none"
14 | }
15 | }
16 | ```
17 |
18 | > `response`: [ResponseObject](#responseobject)
19 |
20 | 配置黑洞的响应数据。Blackhole 会在收到待转发数据之后,发送指定的响应数据,然后关闭连接。待转发的数据将被丢弃。如不指定此项,Blackhole 将直接关闭连接。
21 |
22 | ### ResponseObject
23 |
24 | ```json
25 | {
26 | "type": "none"
27 | }
28 | ```
29 |
30 | > `type`: "http" | "none"
31 |
32 | 当 `type` 为 `"none"`(默认值)时,Blackhole 将直接关闭连接。当 `type` 为 `"http"` 时,Blackhole 会发回一个简单的 HTTP 403 数据包,然后关闭连接。
33 |
--------------------------------------------------------------------------------
/docs/config/protocols/dns.md:
--------------------------------------------------------------------------------
1 | # DNS
2 |
3 | * 名称:`dns`
4 | * 类型:出站协议
5 |
6 | DNS 是一个出站协议,主要用于拦截和转发 DNS 查询。此出站协议只能接收 DNS 流量(包含基于 UDP 和 TCP 协议的查询),其它类型的流量会导致错误。
7 |
8 | 在处理 DNS 查询时,此出站协议会将 IP 查询(即 A 和 AAAA)转发给内置的 [DNS 服务器](../dns.md)。其它类型的查询流量将被转发至它们原本的目标地址。
9 |
10 | DNS 出站协议在 V2Ray 4.15 中引入。
11 |
12 | ## OutboundConfigurationObject
13 |
14 | ```json
15 | {
16 | "network": "tcp",
17 | "address": "1.1.1.1",
18 | "port": 53
19 | }
20 | ```
21 |
22 | > `network`: "tcp" | "udp"
23 |
24 | (V2Ray 4.16+) 修改 DNS 流量的传输层协议,可选的值有 `"tcp"` 和 `"udp"`。当不指定时,保持来源的传输方式不变。
25 |
26 | > `address`: address
27 |
28 | (V2Ray 4.16+) 修改 DNS 服务器地址。当不指定时,保持来源中指定的地址不变。
29 |
30 | > `port`: number
31 |
32 | (V2Ray 4.16+) 修改 DNS 服务器端口。当不指定时,保持来源中指定的端口不变。
33 |
--------------------------------------------------------------------------------
/docs/config/protocols/dokodemo.md:
--------------------------------------------------------------------------------
1 | # Dokodemo-door
2 |
3 | * 名称:`dokodemo-door`
4 | * 类型:入站协议
5 |
6 | Dokodemo door(任意门)是一个入站数据协议,它可以监听一个本地端口,并把所有进入此端口的数据发送至指定服务器的一个端口,从而达到端口映射的效果。
7 |
8 | :::tip
9 | 若需要出站连接被 V2Ray 重新路由,搭配使用 [Loopback 协议](loopback.md),性能更佳。
10 | :::
11 |
12 | ## InboundConfigurationObject
13 |
14 | ```json
15 | {
16 | "address": "8.8.8.8",
17 | "port": 53,
18 | "network": "tcp",
19 | "timeout": 0,
20 | "followRedirect": false,
21 | "userLevel": 0
22 | }
23 | ```
24 |
25 | > `address`: address
26 |
27 | 将流量转发到此地址。可以是一个 IP 地址,形如 `"1.2.3.4"`,或者一个域名,形如 `"v2ray.com"`。字符串类型。
28 |
29 | 当 `followRedirect`(见下文)为 `true` 时,`address` 可为空。
30 |
31 | > `port`: number
32 |
33 | 将流量转发到目标地址的指定端口,范围 \[1, 65535\],数值类型。必填参数。
34 |
35 | > `network`: "tcp" | "udp" | "tcp,udp"
36 |
37 | 可接收的网络协议类型。比如当指定为 `"tcp"` 时,任意门仅会接收 TCP 流量。默认值为 `"tcp"`。
38 |
39 | > `timeout`: number
40 |
41 | 入站数据的时间限制(秒),默认值为 300。
42 |
43 | V2Ray 3.1 后等价于对应用户等级的 `connIdle` 策略
44 |
45 | > `followRedirect`: true | false
46 |
47 | 当值为 `true` 时,dokodemo-door 会识别出由 iptables 转发而来的数据,并转发到相应的目标地址。详见 [传输配置](../transport.md) 中的 `tproxy` 设置。
48 |
49 | > `userLevel`: number
50 |
51 | 用户等级,所有连接都会使用这个用户等级。
52 |
53 | ## 透明代理配置样例
54 |
55 | V2Ray 中增加一个 dokodemo-door 的入站协议:
56 |
57 | ```json
58 | {
59 | "network": "tcp,udp",
60 | "timeout": 30,
61 | "followRedirect": true
62 | }
63 | ```
64 |
65 | 配置 iptables:
66 |
67 | ```bash
68 | # Create new chain
69 | iptables -t nat -N V2RAY
70 | iptables -t mangle -N V2RAY
71 | iptables -t mangle -N V2RAY_MARK
72 |
73 | # Ignore your V2Ray server's addresses
74 | # It's very IMPORTANT, just be careful.
75 | iptables -t nat -A V2RAY -d 123.123.123.123 -j RETURN
76 |
77 | # Ignore LANs and any other addresses you'd like to bypass the proxy
78 | # See Wikipedia and RFC5735 for full list of reserved networks.
79 | iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN
80 | iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
81 | iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
82 | iptables -t nat -A V2RAY -d 169.254.0.0/16 -j RETURN
83 | iptables -t nat -A V2RAY -d 172.16.0.0/12 -j RETURN
84 | iptables -t nat -A V2RAY -d 192.168.0.0/16 -j RETURN
85 | iptables -t nat -A V2RAY -d 224.0.0.0/4 -j RETURN
86 | iptables -t nat -A V2RAY -d 240.0.0.0/4 -j RETURN
87 |
88 | # Anything else should be redirected to Dokodemo-door's local port
89 | iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 12345
90 |
91 | # Add any UDP rules
92 | ip route add local default dev lo table 100
93 | ip rule add fwmark 1 lookup 100
94 | iptables -t mangle -A V2RAY -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01
95 | iptables -t mangle -A V2RAY_MARK -p udp --dport 53 -j MARK --set-mark 1
96 |
97 | # Apply the rules
98 | iptables -t nat -A OUTPUT -p tcp -j V2RAY
99 | iptables -t mangle -A PREROUTING -j V2RAY
100 | iptables -t mangle -A OUTPUT -j V2RAY_MARK
101 | ```
102 |
--------------------------------------------------------------------------------
/docs/config/protocols/freedom.md:
--------------------------------------------------------------------------------
1 | # Freedom
2 |
3 | * 名称:`freedom`
4 | * 类型:出站协议
5 |
6 | Freedom 是一个出站协议,可以用来向任意网络发送(正常的) TCP 或 UDP 数据。
7 |
8 | ## OutboundConfigurationObject
9 |
10 | ```json
11 | {
12 | "domainStrategy": "AsIs",
13 | "redirect": "127.0.0.1:3366",
14 | "userLevel": 0
15 | }
16 | ```
17 |
18 | > `domainStrategy`: "AsIs" | "UseIP" | "UseIPv4" | "UseIPv6"
19 |
20 | 在目标地址为域名时,Freedom 可以直接向此域名发出连接(`"AsIs"`),或者将域名解析为 IP 之后再建立连接(`"UseIP"`、`"UseIPv4"` 和 `"UseIPv6"`)。解析 IP 的步骤会使用 V2Ray [内建的 DNS](../dns.md)。默认值为 `"AsIs"`。
21 |
22 | (V2Ray 4.6+) 当使用 `"UseIP"` 模式,并且 [出站连接配置](../overview.md#outboundobject) 中指定了 `sendThrough` 时,Freedom 会根据 `sendThrough` 的值自动判断所需的 IP 类型,IPv4 或 IPv6。
23 |
24 | (V2Ray 4.7+) 当使用 `"UseIPv4"` 或 `"UseIPv6"` 模式时,Freedom 会只使用对应的 IPv4 或 IPv6 地址。当 `sendThrough` 指定了不匹配的本地地址时,将导致连接失败。
25 |
26 | > `redirect`: address_port
27 |
28 | Freedom 会强制将所有数据发送到指定地址(而不是入站协议指定的地址)。其值为一个字符串,样例:`"127.0.0.1:80"`,`":1234"`。当地址不指定时,如 `":443"`,Freedom 不会修改原先的目标地址。当端口为 `0` 时,如 `"v2ray.com: 0"`,Freedom 不会修改原先的端口。
29 |
30 | > `userLevel`: number
31 |
32 | 用户等级,所有连接都使用这一等级。
33 |
--------------------------------------------------------------------------------
/docs/config/protocols/http.md:
--------------------------------------------------------------------------------
1 | # HTTP
2 |
3 | * 名称:`http`
4 | * 类型:入站/出站
5 |
6 | HTTP 的配置分为两部分,`InboundConfigurationObject` 和 `OutboundConfigurationObject`,分别对应入站和出站协议配置中的 `settings` 项。
7 |
8 | ## InboundConfigurationObject
9 |
10 | ```json
11 | {
12 | "timeout": 0,
13 | "accounts": [
14 | {
15 | "user": "my-username",
16 | "pass": "my-password"
17 | }
18 | ],
19 | "allowTransparent": false,
20 | "userLevel": 0
21 | }
22 | ```
23 |
24 | :::tip
25 | 应该注意,虽然 `http inbound` 可以提供公共服务,但 http 协议没有对传输加密,不适宜经公网中传输,更容易成为被人用作攻击的肉鸡。`http inbound` 更有意义的用法是在局域网或本机环境下监听,为其他程序提供本地服务。
26 | :::
27 |
28 | > `timeout`: number
29 |
30 | 从客户端读取数据的超时设置(秒),0 表示不限时。默认值为 300。 V2Ray 3.1 后等价于对应用户等级的 `connIdle` 策略。
31 |
32 | > `accounts`: \[[AccountObject](#accountobject)\]
33 |
34 | 一个数组,数组中每个元素为一个用户帐号。默认值为空。
35 |
36 | 当 `accounts` 非空时,HTTP 代理将对入站连接进行 Basic Authentication 验证。
37 |
38 | > `allowTransparent`: true | false
39 |
40 | 当为 `true` 时,会转发所有 HTTP 请求,而非只是代理请求。若配置不当,开启此选项会导致死循环。
41 |
42 | > `userLevel`: number
43 |
44 | 用户等级,所有连接使用这一等级。
45 |
46 | ### AccountObject
47 |
48 | ```json
49 | {
50 | "user": "my-username",
51 | "pass": "my-password"
52 | }
53 | ```
54 |
55 | > `user`: string
56 |
57 | 用户名,字符串类型。必填。
58 |
59 | > `pass`: string
60 |
61 | 密码,字符串类型。必填。
62 |
63 | :::tip
64 | 在 Linux 中使用以下环境变量即可在当前 session 使用全局 HTTP 代理(很多软件都支持这一设置,也有不支持的)。
65 |
66 | * `export http_proxy=http://127.0.0.1:8080/` (地址须改成你配置的 HTTP 入站代理地址)
67 | * `export https_proxy=$http_proxy`
68 | :::
69 |
70 | ## OutboundConfigurationObject
71 |
72 | ```json
73 | {
74 | "servers": [
75 | {
76 | "address": "192.168.108.1",
77 | "port": 3128,
78 | "users": [
79 | {
80 | "user": "my-username",
81 | "pass": "my-password"
82 | }
83 | ]
84 | }
85 | ]
86 | }
87 | ```
88 |
89 | (V2Ray 4.21.0+)
90 |
91 | :::tip
92 | 应该注意,虽然 `http outbound` 可以作为对外访问的配置,但 `http proxy` 协议没有对传输加密,不适宜经公网中传输,且因不支持 udp 传输将会导致 core 功能受限(Routing 过程的的 DNS 查询不可用)。`http outbound` 更有意义的用法是在特殊情况下,只能使用 `http proxy` 对外访问内部网络中,作为为其他协议连接代理服务器的前置代理使用(见 `OutboundObject` 的 `ProxySettingsObject`)。另因 `http proxy` 只能代理 tcp 协议,udp 系的协议均不能通过。
93 | :::
94 |
95 | (V2Ray 4.21.1+)
96 |
97 | :::tip
98 | 4.20.0 版本中引入了 http outbound 作为其他协议的前置代理用法中,缺乏了对 TLS 配置的支持。4.21.1 的补丁版本中对 `streamSettings` 中的 `security` 和 `tlsSettings` 保留生效。目前前置代理的用法中,vmess/tcp、vmess/tcp-tls 和 shadowsocks 等三种协议方式可使用,其他传输协议的前置代理用法需后续版本开发支持。
99 | :::
100 |
101 | > `servers`: 数组
102 |
103 | HTTP 代理服务器配置,若配置多个,循环使用 (RoundRobin)。
104 |
105 | > `address`: string
106 |
107 | HTTP 代理服务器地址,必填。
108 |
109 | > `port`: int
110 |
111 | HTTP 代理服务器端口,必填。
112 |
113 | > `user`: \[[AccountObject](#accountobject)\]
114 |
115 | 一个数组,数组中每个元素为一个用户帐号。默认值为空。
116 |
--------------------------------------------------------------------------------
/docs/config/protocols/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | - 名称:`hysteria2`
4 | - 类型:入站 / 出站
5 |
6 | ## InboundConfigurationObject
7 |
8 | 无需配置
9 |
10 | ## OutboundConfigurationObject
11 |
12 | ```json
13 | {
14 | "servers": [
15 | {
16 | "address": "127.0.0.1",
17 | "port": 1234
18 | }
19 | ]
20 | }
21 | ```
22 |
23 | ### ServerObject
24 |
25 | ```json
26 | {
27 | "address": "127.0.0.1",
28 | "port": 1234
29 | }
30 | ```
31 |
32 | > `address`: address
33 |
34 | 服务器地址,支持 IPv4、IPv6 和域名。必填。
35 |
36 | > `port`: number
37 |
38 | 服务器端口,必填。
39 |
--------------------------------------------------------------------------------
/docs/config/protocols/loopback.md:
--------------------------------------------------------------------------------
1 | # Loopback
2 |
3 | * 名称:`loopback`
4 | * 类型:出站协议
5 | * 最低版本:v4.36.0+
6 |
7 | Loopback 是一个出站协议,可使出站连接被重新路由。
8 |
9 | ## OutboundConfigurationObject
10 |
11 | ```json
12 | {
13 | "inboundTag": "reentry"
14 | }
15 | ```
16 |
17 | > `inboundTag`: string
18 |
19 | 匹配入站来源的标识。
--------------------------------------------------------------------------------
/docs/config/protocols/shadowsocks.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks
2 |
3 | * 名称:`shadowsocks`
4 | * 类型:入站 / 出站
5 |
6 | [Shadowsocks](https://zh.wikipedia.org/wiki/Shadowsocks) 协议,包含入站和出站两部分,兼容大部分其它版本的实现。
7 |
8 | 与官方版本的兼容性:
9 |
10 | * 支持 TCP 和 UDP 数据包转发,其中 UDP 可选择性关闭;
11 | * 加密方式:
12 | * AES-256-GCM
13 | * AES-128-GCM
14 | * ChaCha20-Poly1305 或称 ChaCha20-IETF-Poly1305
15 | * (V2Ray 4.27.0+) none 或称 plain
16 |
17 | ::: warning
18 | "none" 不加密方式下,服务器端不会验证 "password" 中的密码。一般需要加上 TLS 并在传输层使用安全配置,例如 WebSocket 配置较长的 path
19 | :::
20 |
21 | Shadowsocks 的配置分为两部分,`InboundConfigurationObject` 和 `OutboundConfigurationObject`,分别对应入站和出站协议配置中的 `settings` 项。
22 |
23 | ## InboundConfigurationObject
24 |
25 | ```json
26 | {
27 | "email": "love@v2ray.com",
28 | "method": "aes-256-gcm",
29 | "password": "密码",
30 | "level": 0,
31 | "network": "tcp",
32 | "ivCheck": false,
33 | "udp": false,
34 | "packetEncoding": "None"
35 | }
36 | ```
37 |
38 | > `email`: string
39 |
40 | 邮件地址,可选,用于标识用户
41 |
42 | > `method`: string
43 |
44 | 必填。可选的值见 [加密方式列表](#加密方式列表)
45 |
46 | > `password`: string
47 |
48 | 必填,任意字符串。Shadowsocks 协议不限制密码长度,但短密码会更可能被破解,建议使用 16 字符或更长的密码。
49 |
50 | > `level`: number
51 |
52 | 用户等级,默认值为 `0`。详见 [本地策略](../policy.md)。
53 |
54 | > `network`: "tcp" | "udp" | "tcp,udp"
55 |
56 | 可接收的网络连接类型,默认值为 `"tcp"`。
57 |
58 | > `ivCheck`: true | false
59 |
60 | 是否启用 IV 检查功能。可以使某些 IV 重放攻击更加困难。 (4.37.0+)
61 |
62 | 目前此功能默认不启用,但是在未来版本中会默认处于启用状态。
63 |
64 | > `udp`: true | false
65 |
66 | 是否开启 UDP 协议的支持。默认值为 `false`。
67 |
68 | > `packetEncoding`: "None" | "Packet"
69 |
70 | UDP 包编码方式,默认值为 `None`。
71 | 当该值为 `None` 时,UDP 将根据目标地址被映射 (Address and Port-Dependent Mapping)。
72 | 当该值为 `Packet` 时,UDP 将被端点独立映射 (Endpoint Independent Mapping),此 UDP 行为也被称为 FullCone 或 NAT1。
73 |
74 | ## OutboundConfigurationObject
75 |
76 | ```json
77 | {
78 | "servers": [
79 | {
80 | "email": "love@v2ray.com",
81 | "address": "127.0.0.1",
82 | "port": 1234,
83 | "method": "加密方式",
84 | "password": "密码",
85 | "level": 0
86 | }
87 | ]
88 | }
89 | ```
90 |
91 | > `servers`: \[[ServerObject](#serverobject)\]
92 |
93 | 一个数组,其中每一项是一个 [ServerObject](#serverobject)。
94 |
95 | ### ServerObject
96 |
97 | ```json
98 | {
99 | "email": "love@v2ray.com",
100 | "address": "127.0.0.1",
101 | "port": 1234,
102 | "method": "加密方式",
103 | "password": "密码",
104 | "level": 0,
105 | "ivCheck": false
106 | }
107 | ```
108 |
109 | > `email`: string
110 |
111 | 邮件地址,可选,用于标识用户
112 |
113 | > `address`: address
114 |
115 | Shadowsocks 服务器地址,支持 IPv4、IPv6 和域名。必填。
116 |
117 | > `port`: number
118 |
119 | Shadowsocks 服务器端口。必填。
120 |
121 | > `method`: string
122 |
123 | 必填。可选的值见[加密方式列表](#加密方式列表)
124 |
125 | > `password`: string
126 |
127 | 必填。任意字符串。Shadowsocks 协议不限制密码长度,但短密码会更可能被破解,建议使用 16 字符或更长的密码。
128 |
129 | > `level`: number
130 |
131 | 用户等级
132 |
133 | > `ivCheck`: true | false
134 |
135 | 是否启用 IV 检查功能。可以使某些 IV 重放攻击更加困难。 (4.37.0+)
136 |
137 | 目前此功能默认不启用,但是在未来版本中会默认处于启用状态。
138 |
139 | ## 加密方式列表
140 |
141 | * `"aes-256-gcm"`
142 | * `"aes-128-gcm"`
143 | * `"chacha20-poly1305"` 或 `"chacha20-ietf-poly1305"`
144 | * `"none"` 或 `"plain"`
145 |
--------------------------------------------------------------------------------
/docs/config/protocols/trojan.md:
--------------------------------------------------------------------------------
1 | # Trojan
2 |
3 | * 名称:`trojan`
4 | * 类型:入站 / 出站
5 |
6 | [Trojan](https://trojan-gfw.github.io/trojan/protocol) 协议设计指南
7 |
8 | :::tip
9 | Trojan 被设计工作在正确配置的加密 TLS 隧道中
10 | :::
11 |
12 | Trojan 的配置分为两部分,`InboundConfigurationObject` 和 `OutboundConfigurationObject`,分别对应入站和出站协议配置中的 `settings` 项。
13 |
14 | ## InboundConfigurationObject
15 |
16 | ```json
17 | {
18 | "clients":[
19 | {
20 | "password": "password",
21 | "email": "love@v2fly.org",
22 | "level": 0
23 | }
24 | ],
25 | "fallbacks": [
26 | {
27 | "dest": 80
28 | }
29 | ],
30 | "packetEncoding": "None"
31 | }
32 | ```
33 |
34 | > `clients`: \[ [ClientObject](#clientobject) \]
35 |
36 | 一个数组,其中每一项是一个 [ClientObject](#clientobject)。
37 |
38 | > `fallbacks`: \[ [FallbackObject](#fallbackobject) \]
39 |
40 | 一个数组,包含一系列强大的回落分流配置(可选)。
41 |
42 | > `packetEncoding`: "None" | "Packet"
43 |
44 | UDP 包编码方式,默认值为 `None`。
45 | 当该值为 `None` 时,UDP 将根据目标地址被映射 (Address and Port-Dependent Mapping)。
46 | 当该值为 `Packet` 时,UDP 将被端点独立映射 (Endpoint Independent Mapping),此 UDP 行为也被称为 FullCone 或 NAT1。
47 |
48 | ### ClientObject
49 |
50 | ```json
51 | {
52 | "password": "password",
53 | "email": "love@v2fly.org",
54 | "level": 0,
55 | }
56 | ```
57 |
58 | > `password`: string
59 |
60 | 必填,任意字符串。
61 |
62 | > `email`: string
63 |
64 | 邮件地址,可选,用于标识用户
65 |
66 | > `level`: number
67 |
68 | 用户等级,默认值为 `0`。详见 [本地策略](../policy.md)。
69 |
70 | ### FallbackObject
71 |
72 | ```json
73 | {
74 | "alpn": "",
75 | "path": "",
76 | "dest": 80,
77 | "xver": 0
78 | }
79 | ```
80 |
81 | v4.31.0+,V2Ray 的 Trojan 有完整的 VLESS fallbacks 支持,配置方式完全一致,后续 VLESS fallbacks 升级时会同步跟进。
82 |
83 | 触发回落的条件也基本相同:首包长度 < 58 或第 57 个字节不为 '\r'(因为 Trojan 没有协议版本)或身份认证失败。
84 |
85 | ## OutboundConfigurationObject
86 |
87 | ```json
88 | {
89 | "servers": [
90 | {
91 | "address": "127.0.0.1",
92 | "port": 1234,
93 | "password": "password",
94 | "email": "love@v2fly.org",
95 | "level": 0
96 | }
97 | ]
98 | }
99 | ```
100 |
101 | > `servers`: \[ [ServerObject](#serverobject) \]
102 |
103 | 一个数组,其中每一项是一个 [ServerObject](#serverobject)。
104 |
105 | ### ServerObject
106 |
107 | ```json
108 | {
109 | "address": "127.0.0.1",
110 | "port": 1234,
111 | "password": "password",
112 | "email": "love@v2fly.org",
113 | "level": 0
114 | }
115 | ```
116 |
117 | > `address`: address
118 |
119 | 服务器地址,支持 IPv4、IPv6 和域名。必填。
120 |
121 | > `port`: number
122 |
123 | 服务器端口,必填。
124 |
125 | > `password`: string
126 |
127 | 必填,任意字符串。
128 |
129 | > `email`: string
130 |
131 | 邮件地址,可选,用于标识用户
132 |
133 | > `level`: number
134 |
135 | 用户等级
136 |
--------------------------------------------------------------------------------
/docs/config/service.md:
--------------------------------------------------------------------------------
1 | # Service
2 |
3 | V2Ray 内置了一些服务来补充 V2Ray 的主要功能。 可以使用v5.17.0+的jsonv4配置格式进行配置。
4 |
5 | * [浏览器转发模块](service/browser.md)
6 | * [Policy 本地策略](service/policy.md)
7 | * [Stats 统计信息](service/stats.md)
8 | * [后台连接观测](service/backgroundObservatory.md)
9 | * [并发连接观测](service/burstObservatory.md)
10 | * [Tun](service/tun.md)
11 | * [订阅管理器](service/subscription.md)
12 |
--------------------------------------------------------------------------------
/docs/config/service/backgroundObservatory.md:
--------------------------------------------------------------------------------
1 | # 后台连接观测
2 |
3 | 后台连接观测服务通过定时通过指定的出站连接建立连接来确定出站代理的状态。
4 |
5 | > `subjectSelector`: string
6 |
7 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"subjectSelector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
8 |
9 | 被匹配到的出站连接将被定时连接以确定是否可用。
10 |
11 | > `probeUrl`: string
12 |
13 | 用于检测连接状态的网址。默认会使用内构的连接状态检测地址。
14 |
15 | :::tip
16 | 此目标地址的服务器可以推断出您使用了本程序。如果您使用了第三方提供的服务器,该服务器的运营商可能基于此信息作出不利于您的决定,如展示更多验证码,拒绝服务或封禁您的帐号。
17 | :::
18 |
19 | > `probeInterval`: number
20 |
21 | 发起探测的间隔。每经过这个时间,就会对一个服务器进行服务器状态检测。时间格式为数字+单位,比如`"10s"`, `"2h45m"`,支持的时间单位有 `ns`, `us`, `ms`, `s`, `m`, `h`, 分别对应纳秒、微秒、毫秒、秒、分、时。
22 |
--------------------------------------------------------------------------------
/docs/config/service/browser.md:
--------------------------------------------------------------------------------
1 | # 浏览器转发模块
2 | service.browser
3 |
4 | > `listenAddr`: string
5 |
6 | 浏览器转发页面的本地监听地址。
7 |
8 | > `listenPort`: number
9 |
10 | 浏览器转发页面的本地监听端口。
11 |
--------------------------------------------------------------------------------
/docs/config/service/burstObservatory.md:
--------------------------------------------------------------------------------
1 | # 并发连接观测
2 |
3 | 并发连接观测服务。
4 |
5 | > `subjectSelector`: string
6 |
7 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"subjectSelector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
8 |
9 | >`pingConfig`: [PingConfigObject](#pingconfigobject)
10 |
11 | ### PingConfigObject
12 |
13 | > `destination`: string
14 |
15 | Ping destination URL. It should return 204 on success.
16 |
17 | > `connectivity`: string
18 |
19 | Connectivity check URL.
20 |
21 | > `interval`: number
22 |
23 | 发起健康检查的事件间隔, 时间格式为数字+单位,比如`"10s"`, `"2h45m"`,支持的时间单位有 `ns`, `us`, `ms`, `s`, `m`, `h`, 分别对应纳秒、微秒、毫秒、秒、分、时。
24 |
25 | > `samplingCount`: number
26 |
27 | 保留的最近 Ping 结果的数量。
28 |
29 | > `timeout`: number
30 |
31 | Ping 超时时间, 时间格式为数字+单位,比如`"10s"`, `"2h45m"`。
32 |
--------------------------------------------------------------------------------
/docs/config/service/policy.md:
--------------------------------------------------------------------------------
1 | # Policy 本地策略
2 |
3 | 本地策略可以配置信息统计、内部缓存大小和一些用户相关的权限。V2Ray 处理的每一个连接都对应一个用户,按照用户的等级(level)应用不同的策略。本地策略可根据等级的不同而变化。
4 |
5 | service.policy
6 |
7 | ## Policy
8 |
9 | > `system`: [SystemPolicyObject](#systempolicyobject)
10 |
11 | V2Ray 全局系统策略。
12 |
13 | > `level`: map{string: [PolicyObject](#policyobject)}
14 |
15 | 一组键值对,每个键是一个字符串形式的数字(JSON 的要求),比如 "0"、"1" 等,双引号不能省略,此数字对应用户等级。每一个值是一个 [PolicyObject](#policyobject)。
16 |
17 | ### SystemPolicyObject
18 |
19 | > `stats`: [StatsObject](#statsobject)
20 |
21 | 统计信息设置。
22 |
23 | ### StatsObject
24 |
25 | > `inboundUplink`: bool
26 |
27 | 当值为 `true` 时,开启所有入站代理的上行流量统计。
28 |
29 | > `inboundDownlink`: bool
30 |
31 | 当值为 `true` 时,开启所有入站代理的下行流量统计。
32 |
33 | > `outboundUplink`: bool
34 |
35 | 当值为 `true` 时,开启所有出站代理的上行流量统计。
36 |
37 | > `outboundDownlink`: bool
38 |
39 | 当值为 `true` 时,开启所有出站代理的下行流量统计。
40 |
41 |
42 | ### PolicyObject
43 |
44 | > `timeout`: [TimeoutPolicyObject](#timeoutpolicyobject)
45 |
46 | 超时策略。
47 |
48 | > `stats`: [PolicyStatsObject](#policystatsobject)
49 |
50 | 统计信息策略。
51 |
52 | > `buffer`: [BufferPolicyObject](#bufferpolicyobject)
53 |
54 | 内部缓存策略。
55 |
56 | ### TimeoutPolicyObject
57 |
58 | > `handshake`: number
59 |
60 | 连接建立时的握手时间限制。单位为秒。默认值为 `4`。在入站代理处理一个新连接时,在握手阶段(比如 VMess 读取头部数据,判断目标服务器地址),如果使用的时间超过这个时间,则中断该连接。
61 |
62 | > `connectionIdle`: number
63 |
64 | 连接空闲的时间限制。单位为秒。默认值为 `300`。在入站出站代理处理一个连接时,如果在 `connIdle` 时间内,没有任何数据被传输(包括上行和下行数据),则中断该连接。
65 |
66 | > `uplinkOnly`: number
67 |
68 | 当连接下行线路关闭后的时间限制。单位为秒。默认值为 `2`。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 `uplinkOnly` 时间后中断连接。
69 |
70 | > `downlinkOnly`: number
71 |
72 | 当连接上行线路关闭后的时间限制。单位为秒。默认值为 `5`。当客户端(如浏览器)关闭上行连接时,入站代理会在等待 `downlinkOnly` 时间后中断连接。
73 |
74 | ### PolicyStatsObject
75 |
76 | > `userUplink`: bool
77 |
78 | 当值为 `true` 时,开启当前等级的所有用户的上行流量统计。
79 |
80 | > `userDownlink`: bool
81 |
82 | 当值为 `true` 时,开启当前等级的所有用户的下行流量统计。
83 |
84 | ### BufferPolicyObject
85 |
86 | > `connection`: number
87 |
88 | 每个连接的内部缓存大小,单位为 Bytes。 当值为 `-1` 时,缓存大小无限。
89 |
--------------------------------------------------------------------------------
/docs/config/service/stats.md:
--------------------------------------------------------------------------------
1 | # Stats 统计信息
2 |
3 | V2Ray 提供了一些关于其运行状况的统计信息。
4 |
5 | ## StatsObject
6 |
7 | `StatsObject` 对应配置文件的 `stats` 项。
8 |
9 | ```json
10 | {}
11 | ```
12 |
13 | 目前统计信息没有任何参数,只要 `StatsObject` 项存在,内部的统计即会开启。同时你还需要在 [Policy](policy.md) 中开启对应的项,才可以统计对应的数据。
14 |
15 | 目前已有的统计信息如下:
16 |
17 | ## 用户数据
18 |
19 | > `user>>>[email]>>>traffic>>>uplink`
20 |
21 | 特定用户的上行流量,单位为字节。
22 |
23 | > `user>>>[email]>>>traffic>>>downlink`
24 |
25 | 特定用户的下行流量,单位为字节。
26 |
27 | :::tip
28 | 如果对应用户没有指定 Email,则不会开启统计。
29 | :::
30 |
31 | ## 全局数据
32 |
33 | > `inbound>>>[tag]>>>traffic>>>uplink`
34 |
35 | 特定入站代理的上行流量,单位为字节。
36 |
37 | > `inbound>>>[tag]>>>traffic>>>downlink`
38 |
39 | 特定入站代理的下行流量,单位为字节。
40 |
41 | > `outbound>>>[tag]>>>traffic>>>uplink`
42 |
43 | 特定出站代理的上行流量,单位为字节。
44 |
45 | > `outbound>>>[tag]>>>traffic>>>downlink`
46 |
47 | 特定出站代理的下行流量,单位为字节。
48 |
--------------------------------------------------------------------------------
/docs/config/service/subscription.md:
--------------------------------------------------------------------------------
1 | # 订阅管理器
2 | * 名称: `subscription`
3 | * 类型: Service
4 | * ID: `service.subscription`
5 |
6 | 订阅管理器自动刷新出站信息并将它们转换为出站实例. (v5.13.0+)
7 |
8 | 由于[当前代码](https://github.com/v2fly/v2ray-core/blob/cc77e90254b57e552bd745727a7bf402bae3aad9/app/subscription/specs/skeleton.go)在“服务”之外查找与jsonv4配置格式冲突的jsonv5配置格式设置,因此此服务尚不适用于jsonv4配置格式。
9 |
--------------------------------------------------------------------------------
/docs/config/service/tun.md:
--------------------------------------------------------------------------------
1 | # Tun
2 | * 名称 : `tun`
3 | * 类型 : 服务
4 | * ID: `service.tun`
5 |
6 | Tun 是一个接受网络层数据包的服务,输入进入操作系统 tun 接口的数据包会被转换为一般数据流被传出代理处理。 (v5.9.0+)
7 |
8 | 您可以参考 [pull request](https://github.com/v2fly/v2ray-core/pull/2541) 中的示例。
9 |
10 | 目前仅支持 amd64 以及 arm64 架构下的 Linux 操作系统.
11 |
12 | ### Tun
13 |
14 | > `name`: string
15 |
16 | tun 网络适配器的名字。
17 |
18 | > `mtu`: number
19 |
20 | tun 网络适配器的最大传输单元。建议设置为 1500.
21 |
22 | > `tag`: string
23 |
24 | 生成的流量的入站流量标签。
25 |
26 | > `ips`: [ [IPObject](#ipobject) ]
27 |
28 | tun 网络适配器的 IP 地址段。建议设置为私有地址段。
29 |
30 | > `routes`: [ [RouteObject](#routeobject) ]
31 |
32 | tun 网络适配器的路由表。建议设置为 `0.0.0.0/0` 和 `::/0` 以路由所有进入 tun 网络适配器的数据包。
33 |
34 | > `enablePromiscuousMode`: bool
35 |
36 | 是否开启混杂模式。建议设置为 `true`。
37 |
38 | > `enableSpoofing`: bool
39 |
40 | 是否开启 IP 欺骗。建议设置为 `true`。
41 |
42 | > `packetEncoding`: \["None" | "Packet"\]
43 |
44 | UDP 包的编码方式,默认为 `None`。
45 |
46 | > `sniffingSettings`: [SniffingObject](../inbounds.md#sniffingobject)
47 |
48 | tun 入站连接的流量探测设置。流量探测允许路由根据连接的内容和元数据转发连接。(v5.11.0+)
49 |
50 | ### IPObject
51 |
52 | > `ip`: [ number ]
53 |
54 | > `prefix`: number
55 |
56 | ### RouteObject
57 |
58 | > `ip`: [ number ]
59 |
60 | > `prefix`: number
61 |
--------------------------------------------------------------------------------
/docs/config/stats.md:
--------------------------------------------------------------------------------
1 | # Stats 统计信息
2 |
3 | V2Ray 提供了一些关于其运行状况的统计信息。
4 |
5 | ## StatsObject
6 |
7 | `StatsObject` 对应配置文件的 `stats` 项。
8 |
9 | ```json
10 | {
11 | }
12 | ```
13 |
14 | 目前统计信息没有任何参数,只要 `StatsObject` 项存在,内部的统计即会开启。同时你还需要在 [Policy](policy.md) 中开启对应的项,才可以统计对应的数据。
15 |
16 | 目前已有的统计信息如下:
17 |
18 | ## 用户数据
19 |
20 | > `user>>>[email]>>>traffic>>>uplink`
21 |
22 | 特定用户的上行流量,单位字节。
23 |
24 | > `user>>>[email]>>>traffic>>>downlink`
25 |
26 | 特定用户的下行流量,单位字节。
27 |
28 | :::tip
29 | 如果对应用户没有指定 Email,则不会开启统计。
30 | :::
31 |
32 | ## 全局数据
33 |
34 | > `inbound>>>[tag]>>>traffic>>>uplink`
35 |
36 | 特定入站代理的上行流量,单位字节。
37 |
38 | > `inbound>>>[tag]>>>traffic>>>downlink`
39 |
40 | 特定入站代理的下行流量,单位字节。
41 |
42 | > `outbound>>>[tag]>>>traffic>>>uplink`
43 |
44 | (V2Ray 4.26.0+)特定出站代理的上行流量,单位字节。
45 |
46 | > `outbound>>>[tag]>>>traffic>>>downlink`
47 |
48 | (V2Ray 4.26.0+)特定出站代理的下行流量,单位字节。
49 |
--------------------------------------------------------------------------------
/docs/config/transport/domainsocket.md:
--------------------------------------------------------------------------------
1 | # DomainSocket
2 |
3 | :::warning
4 | v4.32.0+,推荐写到 [入站](../../config/inbounds.md) 的 `listen` 处,传输方式可选 TCP、WebSocket、HTTP/2,未来这里的 DomainSocket 可能会被弃用。
5 | :::
6 |
7 | Domain Socket 使用标准的 Unix domain socket 来传输数据。它的优势是使用了操作系统内建的传输通道,而不会占用网络缓存。相比起本地环回网络(local loopback)来说,Domain socket 速度略快一些。
8 |
9 | 目前仅可用于支持 Unix domain socket 的平台,如 Linux 和 macOS。在 Windows 10 Build 17036 前不可用。
10 |
11 | 如果指定了 domain socket 作为传输方式,在入站出站代理中配置的端口和 IP 地址将会失效,所有的传输由 domain socket 取代。
12 |
13 | ## DomainSocketObject
14 |
15 | `DomainSocketObject` 对应传输配置的 `dsSettings` 项。
16 |
17 | ```json
18 | {
19 | "path": "/path/to/ds/file",
20 | "abstract": false,
21 | "padding": false
22 | }
23 | ```
24 |
25 | > `path`: string
26 |
27 | 一个合法的文件路径。在运行 V2Ray 之前,这个文件必须不存在。
28 |
29 | > `abstract`: true | false
30 |
31 | 是否为 abstract domain socket,默认 `false`。
32 |
33 | > `padding`: true | false
34 |
35 | v4.28.1+,abstract domain socket 是否带 padding,默认 `false`。
36 |
--------------------------------------------------------------------------------
/docs/config/transport/grpc.md:
--------------------------------------------------------------------------------
1 | # gRPC
2 |
3 | gRPC 使用 HTTP/2 协议传输,内置连接复用(mux)功能。(v4.36.0+)
4 |
5 | ## grpcObject
6 |
7 | ```json
8 | {
9 | "serviceName": "GunService"
10 | }
11 | ```
12 |
13 | > `serviceName`: string
14 |
15 | gRPC 服务的名称。其作用类似 `path` 的功能,用于防止探测是否部署了本传输协议。建议使用复杂的随机字符串。
16 |
17 | 根据 [gRPC 规范官方](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#appendix-a---grpc-for-protobuf) 规定,此字段不建议使用除英文大小写字母、数字、下划线及英文句号之外的字符组成。
18 |
19 | :::tip
20 | 如需使用 Nginx、Caddy 等软件进行分流,设置的分流路径应为 `/${serviceName}/Tun`。
21 | :::
22 |
23 | ## Credits
24 |
25 | [Qv2ray/gun](https://github.com/Qv2ray/gun)
26 |
--------------------------------------------------------------------------------
/docs/config/transport/h2.md:
--------------------------------------------------------------------------------
1 | # HTTP/2
2 |
3 | V2Ray 3.17 中加入了基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,可以通过其它的 HTTP 服务器(如 Nginx)进行中转。
4 |
5 | 由 HTTP/2 的建议,客户端和服务器必须同时开启 TLS 才可以正常使用这个传输方式。
6 |
7 | V2Ray 4.20 中对服务端的 TLS 配置的强制条件移除,为了在特殊用途的分流部署环境中,由外部网关组件完成 TLS 层对话,V2Ray 作为后端应用,网关和 V2Ray 间使用称为 `h2c` 的明文 http/2 进行通讯。
8 |
9 | ## HttpObject
10 |
11 | `HttpObject` 对应传输配置的 `httpSettings` 项。
12 |
13 | ```json
14 | {
15 | "host": [
16 | "v2ray.com"
17 | ],
18 | "path": "/random/path",
19 | "method":"PUT",
20 | "headers": {
21 | }
22 | }
23 | ```
24 |
25 | > `host`: \[string\]
26 |
27 | 一个字符串数组,每一个元素是一个域名。客户端会随机从列表中选出一个域名进行通信,服务器会验证域名是否在列表中。
28 |
29 | > `path` string
30 |
31 | HTTP 路径,由 `/` 开头。客户端和服务器必须一致。可选参数,默认值为 `"/"`。
32 |
33 | > `method`: string
34 |
35 | HTTP 方法,默认值为 `"PUT"`。 (v4.39.0+)
36 |
37 | > `headers`: map{ string, \[ string \]}
38 |
39 | HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是一个数组。(v4.39.0+)
40 |
--------------------------------------------------------------------------------
/docs/config/transport/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | 魔改 quic-go 拥塞控制的代理协议。
4 |
5 | 1. 得益于 QUIC 的全加密和填充,大大地增加中间防火墙嗅探的负担
6 | 2. 强制要求使用 TLS 1.3
7 | 3. 真正的多路复用,还从根本上解决了 TLS 和多路复用带来的队头阻塞问题
8 |
9 | ## 协议修改说明
10 |
11 | - 在 V2ray 中,Hysteria2 TCP 被分成了两个部分:
12 |
13 | 1. `TLS + HTTP3` 传输层;包含认证、协商、拥塞控制等
14 | 2. `Proxy Header` 代理层;包含解析目标地址、Padding 等
15 |
16 | Hysteria2 可以作为传输层与 Vmess、Shadowsocks、Trojan 搭配使用,也可以兼用官方版。若把 Hysteria2 作为传输层,只能使用其 Stream,也就是说传输 UDP 时就是 UDP Over Stream。
17 |
18 | - Padding 目前为固定长度和内容,不影响实际使用和兼容性
19 |
20 | ## Hysteria2Object
21 |
22 | `Hysteria2Object` 对应传输配置的 `hysteria2Settings` 项。
23 |
24 | ```json
25 | {
26 | "password": "password",
27 | "use_udp_extension": true,
28 | "congestion": {
29 | "type": "bbr",
30 | "up_mbps": 50,
31 | "down_mbps": 100
32 | }
33 | }
34 | ```
35 |
36 | > `password`: string
37 |
38 | 认证密码,留空为不认证
39 |
40 | > `use_udp_extension`: bool
41 |
42 | 是否启用 UDP,默认不启用
43 |
44 | > `congestion`: [CongestionObject](#CongestionObject)
45 |
46 | 拥塞算法配置
47 |
48 | ## CongestionObject
49 |
50 | 用于控制本地网络的发包速度。理论上能够充分利用网络带宽,做到效益最大化,即为最佳拥塞算法。不同的拥塞算法会影响 Hysteria2 的性能表现。
51 |
52 | ```json
53 | {
54 | "type": "bbr",
55 | "up_mbps": 50,
56 | "down_mbps": 100
57 | }
58 | ```
59 |
60 | > `type`: string
61 |
62 | 可选:
63 |
64 | - `bbr` 被广泛使用的,推荐在移动网络环境下使用(默认)
65 | - `brutal` 需要正确地设置好本机实际带宽才能生效,推荐在带宽稳定的环境下使用
66 |
67 | > `up_mbps`: int
68 |
69 | 本机的上传速度,单位 Mbit/s
70 |
71 | 选择 `brutal` 时,必填;留空或 0 时转换成 `bbr`
72 |
73 | > `down_mbps`: int
74 |
75 | 本机的下传速度,单位 Mbit/s
76 |
77 | 选择 `brutal` 时,必填;留空或 0 时转换成 `bbr`
78 |
--------------------------------------------------------------------------------
/docs/config/transport/quic.md:
--------------------------------------------------------------------------------
1 | # QUIC
2 |
3 | QUIC 全称 Quick UDP Internet Connection,是由 Google 提出的使用 UDP 进行多路并发传输的协议。其主要优势是:
4 |
5 | 1. 减少了握手的延迟(1-RTT 或 0-RTT)
6 | 2. 多路复用,并且没有 TCP 的阻塞问题
7 | 3. 连接迁移,(主要是在客户端)当由 Wifi 转移到 4G 时,连接不会被断开。
8 |
9 | ## 版本历史
10 |
11 | V2Ray 4.7:
12 |
13 | * 开始支持 QUIC。
14 | * 默认设定:
15 | * 12 字节的 Connection ID
16 | * 30 秒没有数据通过时自动断开连接 (可能会影响一些长连接的使用)
17 |
18 | ## QuicObject
19 |
20 | `QuicObject` 对应传输配置的 `quicSettings` 项。对接的两端的配置必须完全一致,否则连接失败。QUIC 强制要求开启 TLS,在传输配置中没有开启 TLS 时,V2Ray 会自行签发一个证书进行 TLS 通讯。在使用 QUIC 传输时,可以关闭 VMess 的加密。
21 |
22 | ```json
23 | {
24 | "security": "none",
25 | "key": "",
26 | "header": {
27 | "type": "none"
28 | }
29 | }
30 | ```
31 |
32 | > `security`: "none" | "aes-128-gcm" | "chacha20-poly1305"
33 |
34 | 加密方式。默认值为不加密。
35 |
36 | 此加密是对 QUIC 数据包的加密,加密后数据包无法被探测。
37 |
38 | > `key`: string
39 |
40 | 加密时所用的密钥。可以是任意字符串。当 `security` 不为 `"none"` 时有效。
41 |
42 | > `header`: [HeaderObject](#headerobject)
43 |
44 | 数据包头部伪装设置
45 |
46 | ## HeaderObject
47 |
48 | ```json
49 | {
50 | "type": "none"
51 | }
52 | ```
53 |
54 | > `type`: string
55 |
56 | 伪装类型,可选的值有:
57 |
58 | * `"none"`:默认值,不进行伪装。
59 | * `"srtp"`:伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)。
60 | * `"utp"`:伪装成 uTP 数据包,会被识别为 BT 下载数据。
61 | * `"wechat-video"`:伪装成微信视频通话的数据包。
62 | * `"dtls"`:伪装成 DTLS 1.2 数据包。
63 | * `"wireguard"`:伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)
64 |
65 | :::tip
66 | 当加密和伪装都不启用时,数据包即为原始的 QUIC 数据包,可以与其它的 QUIC 工具对接。为了避免被探测,建议加密或伪装至少开启一项。
67 | :::
68 |
--------------------------------------------------------------------------------
/docs/config/transport/tcp.md:
--------------------------------------------------------------------------------
1 | # TCP
2 |
3 | ## TcpObject
4 |
5 | `TcpObject` 对应传输配置的 `tcpSettings` 项。
6 |
7 | ```json
8 | {
9 | "acceptProxyProtocol": false,
10 | "header": {
11 | "type": "none"
12 | }
13 | }
14 | ```
15 |
16 | > `acceptProxyProtocol`: true | false
17 |
18 | v4.27.1+,仅用于 inbound,是否接收 PROXY protocol,默认值为 `false`。填写 `true` 时,最底层 TCP 连接建立后,请求方必须先发送 PROXY protocol v1 或 v2,否则连接会被关闭。
19 |
20 | [PROXY protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt) 专用于传递请求的真实来源 IP 和端口,**若你不了解它,请先忽略该项**。常见的反代软件(如 HAProxy、Nginx)都可以配置发送它,VLESS fallbacks xver 也可以发送它。
21 |
22 | > `header`: NoneHeaderObject | HttpHeaderobject
23 |
24 | 数据包头部伪装设置,默认值为 `NoneHeaderObject`。HTTP 伪装无法被其它 HTTP 服务器(如 Nginx)分流,但可以被 VLESS fallbacks path 分流。
25 |
26 | ## NoneHeaderObject
27 |
28 | 不进行伪装
29 |
30 | ```json
31 | {
32 | "type": "none"
33 | }
34 | ```
35 |
36 | > `type`: "none"
37 |
38 | 指定不进行伪装
39 |
40 | ## HttpHeaderObject
41 |
42 | HTTP 伪装配置必须在对应的入站出站连接上同时配置,且内容必须一致。
43 |
44 | ```json
45 | {
46 | "type": "http",
47 | "request": {},
48 | "response": {}
49 | }
50 | ```
51 |
52 | > `type`: "http"
53 |
54 | 指定进行 HTTP 伪装
55 |
56 | > `request`: [HTTPRequestObject](#httprequestobject)
57 |
58 | HTTP 请求
59 |
60 | > `response`: [HTTPResponseObject](#httpresponseobject)
61 |
62 | HTTP 响应
63 |
64 | ## HTTPRequestObject
65 |
66 | ```json
67 | {
68 | "version": "1.1",
69 | "method": "GET",
70 | "path": [
71 | "/"
72 | ],
73 | "headers": {
74 | "Host": [
75 | "www.baidu.com",
76 | "www.bing.com"
77 | ],
78 | "User-Agent": [
79 | "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36",
80 | "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
81 | ],
82 | "Accept-Encoding": [
83 | "gzip, deflate"
84 | ],
85 | "Connection": [
86 | "keep-alive"
87 | ],
88 | "Pragma": "no-cache"
89 | }
90 | }
91 | ```
92 |
93 | > `version`: string
94 |
95 | HTTP 版本,默认值为 `"1.1"`。
96 |
97 | > `method`: string
98 |
99 | HTTP 方法,默认值为 `"GET"`。
100 |
101 | > `path`: \[ string \]
102 |
103 | 路径,一个字符串数组。默认值为 `["/"]`。当有多个值时,每次请求随机选择一个值。
104 |
105 | > `headers`: map{ string, \[ string \]}
106 |
107 | HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是一个数组。每次请求会附上所有的键,并随机选择一个对应的值。默认值见上方示例。
108 |
109 | ## HTTPResponseObject
110 | ```json
111 | {
112 | "version": "1.1",
113 | "status": "200",
114 | "reason": "OK",
115 | "headers": {
116 | "Content-Type": [
117 | "application/octet-stream",
118 | "video/mpeg"
119 | ],
120 | "Transfer-Encoding": [
121 | "chunked"
122 | ],
123 | "Connection": [
124 | "keep-alive"
125 | ],
126 | "Pragma": "no-cache"
127 | }
128 | }
129 | ```
130 |
131 | > `version`: string
132 |
133 | HTTP 版本,默认值为 `"1.1"`。
134 |
135 | > `status`: string
136 |
137 | HTTP 状态,默认值为 `"200"`。
138 |
139 | > `reason`: string
140 |
141 | HTTP 状态说明,默认值为 `"OK"`。
142 |
143 | > `headers`: map {string, \[ string \]}
144 |
145 | HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是一个数组。每次请求会附上所有的键,并随机选择一个对应的值。默认值见上方示例。
146 |
--------------------------------------------------------------------------------
/docs/config/transport/websocket.md:
--------------------------------------------------------------------------------
1 | # WebSocket
2 |
3 | 使用标准的 WebSocket 来传输数据。WebSocket 连接可以被其它 HTTP 服务器(如 Nginx)分流,也可以被 VLESS fallbacks path 分流。
4 |
5 | :::tip
6 | Websocket 会识别 HTTP 请求的 X-Forwarded-For 头来覆写流量的源地址,优先级高于 PROXY protocol。
7 | :::
8 |
9 | ## WebSocketObject
10 |
11 | `WebSocketObject` 对应传输配置的 `wsSettings` 项。
12 |
13 | ```json
14 | {
15 | "acceptProxyProtocol": false,
16 | "path": "/",
17 | "headers": {
18 | "Host": "v2ray.com"
19 | },
20 | "maxEarlyData": 1024,
21 | "useBrowserForwarding": false,
22 | "earlyDataHeaderName":""
23 | }
24 | ```
25 |
26 | > `acceptProxyProtocol`: true | false
27 |
28 | v4.27.1+,仅用于 inbound,是否接收 PROXY protocol,默认值为 `false`。填写 `true` 时,最底层 TCP 连接建立后,请求方必须先发送 PROXY protocol v1 或 v2,否则连接会被关闭。
29 |
30 | [PROXY protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt) 专用于传递请求的真实来源 IP 和端口,**若你不了解它,请先忽略该项**。常见的反代软件(如 HAProxy、Nginx)都可以配置发送它,VLESS fallbacks xver 也可以发送它。
31 |
32 | > `path` string
33 |
34 | WebSocket 所使用的 HTTP 协议路径,默认值为 `"/"`。
35 |
36 | > `headers`: map \{string: string\}
37 |
38 | 自定义 HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是字符串。默认值为空。
39 |
40 | > `maxEarlyData`: number
41 |
42 | 所要发送的前置数据的最长长度。用于减少连接建立的时间。(v4.37.0+)
43 |
44 | 数据会以 Base64 RawURLEncoding 的形式附加在 path 之后,转发时需要根据前缀进行匹配。
45 |
46 | 如果设置 `earlyDataHeaderName` 则会将前置数据放置于该 HTTP 头。(v4.39.0+)
47 |
48 | 对于接收端,设置为任何非 0 数值都代表启用前置数据支持。
49 |
50 | > `useBrowserForwarding`: true | false
51 |
52 | 是否启用浏览器转发。如果启用浏览器转发,相应的 WebSockets 连接就会经过浏览器转发模块进行转发后再发送至互联网。(v4.37.0+)
53 |
54 | v4.37.0+ 服务器端程序会自动适配客户端的浏览器转发功能,无需额外设置。
55 |
56 | 只兼容基于基于路径的前置数据或者 HTTP 头的名字为 "Sec-WebSocket-Protocol" 的启用基于 HTTP 头的前置数据。
57 |
58 | 相关配置请参考浏览器转发模块文档。[BrowserForwarderObject](../browserforwarder.md)
59 |
60 | > `earlyDataHeaderName` : string
61 |
62 | 发送的前置数据的 HTTP 头的名字,设置后启用基于 HTTP 头的前置数据。如果留空则使用基于路径的前置数据。(v4.39.0+)
63 |
64 | 当且仅当 HTTP 头的名字为 "Sec-WebSocket-Protocol" 时可以启用基于 HTTP 头的前置数据浏览器转发功能。
65 |
66 | :::tip
67 | V2Ray 的 WebSocket 前置数据实现已经完成与其他项目的兼容,正确设置后可以连接其他实现的服务器端。
68 |
69 | 其他项目的客户端可能无法连接 V2Ray 服务器端。
70 | :::
71 |
--------------------------------------------------------------------------------
/docs/developer/intro/compile.md:
--------------------------------------------------------------------------------
1 | # 第一步:学会编译
2 |
3 | ## 前序工作
4 |
5 | V2Ray 使用 [Golang](https://golang.org/) 作为主要编程语言,团队发布流程上使用 [GitHub Actions](https://github.com/features/actions) 作为构建工具。推荐使用 Linux 或 macOS 进行开发,少量的脚本可能无法在 Windows 上正常运行。
6 |
7 | * 安装 Golang: [golang.org/doc/install](https://golang.org/doc/install)(若无法访问,可选择[国内镜像](https://golang.google.cn/doc/install))
8 |
9 | ## 多种构建方式
10 |
11 | ### 拉取 V2Ray 源代码和依赖
12 |
13 | ```bash
14 | git clone https://github.com/v2fly/v2ray-core.git
15 | cd v2ray-core && go mod download
16 | ```
17 |
18 | 注意:在无法正常访问 Google 的网络环境,依赖无法被正常拉取,需要先设置 `GOPROXY`:
19 |
20 | ```bash
21 | go env -w GOPROXY=https://goproxy.io,direct
22 | ```
23 |
24 | ### 手工构建
25 |
26 | :::tip
27 | 本小节的命令需要在 V2Ray 项目根目录内运行。
28 | :::
29 |
30 | ```bash
31 | CGO_ENABLED=0 go build -o $HOME/v2ray -trimpath -ldflags "-s -w -buildid=" ./main
32 | ```
33 |
34 | 运行以上命令会在当前用户的 `$HOME` 目录下生成刚构建的 `v2ray` 可执行文件,即可正常使用。
35 |
36 | 构建其他 CPU 架构、其他系统(Windows/macOS)的可执行文件,属于 Golang 的交叉编译流程,主要是控制 `GOOS` / `GOARCH` 两个环境变量,详情请参阅 Golang 相关文档。
37 |
38 | 下面演示如何构建可运行在 Windows 64 位系统的 `v2ray.exe`、`wv2ray.exe` 可执行文件(非 Windows 系统不需要编译 `wv2ray.exe`):
39 |
40 | ```bash
41 | CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $HOME/v2ray.exe -trimpath -ldflags "-s -w -buildid=" ./main
42 | CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $HOME/wv2ray.exe -trimpath -ldflags "-s -w -H windowsgui -buildid=" ./main
43 | ```
44 |
45 | 执行 `go tool dist list` 查看所有支持的系统与架构。某些架构还需要控制其它环境变量,如 `arm` 的 `GOARM`,用于设置运行时 CPU 浮点协处理器的版本。
46 |
47 | ### 脚本构建
48 |
49 | 以上手工构建的只是 v2ray 可执行程序本身,发行包内还包含了地址库(`geoip.dat`、`geosite.dat`)、配置文件等其他文件。使用打包脚本可方便地制作出适用于多种操作系统、多种 CPU 架构的发布包。
50 |
51 | ```bash
52 | wget https://raw.githubusercontent.com/v2fly/v2ray-core/master/release/user-package.sh
53 | chmod 755 user-package.sh
54 | ./user-package.sh
55 | ```
56 |
57 | 直接执行以上脚本即可在当前目录生成适用于 64 位 linux 操作系统的可执行文件,文件名类似于 `v2ray-custom-linux-amd64-20201008-104530.zip`,即为发布包。
58 |
59 | 你还可以使用一些个性化参数来定制发布包:
60 |
61 | * `windows` 构建 Windows 版本的发布包
62 | * `darwin` 构建 darwin(macOS)版本的发布包
63 | * `tgz` 发布包使用 `tar.gz` 格式
64 | * `386` 构建 32 位可执行文件
65 | * `arm` 构建适用于 arm 架构 CPU 的可执行文件
66 | * `mips` 构建适合于 mips 架构 CPU 的可执行文件,请参阅 Golang 交叉编译文档
67 | * `nodat` 不包含域名/IP 数据库 `geoip.dat`、`geosite.dat`(可以减小发布包的大小)
68 | * `noconf` 不包含范例 JSON、Systemd/Systemv 等配置文件
69 | * `nosource` 不要从远端拉取 V2Ray 源代码(此选项适用于本地已有 V2Ray 源代码的情况。运行脚本前必须先进入到本地 v2ray 代码根目录)
70 |
71 | 以上参数没有次序要求,只需要按需传给脚本。下面以构建一个适用于 32 位 Windows 操作系统、不带地址库、不带样例配置的发布包为例:
72 |
73 | ```bash
74 | ./user-package.sh windows 386 nodat noconf
75 | ```
76 |
77 | 脚本构建的 v2ray,其启动信息会变成用户编译的时间,以做区分:
78 |
79 | ```bash
80 | V2Ray 4.30.0 (user) 20201008-104530
81 | A unified platform for anti-censorship.
82 | ```
83 |
84 | 用户还可自定义 `codename`,定制属于自己的版本:
85 |
86 | ```bash
87 | ./user-package.sh windows 386 nodat noconf codename=custom-codename
88 | ```
89 |
--------------------------------------------------------------------------------
/docs/developer/intro/design.md:
--------------------------------------------------------------------------------
1 | # 第二步:了解架构
2 |
3 | 本文描述了 V2Ray 内核(v2ray-core)的设计思路。
4 |
5 | ## 目标
6 |
7 | * V2Ray 内核提供了一个平台,支持必要的网络代理功能,在其之上可以进行二次开发,以提供更好的用户体验;
8 | * 以跨平台为首要原则,以减少二次开发的成本;
9 |
10 | ## 架构
11 |
12 | 
13 |
14 | 内核分为三层:应用层、代理层和传输层。每一层内包含数个模块,模块间互相独立,同类型的模块可无缝替换。
15 |
16 | ## 应用层
17 |
18 | 应用层包含一些代理层中常用的功能,这些功能被抽象出来,以便在不同的代理模块中复用。应用层的模块应为纯软件实现,与硬件或平台相关的技术无关。
19 |
20 | 重要模块列表:
21 |
22 | * Dispatcher: 用于把入站代理所接收到的数据,传送给出站代理;
23 | * Router: 内置路由,详见 [路由配置](../../config/routing.md);
24 | * DNS: 内置的 DNS 缓存;
25 | * Proxy Manager: 入站代理的管理器;
26 |
27 | ## 代理层
28 |
29 | 代理层分为两部分:入站代理(Inbound Proxy)和出站代理(Outbound Proxy)。两部分相互独立,入站代理不依赖于某个特定的出站代理,反之亦然。
30 |
31 | ### 入站代理
32 |
33 | * 实现 [proxy.Inbound](https://github.com/v2fly/v2ray-core/blob/master/proxy/proxy.go) 接口;
34 |
35 | ### 出站代理
36 |
37 | * 实现 [proxy.Outbound](https://github.com/v2fly/v2ray-core/blob/master/proxy/proxy.go) 接口;
38 |
39 | ## 传输层
40 |
41 | 传输层提供一些网络数据传输相关的工具模块。
42 |
--------------------------------------------------------------------------------
/docs/developer/intro/guide.md:
--------------------------------------------------------------------------------
1 | # 第三步:开始开发
2 |
3 | ## 基本
4 |
5 | ### 版本控制
6 |
7 | Git
8 |
9 | ### 分支(Branch)
10 |
11 | 本项目只使用一个分支,即 master 。所有更改全部提交进 master,并确保 master 在任一时刻都是可编译可使用的。
12 |
13 | ### 发布(Release)
14 |
15 | 尽量使用自动化工具发布,比如 v2ray-core 使用 GitHub Actions 作为自动编译和发布工具。
16 |
17 | ### 引用其它项目
18 |
19 | * Golang
20 | * 产品代码建议使用 Golang 标准库和 `golang.org/x/` 下的库;
21 | * 如需引用其它项目,请事先创建 issue 讨论;
22 | * 其它
23 | * 只要不违反双方的协议(本项目为 MIT),且对项目有帮助的工具,都可以使用。
24 |
25 | ## 开发流程
26 |
27 | ### 写代码之前
28 |
29 | 发现任何问题,或对项目有任何想法,请创建 Issue 讨论以减少重复劳动和消耗在代码上的时间。
30 |
31 | ### 修改代码
32 |
33 | * Golang
34 | * 请参考 [Effective Go](https://golang.org/doc/effective_go.html);
35 | * 每一次 push 之前,请在项目根目录运行:`go generate format.go`;
36 | * 每一次 push 之前,请确保测试通过:`go test ./...`;
37 | * 若修改了 proto 文件,则需要重新生成 `pb.go` 文件,请在项目根目录运行:`go generate proto.go`;
38 | * 提交 pull request 之前,请确保新增代码有超过 70% 的代码覆盖率(code coverage);
39 | * 其它
40 | * 请注意代码的可读性。
41 |
42 | ### Pull Request
43 |
44 | * 提交 PR 之前,请先运行 `git pull https://github.com/v2fly/v2ray-core.git` 以确保 merge 可顺利进行;
45 | * 一个 PR 只做一件事,如有对多个 bug 的修复,请对每一个 bug 提交一个 PR;
46 | * 由于 Golang 的特殊需求(Package path),Go 项目的 PR 流程和其它项目有所不同:
47 | 1. 先 Fork 本项目,创建自己的 `github.com/your/v2ray-core` 仓库;
48 | 2. 克隆自己的 v2ray 仓库到本地:`git clone https://github.com/your/v2ray-core.git`;
49 | 3. 基于 `master` 分支创建新的分支;
50 | 4. 在自行创建的分支上作修改并提交修改(commit);
51 | 5. 在推送(push)修改完成的分支到自己的仓库前,先切换到 `master` 分支,运行 `git pull https://github.com/v2fly/v2ray-core.git` 拉取最新的远端代码;
52 | 6. 如果上一步拉取得到了新的远端代码,则切换到之前自己创建的分支,运行 `git rebase master` 执行分支合并操作。如遇到文件冲突,则需要解决冲突;
53 | 7. 上一步处理完毕后,就可以把自己创建的分支推送到自己的仓库:`git push -u origin your-branch`
54 | 8. 最后,把自己仓库的新推送的分支往 `v2fly/v2ray-core` 的 `master` 分支发 PR 即可;
55 | 9. 请在 PR 的标题和正文中,完整表述此次 PR 解决的问题 / 新增的功能 / 代码所做的修改的用意等;
56 | 10. 耐心等待开发者的回应。
57 |
58 | ### 对代码的修改
59 |
60 | #### 功能性问题
61 |
62 | 请提交至少一个测试用例(Test Case)来验证对现有功能的改动。
63 |
64 | #### 性能相关
65 |
66 | 请提交必要的测试数据来证明现有代码的性能缺陷,或是新增代码的性能提升。
67 |
68 | #### 新功能
69 |
70 | * 如果新增功能对已有功能不影响,请提供可以开启/关闭的开关(如 flag),并使新功能保持默认关闭的状态;
71 | * 大型新功能(比如增加一个新的协议)开发之前,请先提交一个 issue,讨论完毕之后再进行开发。
72 |
73 | #### 其它
74 |
75 | 视具体情况而定。
76 |
77 | ## V2Ray 编码规范
78 |
79 | 以下内容适用于 V2Ray 中的 Golang 代码。
80 |
81 | ### 代码结构
82 |
83 | ```bash
84 | v2ray-core
85 | ├── app // 应用模块
86 | │ ├── router // 路由
87 | ├── common // 公用代码
88 | ├── proxy // 通讯协议
89 | │ ├── blackhole
90 | │ ├── dokodemo-door
91 | │ ├── freedom
92 | │ ├── socks
93 | │ ├── vmess
94 | ├── transport // 传输模块
95 | ```
96 |
97 | ### 编码规范
98 |
99 | 基本与 Golang 官方所推荐做法一致,有一些例外。写在这里以方便大家熟悉 Golang。
100 |
101 | #### 命名
102 |
103 | * 文件和目录名尽量使用单个英文单词,比如 hello.go;
104 | * 如果实在没办法,则目录使用连接线/文件名使用下划线连接两个(或多个单词),比如 hello-world/hello_again.go;
105 | * 测试代码使用 _test.go 结尾;
106 | * 类型使用 Pascal 命名法,比如 ConnectionHandler;
107 | * 对缩写不强制小写,即 HTML 不必写成 Html;
108 | * 公开成员变量也使用 Pascal 命名法;
109 | * 私有成员变量使用 [小驼峰式命名法](https://zh.wikipedia.org/wiki/%E9%A7%9D%E5%B3%B0%E5%BC%8F%E5%A4%A7%E5%B0%8F%E5%AF%AB) ,如 `privateAttribute` ;
110 | * 为了方便重构,方法建议全部使用 Pascal 命名法;
111 | * 完全私有的类型放入 `internal` 。
112 |
113 | #### 内容组织
114 |
115 | * 一个文件包含一个主要类型,及其相关的私有函数等;
116 | * 测试相关的文件,如 Mock 等工具类,放入 testing 子目录。
117 |
--------------------------------------------------------------------------------
/docs/developer/intro/releasearchive.md:
--------------------------------------------------------------------------------
1 | # Release Archive
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the English documentation.
4 |
--------------------------------------------------------------------------------
/docs/developer/intro/releasesigning.md:
--------------------------------------------------------------------------------
1 | # Release Signing
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the English documentation.
4 |
--------------------------------------------------------------------------------
/docs/developer/protocols/mkcp.md:
--------------------------------------------------------------------------------
1 | # mKCP 协议
2 |
3 | mKCP 是流式传输协议,由 [KCP 协议](https://github.com/skywind3000/kcp)修改而来,可以按顺序传输任意的数据流。
4 |
5 | ## 版本
6 |
7 | mKCP 没有版本号,不保证版本之间兼容性。
8 |
9 | ## 依赖
10 |
11 | ### 底层协议
12 |
13 | mKCP 是一个基于 UDP 的协议,所有通讯使用 UDP 传输。
14 |
15 | ### 函数
16 |
17 | * fnv: [FNV-1a](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) 哈希函数
18 | * 输入参数为任意长度的字符串;
19 | * 输入出一个 32 位无符号整数;
20 |
21 | ## 通讯过程
22 |
23 | 1. mKCP 将数据流拆成若干个数据包进行发送。一个数据流有一个唯一标识,用以区分不同的数据流。数据流中的每一个数据包都携带了同样的标识。
24 | 1. mKCP 没有握手过程,当收到一个数据包时,根据其携带的数据流的标识来判断是否为新的通话,或是正在进行中的通话。
25 | 1. 每一个数据包中包含若干个片段(Segment),片段分为三类:数据(Data)、确认(ACK)、心跳(Ping)。每个片段需要单独处理。
26 |
27 | ## 数据格式
28 |
29 | ### 数据包
30 |
31 | | 4 字节 | 2 字节 | L 字节 |
32 | |---------|----------|--------|
33 | | 认证信息 A| 数据长度 L | 片段部分|
34 |
35 | 其中:
36 |
37 | * 认证信息 A = fnv(片段部分),big endian;
38 | * 片段部分可能包含多个片段;
39 |
40 | ### 数据片段
41 |
42 | | 2 字节 | 1 字节 | 1 字节 | 4 字节 | 4 字节 | 4 字节 | 2 字节 | Len 字节 |
43 | |---------|--------|--------|-------- |---------|----------------|--------|----------|
44 | |标识 Conv|指令 Cmd|选项 Opt|时间戳 Ts|序列号 Sn|未确认序列号 Una|长度 Len|数据 |
45 |
46 | 其中:
47 | * 标识 Conv: mKCP 数据流的标识
48 | * 指令 Cmd: 常量 0x01
49 | * 选项 Opt: 可选的值有:
50 | * 0x00: 空选项
51 | * 0x01: 对方已发出所有数据
52 | * 时间戳 Ts: 当前片段从远端发送出来时的时间,big endian
53 | * 序列号 Sn: 该数据片段时数据流中的位置,起始片段的序列号为 0,之后每个新片段按顺序加 1
54 | * 未确认序列号 Una: 远端主机正在发送的,且尚未收到确认的最小的 Sn
55 |
56 | ### 确认片段
57 |
58 | | 2 字节 | 1 字节 | 1 字节 | 4 字节 | 4 字节 | 4 字节 | 2 字节 | Len * 4 字节 |
59 | |---------|--------|--------|---------|-----------------|---------|--------|--------------|
60 | |标识 Conv|指令 Cmd|选项 Opt|窗口 Wnd |下一接收序列号 Sn|时间戳 Ts|长度 Len|已收到的序列号|
61 |
62 | 其中:
63 | * 标识 Conv: mKCP 数据流的标识
64 | * 指令 Cmd: 常量 0x00
65 | * 选项 Opt: 同上
66 | * 窗口 Wnd: 远端主机可以接收的最大序列号
67 | * 下一接收序列号 Sn: 远端主机未收到的数据片段中的最小序列号
68 | * 时间戳 Ts: 远端主机最新收到的数据片段的时间戳,可用于计算延迟
69 | * 已收到的序列号: 每个 4 字节,表示此序列号的数据已经确认收到
70 |
71 | 注释:
72 |
73 | * 远程主机期待收到序列号 [Sn, Wnd) 范围内的数据
74 |
75 | ### 心跳片段
76 |
77 | | 2 字节 | 1 字节 | 1 字节 | 4 字节 | 4 字节 | 4 字节 |
78 | |---------|--------|--------|-----------------|-----------------|---------|
79 | |标识 Conv|指令 Cmd|选项 Opt|未确认序列号 Una |下一接收序列号 Sn|延迟 Rto |
80 |
81 | 其中:
82 |
83 | * 标识 Conv: mKCP 数据流的标识
84 | * 指令 Cmd: 可选的值有
85 | * 0x02: 远端主机强行终止会话
86 | * 0x03: 正常心跳
87 | * 选项 Opt: 同上
88 | * 未确认序列号 Una: 同数据片段的 Una
89 | * 下一接收序列号 Sn: 同确认片段的 Sn
90 | * 延迟 Rto: 远端主机自己计算出的延迟
91 |
92 |
--------------------------------------------------------------------------------
/docs/developer/protocols/muxcool.md:
--------------------------------------------------------------------------------
1 | # Mux.Cool 协议
2 |
3 | Mux.Cool 协议是一个多路复用传输协议,用于在一条已建立的数据流中传输多个各自独立的数据流。
4 |
5 | ## 版本
6 |
7 | 当前版本是 1 Beta。
8 |
9 | ## 依赖
10 |
11 | ### 底层协议
12 |
13 | Mux.Cool 必须运行在一个已建立的可靠数据流之上。
14 |
15 | ## 通讯过程
16 |
17 | 一个 Mux.Cool 连接中可传输若干个子连接,每个子连接有一个独立的 ID 和状态。传输过程由帧(Frame)组成,每一帧用于传输一个特定的子连接的数据。
18 |
19 | ### 客户端行为
20 |
21 | 当有连接需求时并且没有现有可用的连接时,客户端向服务器发起一个新连接,以下称为“主连接”。
22 |
23 | 1. 一个主连接可用于发送若干个子连接。客户端可自主决定主连接可承载的子连接数量。
24 | 1. 对于一个新的子连接,客户端必须发送状态`New`以通知服务器建立子连接,然后使用状态`Keep`来传送数据。
25 | 1. 当子连接结束时,客户端发送`End`状态来通知服务器关闭子连接。
26 | 1. 客户端可自行决定何时关闭主连接,但必须确定服务器也同时保持连接。
27 | 1. 客户端可使用 KeepAlive 状态来避免服务器关闭主连接。
28 |
29 | ### 服务器端行为
30 |
31 | 当服务器端接收到新的子连接时,服务器应当按正常的连接来处理。
32 |
33 | 1. 当收到状态`End`时,服务器端可以关闭对目标地址的上行连接。
34 | 1. 在服务器的响应中,必须使用与请求相同的 ID 来传输子连接的数据。
35 | 1. 服务器不能使用`New`状态。
36 | 1. 服务器可使用 KeepAlive 状态来避免客户端关闭主连接。
37 |
38 | ## 传输格式
39 |
40 | Mux.Cool 使用对称传输格式,即客户端和服务器发送和接收相同格式的数据。
41 |
42 | ### 帧格式
43 |
44 | | 2 字节 | L 字节 | X 字节 |
45 | |-----------|--------|-------|
46 | | 元数据长度 L| 元数据 | 额外数据|
47 |
48 | ### 元数据
49 |
50 | 元数据有若干种类型,由状态 S 来区分。所有类型的元数据都包含 ID 和 Opt 两项,其含义为:
51 |
52 | * ID: 子连接的唯一标识
53 | * Opt:
54 | * D(0x01): 有额外数据
55 |
56 | 当选项 Opt(D) 开启时,额外数据格式如下:
57 |
58 | | 2 字节 | L 字节 |
59 | |-------|---------|
60 | | 长度 L | 数据 |
61 |
62 | #### 新建子连接 (New)
63 |
64 | | 2 字节 | 1 字节 | 1 字节 | 1 字节 | 2 字节 | 1 字节 | X 字节 |
65 | |-------|--------|---------|-----------|-------|-----------|-------|
66 | | ID | 0x01 | 选项 Opt | 网络类型 N | 端口 | 地址类型 T | 地址 A |
67 |
68 | 其中:
69 |
70 | * 网络类型 N:
71 | * 0x01:TCP,表示当前子连接的流量应当以 TCP 的方式发送至目标。
72 | * 0x02:UDP,表示当前子连接的流量应当以 UDP 的方式发送至目标。
73 | * 地址类型 T:
74 | * 0x01:IPv4
75 | * 0x02:域名
76 | * 0x03:IPv6
77 | * 地址 A:
78 | * 当 T = 0x01 时,A 为 4 字节 IPv4 地址;
79 | * 当 T = 0x02 时,A 为 1 字节长度(L) + L 字节域名;
80 | * 当 T = 0x03 时,A 为 16 字节 IPv6 地址;
81 |
82 | 在新建子连接时,若 Opt(D) 开启,则这一帧所带的数据需要被发往目标主机。
83 |
84 | #### 保持子连接 (Keep)
85 |
86 | | 2 字节 | 1 字节 | 1 字节 |
87 | |-------|--------|---------|
88 | | ID | 0x02 | 选项 Opt |
89 |
90 | 在保持子连接时,若 Opt(D) 开启,则这一帧所带的数据需要被发往目标主机。
91 |
92 | #### 关闭子连接 (End)
93 |
94 | | 2 字节 | 1 字节 | 1 字节 |
95 | |-------|--------|---------|
96 | | ID | 0x03 | 选项 Opt |
97 |
98 | 在保持子连接时,若 Opt(D) 开启,则这一帧所带的数据需要被发往目标主机。
99 |
100 | #### 保持连接 (KeepAlive)
101 |
102 | | 2 字节 | 1 字节 | 1 字节 |
103 | |-------|--------|---------|
104 | | ID | 0x04 | 选项 Opt |
105 |
106 | 在保持连接时:
107 |
108 | * 若 Opt(D) 开启,则这一帧所带的数据必须被丢弃。
109 | * ID 可为随机值。
110 |
111 | ## 应用
112 |
113 | Mux.Cool 协议与底层协议无关,理论上可以使用任何可靠的流式连接来传输 Mux.Cool 的协议数据。
114 |
115 | 在目标导向的协议如 Shadowsocks 和 VMess 协议中,连接建立时必须包含一个指定的地址。为了保持兼容性,Mux.Cool 协议指定地址为“v1.mux.cool”。即当主连接的目标地址与之匹配时,则进行 Mux.Cool 方式的转发,否则按传统方式进行转发。
--------------------------------------------------------------------------------
/docs/en_US/awesome/tools.md:
--------------------------------------------------------------------------------
1 | # Awesome Tools
2 |
3 | ## Online Tools
4 |
5 | > UUID Generator
6 |
7 |
8 |
9 | There's also a third-party UUID generator [uuidgenerator.net](https://www.uuidgenerator.net)
10 |
11 | ## Third-party GUI Clients
12 |
13 |
19 |
20 |
26 |
27 |
33 |
34 |
40 |
41 |
47 |
48 |
54 |
55 |
61 |
62 | ## Routing Rules
63 |
64 | > V2Ray Rules Dat
65 |
66 | Enhanced version of V2Ray routing rules file, can replace official `geoip.dat` and `geosite.dat` [@Loyalsoldier/v2ray-rules-dat](https://github.com/Loyalsoldier/v2ray-rules-dat)
67 |
--------------------------------------------------------------------------------
/docs/en_US/config/api.md:
--------------------------------------------------------------------------------
1 | # Remote control API
2 |
3 | Some V2Ray APIs can be opened for remote control. These APIs are based on [gRPC](https://grpc.io/). This API is mostly for advanced users.
4 |
5 | When remote control is turned on, V2Ray will build an outbound proxy by itself, which is identified by the value of the `tag` configuration. The user must manually point all inbound gRPC connections to this outbound proxy through [routing](routing.md).
6 |
7 | ## ApiObject
8 |
9 | `ApiObject` corresponds to the `api` item of the configuration file.
10 |
11 | ```json
12 | {
13 | "tag": "api",
14 | "services": [
15 | "HandlerService",
16 | "LoggerService",
17 | "StatsService"
18 | ]
19 | }
20 | ```
21 |
22 | > `tag`: string
23 |
24 | Outbound proxy ID.
25 |
26 | > `services`: \[string\]
27 |
28 | The list of available APIs, see [API list](#list-of-supported-apis) for details.
29 |
30 | ## List of supported APIs
31 |
32 | ### HandlerService
33 |
34 | Some of the APIs that modify the inbound and outbound proxy:
35 |
36 | * Add a new inbound proxy;
37 | * Add a new outbound proxy;
38 | * Delete an existing inbound proxy;
39 | * Delete an existing outbound proxy;
40 | * Add a user to an inbound proxy (only support VMess, VLESS, Trojan);
41 | * Delete a user in an inbound proxy (only support VMess, VLESS, Trojan);
42 |
43 | ### LoggerService
44 |
45 | Supports the restart of the built-in Logger, and can cooperate with logrotate to perform some operations on the log file.
46 |
47 | ### StatsService
48 |
49 | The built-in data statistics service, please refer to [Statistics](stats.md) for details.
50 |
51 | ### ObservatoryService
52 |
53 | [Connection Observatory](observatory.md) API (v4.38.0+).
54 |
--------------------------------------------------------------------------------
/docs/en_US/config/browserforwarder.md:
--------------------------------------------------------------------------------
1 | # Browserforwarder
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/env.md:
--------------------------------------------------------------------------------
1 | # Environment variables
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/fakedns.md:
--------------------------------------------------------------------------------
1 | # "Fake" DNS server
2 |
3 | ## FakeDnsObject
4 |
5 | `FakeDnsObject` corresponds to the `fakedns` item of the configuration file. (4.35.0+)
6 |
7 | ```json
8 | {
9 | "ipPool": "240.0.0.0/8",
10 | "poolSize": 65535
11 | }
12 | ```
13 |
14 | > `ipPool`: string: CIDR
15 |
16 | The "Fake" DNS server's allocated IP address space. The address assigned by the virtual DNS server will conform to this CIDR expression.
17 |
18 | > `poolSize`: number
19 |
20 | The number of IP-domain mappings memorized by the "fake" DNS server.
21 |
22 | ## "Fake" DNS server mechanism
23 |
24 | The "Fake" DNS server will return a fictitious resolution result whose IP address in its own `ipPool` is the domain name and remember the relationship between the domain name and the fictitious resolution result.
25 |
26 | When the client program requests to connect to the host pointed to by this IP based on this analysis result, the `fakedns` traffic detection module corresponding to [inbounds] (inbounds.md) will restore the target address to the corresponding domain name.
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/en_US/config/multiple_config.md:
--------------------------------------------------------------------------------
1 | # Multiple config
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/observatory.md:
--------------------------------------------------------------------------------
1 | # Observatory
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/outbounds.md:
--------------------------------------------------------------------------------
1 | # Outbounds
2 |
3 | Outbound connections are used to send data to remote websites or the next level of proxy server. For available protocols, see the protocol list.
4 |
5 | ## OutboundObject
6 |
7 | `OutboundObject` corresponds to a child element of the `outbounds` item in the configuration file.
8 |
9 | ```json
10 | {
11 | "sendThrough": "0.0.0.0",
12 | "protocol": "Protocol Name",
13 | "settings": {},
14 | "tag": "Tag",
15 | "streamSettings": {},
16 | "proxySettings": {
17 | "tag": "another-outbound-tag"
18 | },
19 | "mux": {}
20 | }
21 | ```
22 |
23 | > `sendThrough`: address
24 |
25 | The IP address used to send data, valid when the host has multiple IP addresses, the default value is `"0.0.0.0"`.
26 |
27 | > `protocol`: string
28 |
29 | The name of the connection protocol. See the protocol list for optional values.
30 |
31 | > `settings`: OutboundConfigurationObject
32 |
33 | The specific configuration content varies depending on the protocol. See `OutboundConfigurationObject` in each protocol for details.
34 |
35 | > `tag`: string
36 |
37 | The identifier of this outbound connection, used to locate this connection in other configurations. When its value is not empty, it must be unique among all tags.
38 |
39 | > `streamSettings`: [StreamSettingsObject](transport.md#streamsettingsobject)
40 |
41 | [Low-level transmission configuration](transport.md#streamsettingsobject)
42 |
43 | > `proxySettings`: [ProxySettingsObject](#proxysettingsobject)
44 |
45 | Outbound proxy configuration. When the outbound proxy is in effect, the `streamSettings` of this outbound protocol will not work.
46 |
47 | > `mux`: [MuxObject](#muxobject)
48 |
49 | [Mux Configuration](#muxobject).
50 |
51 | ## ProxySettingsObject
52 |
53 | ```json
54 | {
55 | "tag": "another-outbound-tag"
56 | }
57 | ```
58 |
59 | > `tag`: string
60 |
61 | When the identifier of another outbound protocol is specified, the data sent by this outbound protocol will be forwarded to the specified outbound protocol.
62 |
63 | ## MuxObject
64 |
65 | The function of Mux is to distribute the data of multiple TCP connections on one TCP connection. See [Mux.Cool](../developer/protocols/muxcool.md) for implementation details. Mux is designed to reduce TCP's handshake delay, not to increase connection throughput. Using Mux to watch videos, download or measure speed usually has the opposite effect. Mux only needs to be enabled on the client side, and the server side automatically adapts.
66 |
67 | `MuxObject` corresponds to the `mux` item in `OutboundObject`.
68 |
69 | ```json
70 | {
71 | "enabled": false,
72 | "concurrency": 8
73 | }
74 | ```
75 |
76 | > `Enabled`: true | false
77 |
78 | Whether to enable Mux forwarding requests, the default value is `false`.
79 |
80 | > `concurrency`: number
81 |
82 | The maximum number of concurrent connections. The minimum value is `1`, the maximum value is `1024`, and the default value is `8`.
83 |
84 | Fill in a negative number, such as `-1`, do not load the mux module (v4.22.0+).
85 |
86 | This value indicates the maximum number of Mux connections carried on a TCP connection. When the client sends 8 TCP requests and `concurrency=8`, V2Ray will only send an actual TCP connection, and all 8 requests of the client are transmitted by this TCP connection.
87 |
--------------------------------------------------------------------------------
/docs/en_US/config/overview.md:
--------------------------------------------------------------------------------
1 | # Configuration File Format
2 |
3 | ## Overview
4 |
5 | Configuration of V2Ray is a file with the following format, both for server and client, but the settings are different.
6 |
7 | If you are a beginner of V2Ray, please start from understanding Inbounds and Outbounds. Filling in the necessary settings only and the application should work. Then learn about other components step-by-step. You will find that V2Ray is easy to use.
8 |
9 | ```json
10 | {
11 | "log": {},
12 | "api": {},
13 | "dns": {},
14 | "routing": {},
15 | "policy": {},
16 | "inbounds": [],
17 | "outbounds": [],
18 | "transport": {},
19 | "stats": {},
20 | "reverse": {}
21 | }
22 | ```
23 |
24 | > `log`: [LogObject](#logobject)
25 |
26 | Log configuration, instructing V2Ray how to print logs.
27 |
28 | > `api`: [ApiObject](api.md)
29 |
30 | Remote control.
31 |
32 | > `dns`: [DnsObject](dns.md)
33 |
34 | Build-in DNS servers. If this field does not exist, use local DNS by default.
35 |
36 | > `routing`: [RoutingObject](routing.md)
37 |
38 | Routing.
39 |
40 | > `policy`: [PolicyObject](policy.md)
41 |
42 | Local policy, permission-related configurations.
43 |
44 | > `inbounds`: \[ [InboundObject](inbounds.md) \]
45 |
46 | An array, each element of which is an inbound connection configuration.
47 |
48 | > `outbounds`: \[ [OutboundObject](outbounds.md) \]
49 |
50 | An array, each element of which is an outbound connection configuration. The first element in the list is the primary outbound connection. When the route matching cannot be found or the matching is invalid, the traffic is routed to the primary outbound connection.
51 |
52 | > `transport`: [TransportObject](transport.md)
53 |
54 | Telling V2Ray how to establish and keep connections with other servers.
55 |
56 | > `stats`: [StatsObject](stats.md)
57 |
58 | Statistics.
59 |
60 | > `reverse`: [ReverseObject](reverse.md)
61 |
62 | Reverse proxy.
63 |
64 | ## LogObject
65 |
66 | `LogObject` is a json field which the configuration file uses in `log`.
67 |
68 | ```json
69 | {
70 | "access": "file path",
71 | "error": "file path",
72 | "loglevel": "warning"
73 | }
74 | ```
75 |
76 | > `access`: string
77 |
78 | File path of log. It should be a valid path string, such as `"/tmp/v2ray/_access.log"` (Linux) or`"C:\\Temp\\v2ray\\_access.log"` (Windows). If it is empty, the log will be printed to stdout by default. V2Ray 4.20 added a special value `none`, which means no access to log.
79 |
80 | > `error`: string
81 |
82 | File path of error log. It should be a valid path string, such as `"/tmp/v2ray/_error.log"` (Linux) or `"C:\\Temp\\v2ray\\_error.log"` (Windows). If it is empty, the error will be printed to stdout by default. V2Ray 4.20 added a special value `none`, which means no access to error.
83 |
84 | > `loglevel`: "debug" | "info" | "warning" | "error" | "none"
85 |
86 | Level of log. Default value is `"warning"`。
87 |
88 | * `"debug"`:Information for developers. All `"info"` included.
89 | * `"info"`:Running stats of V2Ray,no effect for the functions. All `"warning"` included.
90 | * `"warning"`:V2Ray may have encountered some problem, usually some external problem that does not affect V2Ray but possibly the user experience. All `"error"` included.
91 | * `"error"`:V2Ray encountered a problem that needs to be resolved immediately.
92 | * `"none"`:Nothing will be printed.
93 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/blackhole.md:
--------------------------------------------------------------------------------
1 | # Blackhole
2 |
3 | * Name: `blackhole`
4 | * Type: Outbound Protocol
5 |
6 | Blackhole (black hole) is an outbound data protocol, which will hinder the outbound of all data. When used with [Routing](../routing.md), it can achieve the effect of prohibiting access to certain websites.
7 |
8 | ## OutboundConfigurationObject
9 |
10 | ```json
11 | {
12 | "response": {
13 | "type": "none"
14 | }
15 | }
16 | ```
17 |
18 | > `response`: [ResponseObject](#responseobject)
19 |
20 | Configure the response data of the black hole. Blackhole will send the specified response data after receiving the data to be forwarded, and then close the connection. The data to be forwarded will be discarded. If this item is not specified, Blackhole will close the connection directly.
21 |
22 | ### ResponseObject
23 |
24 | ```json
25 | {
26 | "type": "none"
27 | }
28 | ```
29 |
30 | > `type`: "http" | "none"
31 |
32 | When `type` is `"none"` (default value), Blackhole will close the connection directly. When `type` is `"http"`, Blackhole will send back a simple HTTP 403 packet and then close the connection.
33 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/dns.md:
--------------------------------------------------------------------------------
1 | # DNS
2 |
3 | * Name: `dns`
4 | * Type: Outbound Protocol
5 |
6 | DNS is an outbound protocol, mainly used to intercept and forward DNS queries. This outbound protocol can only receive DNS traffic (including queries based on UDP and TCP protocols), and other types of traffic will cause errors.
7 |
8 | When processing DNS queries, this outbound protocol will forward IP queries (ie A and AAAA) to the built-in [DNS server] (../dns.md). Other types of query traffic will be forwarded to their original destination address.
9 |
10 | DNS outbound protocol was introduced in V2Ray 4.15.
11 |
12 | ## OutboundConfigurationObject
13 |
14 | ```json
15 | {
16 | "network": "tcp",
17 | "address": "1.1.1.1",
18 | "port": 53
19 | }
20 | ```
21 |
22 | > `network`: "tcp" | "udp"
23 |
24 | (V2Ray 4.16+) Modify the transport layer protocol of DNS traffic. The optional values are `"tcp"` and `"udp"`. When not specified, the transmission mode of the source remains unchanged.
25 |
26 | > `address`: address
27 |
28 | (V2Ray 4.16+) Modify the DNS server address. When not specified, keep the address specified in the source unchanged.
29 |
30 | > `port`: number
31 |
32 | (V2Ray 4.16+) Modify the DNS server port. When not specified, keep the port specified in the source unchanged.
33 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/freedom.md:
--------------------------------------------------------------------------------
1 | # Freedom
2 |
3 | * Name: `freedom`
4 | * Type: Outbound Protocol
5 |
6 | Freedom is an outbound protocol that can be used to send (normal) TCP or UDP data to any network.
7 |
8 | ## OutboundConfigurationObject
9 |
10 | ```json
11 | {
12 | "domainStrategy": "AsIs",
13 | "redirect": "127.0.0.1:3366",
14 | "userLevel": 0
15 | }
16 | ```
17 |
18 | > `domainStrategy`: "AsIs" | "UseIP" | "UseIPv4" | "UseIPv6"
19 |
20 | When the target address is a domain name, Freedom can send a connection directly to this domain name (`"AsIs"`), or resolve the domain name to an IP before establishing a connection (`"UseIP"`, `"UseIPv4"` and `"UseIPv6" `). The step of resolving IP will use V2Ray [built-in DNS](../dns.md). The default value is `"AsIs"`.
21 |
22 | (V2Ray 4.6+) When the `"UseIP"` mode is used and the `sendThrough` is specified in [Outbound Connection Configuration](../overview.md#outboundobject), Freedom will automatically determine the location based on the value of `sendThrough` The type of IP required, IPv4 or IPv6.
23 |
24 | (V2Ray 4.7+) When using `"UseIPv4"` or `"UseIPv6"` mode, Freedom will only use the corresponding IPv4 or IPv6 address. When `sendThrough` specifies a local address that does not match, the connection will fail.
25 |
26 | > `redirect`: address_port
27 |
28 | Freedom will force all data to be sent to the specified address (instead of the address specified by the inbound protocol). The value is a string, example: `"127.0.0.1:80"`, `":1234"`. When the address is not specified, such as `":443"`, Freedom will not modify the original target address. When the port is `0`, such as `"v2ray.com: 0"`, Freedom will not modify the original port.
29 |
30 | > `userLevel`: number
31 |
32 | User level, all connections will be this level.
33 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/loopback.md:
--------------------------------------------------------------------------------
1 | # Loopback
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/shadowsocks.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/socks.md:
--------------------------------------------------------------------------------
1 | # Socks
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/trojan.md:
--------------------------------------------------------------------------------
1 | # Trojan
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/vless.md:
--------------------------------------------------------------------------------
1 | # VLESS
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/protocols/vmess.md:
--------------------------------------------------------------------------------
1 | # VMess
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/service.md:
--------------------------------------------------------------------------------
1 | # Service
2 |
3 | V2Ray have some built-in services that supplement the primary function of V2Ray. Can be configured using the jsonv4 configuration format with v5.17.0+.
4 |
5 | * [Browser Forwarder](service/browser.md)
6 | * [Policy](service/policy.md)
7 | * [Stats](service/stats.md)
8 | * [Background Observatory](service/backgroundObservatory.md)
9 | * [Burst Observatory](service/burstObservatory.md)
10 | * [Tun](service/tun.md)
11 | * [Subscription Manager](service/subscription.md)
12 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/backgroundObservatory.md:
--------------------------------------------------------------------------------
1 | # Background Observatory
2 | * Name: `burstObservatory`
3 | * Type: Service
4 | * ID: `service.burstObservatory`
5 |
6 | > `subjectSelector`: string
7 |
8 | The selectors for outbound under observation
9 |
10 | > `probeUrl`: string
11 |
12 | The URL to send probe request to.
13 |
14 | > `probeInterval`: number
15 |
16 | The time between each probe in second.
17 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/browser.md:
--------------------------------------------------------------------------------
1 | # Browser Forwarder
2 | * Name: `browser`
3 | * Type: Service
4 | * ID: `service.browser`
5 |
6 | > `listenAddr`: string
7 |
8 | The listening address for the browser forwarder.
9 |
10 | > `listenPort`: number
11 |
12 | The listening port for the browser forwarder.
13 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/burstObservatory.md:
--------------------------------------------------------------------------------
1 | # Burst Observatory
2 | * Name: `burstObservatory`
3 | * Type: Service
4 | * ID: `service.burstObservatory`
5 |
6 | > `subjectSelector`: string
7 |
8 | The selectors for outbound under observation
9 |
10 | >`pingConfig`: [PingConfigObject](#pingconfigobject)
11 |
12 |
13 | ### PingConfigObject
14 |
15 |
16 |
17 | > `destination`: string
18 |
19 | Ping destination URL. It should return 204 on success.
20 |
21 | > `connectivity`: string
22 |
23 | Connectivity check URL.
24 |
25 | > `interval`: number
26 |
27 | Health check interval, int64 values of time.Duration
28 |
29 | > `samplingCount`: number
30 |
31 | Sampling count is the amount of recent ping results which are kept for calculation
32 |
33 | > `timeout`: number
34 |
35 | Ping timeout, int64 values of time.Duration
36 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/policy.md:
--------------------------------------------------------------------------------
1 | # Policy
2 | * Name: `policy`
3 | * Type: Service
4 | * ID: `service.policy`
5 |
6 | ### Policy
7 |
8 | > `system`: [SystemPolicyObject](#systempolicyobject)
9 |
10 | The system level policies that determine the global level policies applied everywhere.
11 |
12 | > `level`: map of [PolicyObject](#policyobject)
13 |
14 | The level based policy.
15 |
16 | ### SystemPolicyObject
17 |
18 | > `stats`: [StatsObject](#statsobject)
19 |
20 | The stats settings.
21 |
22 | ### StatsObject
23 |
24 | > `inboundUplink`: bool
25 |
26 | Whether the upload data count from inbound should be recorded.
27 |
28 | > `inboundDownlink`: bool
29 |
30 | Whether the download data count from inbound should be recorded.
31 |
32 | > `outboundUplink`: bool
33 |
34 | Whether the upload data count from outbound should be recorded.
35 |
36 | > `outboundDownlink`: bool
37 |
38 | Whether the download data count from outbound should be recorded.
39 |
40 |
41 | ### PolicyObject
42 |
43 | > `timeout`: [TimeoutPolicyObject](#timeoutpolicyobject)
44 |
45 | > `stats`: [PolicyStatsObject](#policystatsobject)
46 |
47 | > `buffer`: [BufferPolicyObject](#bufferpolicyobject)
48 |
49 | ### TimeoutPolicyObject
50 |
51 | > `handshake`: [SecondObject](#secondobject)
52 |
53 | > `connectionIdle`: [SecondObject](#secondobject)
54 |
55 | > `uplinkOnly`: [SecondObject](#secondobject)
56 |
57 | > `downlinkOnly`: [SecondObject](#secondobject)
58 |
59 | ### SecondObject
60 |
61 | > `value`: number
62 |
63 | The time in second.
64 |
65 | ### PolicyStatsObject
66 |
67 | > `userUplink`: bool
68 |
69 | Whether the user upload data count should be recorded.
70 |
71 | > `userDownlink`: bool
72 |
73 | Whether the user download data count should be recorded.
74 |
75 | ### BufferPolicyObject
76 |
77 | > `connection`: number
78 |
79 | Buffer size per connection, in bytes. -1 for unlimited buffer.
80 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/stats.md:
--------------------------------------------------------------------------------
1 | # Stats
2 | * Name: `stats`
3 | * Type: Service
4 | * ID: `service.stats`
5 |
6 | The statistics collector maintain counter informations.
7 |
8 | The setting object should be set to an empty object.
9 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/subscription.md:
--------------------------------------------------------------------------------
1 | # Subscription Manager
2 | * Name: `subscription`
3 | * Type: Service
4 | * ID: `service.subscription`
5 |
6 | Subscription Manager automatically refresh server information and turn them into outbounds. (v5.13.0+)
7 |
8 | This service is not yet usable with the jsonv4 configuration format due to [the current code](https://github.com/v2fly/v2ray-core/blob/cc77e90254b57e552bd745727a7bf402bae3aad9/app/subscription/specs/skeleton.go) looking up jsonv5 configuration format settings outside of `"services"` which conflict with the jsonv4 configuration format.
9 |
--------------------------------------------------------------------------------
/docs/en_US/config/service/tun.md:
--------------------------------------------------------------------------------
1 | # Tun
2 | * Name: `tun`
3 | * Type: Service
4 | * ID: `service.tun`
5 |
6 | Tun is an interface that accepts and forwards packet based network traffic, and converts traffic processed by inbounds to streams. (v5.9.0+)
7 |
8 | Look at its [pull request](https://github.com/v2fly/v2ray-core/pull/2541) for working examples of how to configure it.
9 |
10 | Supports Linux operating system on amd64 and arm64.
11 |
12 | ### Tun
13 |
14 | > `name`: string
15 |
16 | The name of the tun interface.
17 |
18 | > `mtu`: number
19 |
20 | The mtu of the tun interface. The recommanded value is 1500.
21 |
22 | > `tag`: string
23 |
24 | The inbound tag associated with tun generated traffic.
25 |
26 | > `ips`: [ [IPObject](#ipobject) ]
27 |
28 | The ip address associated with tun. You will need to add them to tun on the operating system side as well.
29 |
30 | > `routes`: [ [RouteObject](#routeobject) ]
31 |
32 | The routes associated with tun. You will need to add them to tun on the operating system side as well.
33 |
34 | > `enablePromiscuousMode`: bool
35 |
36 | Recommanded to set to true.
37 |
38 | > `enableSpoofing`: bool
39 |
40 | Recommanded to set to true.
41 |
42 | > `packetEncoding`: \["None" | "Packet"\]
43 |
44 | UDP packet encoding method,`None` by default。
45 |
46 | When this value is `None` , UDP connections will be split into streams based on their destination (Address and Port-Dependent Mapping)。
47 |
48 | When this value is `Packet`, UDP connections from a single source connection will be encoded as UDP packet addr connection, which will be restored to its original form by a supported outbound as an Endpoint Independent Mapping UDP connection.
49 | This UDP behaviour is also known as FullCone or NAT1.
50 |
51 | > `sniffingSettings`: [SniffingObject](../inbounds.md/#sniffingobject)
52 |
53 | The sniffing settings for the tun inbound. It allows the connection to be routed based on its content and metadata.(v5.11.0+)
54 |
55 | ### IPObject
56 |
57 | > `ip`: [ number ]
58 |
59 | The IP address in base 10 expression.
60 |
61 | > `prefix`: number
62 |
63 | ### RouteObject
64 |
65 | > `ip`: [ number ]
66 |
67 | > `prefix`: number
68 |
--------------------------------------------------------------------------------
/docs/en_US/config/stats.md:
--------------------------------------------------------------------------------
1 | # Stats
2 |
3 | V2Ray provides statistical information about its operational status.
4 |
5 | ## StatsObject
6 |
7 | `StatsObject` corresponds to the `stats` entry in the configuration file.
8 |
9 | ```json
10 | {
11 | }
12 | ```
13 |
14 | Currently, statistics have no parameters - internal statistics are enabled simply by the presence of the `StatsObject` entry. You also need to enable corresponding items in [Policy](policy.md) to collect specific data.
15 |
16 | The following statistics are currently available:
17 |
18 | ## User Data
19 |
20 | > `user>>>[email]>>>traffic>>>uplink`
21 |
22 | Uplink traffic for a specific user, measured in bytes.
23 |
24 | > `user>>>[email]>>>traffic>>>downlink`
25 |
26 | Downlink traffic for a specific user, measured in bytes.
27 |
28 | :::tip
29 | Statistics will not be enabled for users without a specified Email address.
30 | :::
31 |
32 | ## Global Data
33 |
34 | > `inbound>>>[tag]>>>traffic>>>uplink`
35 |
36 | Uplink traffic for a specific inbound proxy, measured in bytes.
37 |
38 | > `inbound>>>[tag]>>>traffic>>>downlink`
39 |
40 | Downlink traffic for a specific inbound proxy, measured in bytes.
41 |
42 | > `outbound>>>[tag]>>>traffic>>>uplink`
43 |
44 | (V2Ray 4.26.0+) Uplink traffic for a specific outbound proxy, measured in bytes.
45 |
46 | > `outbound>>>[tag]>>>traffic>>>downlink`
47 |
48 | (V2Ray 4.26.0+) Downlink traffic for a specific outbound proxy, measured in bytes.
49 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/domainsocket.md:
--------------------------------------------------------------------------------
1 | # DomainSocket
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/grpc.md:
--------------------------------------------------------------------------------
1 | # gRPC
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/h2.md:
--------------------------------------------------------------------------------
1 | # HTTP/2
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/mkcp.md:
--------------------------------------------------------------------------------
1 | # mKCP
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/quic.md:
--------------------------------------------------------------------------------
1 | # QUIC
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/tcp.md:
--------------------------------------------------------------------------------
1 | # TCP
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/config/transport/websocket.md:
--------------------------------------------------------------------------------
1 | # WebSocket
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/developer/intro/design.md:
--------------------------------------------------------------------------------
1 | # Step 2: Understand the architecture
2 |
3 | This article describes the design ideas of the V2Ray core (v2ray-core).
4 |
5 | ## Objectives
6 |
7 | * The V2Ray kernel provides a platform that supports the necessary network proxy functions, on top of which can be further developed to provide a better user experience;
8 | * Take cross-platform as the primary principle to reduce the cost of secondary development;
9 |
10 | ## Architecture
11 |
12 | 
13 |
14 | The kernel is divided into three layers: application layer, agent layer and transport layer. Each layer contains several modules, which are independent of each other, and modules of the same type can be replaced seamlessly.
15 |
16 | ## Application layer
17 |
18 | The application layer contains some commonly used functions in the proxy layer, which are abstracted out for reuse in different proxy modules. The modules of the application layer should be realized by pure software, and have nothing to do with hardware or platform-related technology.
19 |
20 | List of important modules:
21 |
22 | * Dispatcher: Used to transfer the data received by the inbound agent to the station agent;
23 | * Router: Built-in routing, see [Routing Configuration](../../config/routing.md);
24 | * DNS: built-in DNS cache;
25 | * Proxy Manager: Inbound proxy manager;
26 |
27 | ## Proxy layer
28 |
29 | The proxy layer is divided into two parts: Inbound Proxy and Outbound Proxy. The two parts are independent of each other, the inbound agent does not depend on a specific outbound agent, and vice versa.
30 |
31 | ### Inbound proxy
32 |
33 | * Implement [proxy.Inbound](https://github.com/v2fly/v2ray-core/blob/master/proxy/proxy.go) interface;
34 |
35 | ### Outbound proxy
36 |
37 | * Realize the [proxy.Outbound](https://github.com/v2fly/v2ray-core/blob/master/proxy/proxy.go) interface;
38 |
39 | ## Transport layer
40 |
41 | The transport layer provides some tool modules related to network data transmission.
42 |
--------------------------------------------------------------------------------
/docs/en_US/developer/intro/releasearchive.md:
--------------------------------------------------------------------------------
1 | # Release Archive
2 |
3 | This article describes the design ideas of the V2Ray core (v2ray-core) release archive.
4 |
5 | V2Ray use Github Action to build releases. However, Github Action are usaged based billing product and it is not possible to store logs and artifacts in long term without significant cost.
6 |
7 | We instead upload the logs and artifacts to [archive org](https://archive.org/details/v2ray-action-archive-hqfi0pb) with [AutoV2RayActionArchive](https://github.com/xiaokangwang/AutoV2RayActionArchive). You can find expired logs and artifacts there.
8 |
--------------------------------------------------------------------------------
/docs/en_US/developer/intro/releasesigning.md:
--------------------------------------------------------------------------------
1 | # Release Signing
2 |
3 | This article describes the design ideas of the V2Ray core (v2ray-core) release signing.
4 |
5 | All stable release of V2Ray are signed in [Signify](https://man.openbsd.org/signify) with a the private key corresponding to
6 |
7 | ```
8 | untrusted comment: V2Fly Signing Key
9 | RWTe6SReSmJUeqoA8cq1MxX7ycL06DAMAJcAgQ8dCN3kFtnWBHYDpTnx
10 | ```
11 |
12 | The file being signed is a manifest file named 'Release' with the checksums of all binaries, including unzipped content of zip files.
13 |
14 | ## Binary Transparency
15 |
16 | The signed manifest file is published to [rekor](https://github.com/sigstore/rekor) by signing the sha512 hash of the 'Release' file with a topic key. You can generate a list of all the file signed with [rekor-monitor](https://github.com/sigstore/rekor-monitor) with the following commands:
17 |
18 | ```
19 | echo 'rekor.sigstore.dev - 2605736670972794746\n86482791\nFehZ1/6CqPAFDaEM1N4xOsFZO1rD6v8nmu8yMjUqzAg=\n\n— rekor.sigstore.dev wNI9ajBEAiBTwFlsQciw2QNcGmPqCfPnArWAV9kgEygav9EeVsa+RgIgC0Q4vazfZksnzDkqpv687OTF99KnwtI8fb9a9pUHoOU=\n' > logInfo.txt
20 | verifier -monitored-values "$(echo "ZmluZ2VycHJpbnRzOgogIC0gMzk3YzQ1MTJiZDRjMWIxYWQ4MjIxNTAzNDVkMTczNTUwZjRmNmE0NGJlOTM1MzVmZmVlYzRhZTQyZDg2ZGEzMg=="|base64 -d)" --once
21 | ```
22 |
23 | The topic key is used to generate a list of hash value submitted to rekor by V2Ray. It is not used for verifying release. The topic key design is necessary as rekor does not support signed message, only detached signature.
24 |
--------------------------------------------------------------------------------
/docs/en_US/guide/command.md:
--------------------------------------------------------------------------------
1 | # Command line parameters
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/guide/help.md:
--------------------------------------------------------------------------------
1 | # Ask for help
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/geo.md:
--------------------------------------------------------------------------------
1 | # Geo
2 |
3 | ## GeoIP
4 |
5 | > `cidr` : [CIDRObject](#cidrobject)
6 |
7 | > `inverseMatch` : true | false
8 |
9 | > `code`: string
10 |
11 | > `filePath`: string
12 |
13 | ### CIDRObject
14 |
15 |
16 | > `ipAddr`: string
17 |
18 | > `prefix`: number
19 |
20 | ## GeoDomain
21 |
22 | > `domain` : [DomainObject](#domainobject)
23 |
24 | > `code`: string
25 |
26 | > `filePath`: string
27 |
28 | ### DomainObject
29 |
30 | > `type` : "Plain" | "Regex" | "RootDomain" | "Full"
31 |
32 | > `value`: string
33 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/inbound.md:
--------------------------------------------------------------------------------
1 | # Inbounds
2 | inbound
3 |
4 | ```json
5 | {
6 | "protocol":"vmess",
7 | "settings":{},
8 | "port":"",
9 | "listen":"",
10 | "tag":"",
11 | "sniffing":{},
12 | "streamSettings":{}
13 | }
14 | ```
15 |
16 | > `protocol`: name of ``
17 |
18 | The name of the inbound [proxy](proxy.md) protocol.
19 |
20 | > `settings`: settings of ``
21 |
22 | The settings for the inbound [proxy](proxy.md) protocol.
23 |
24 | > `port`: string
25 |
26 | The listening port for the inbound.
27 |
28 | It can be ``"443"`` or `"20-21"` or `"22,3389"` .
29 |
30 | > `listen`: string
31 |
32 | The listening IP address for the inbound.
33 |
34 | > `tag`: string
35 |
36 | The Tag of the inbound. This is used as an identifier for outbounds.
37 |
38 | > `sniffing`: [SniffingObject](#sniffingobject)
39 |
40 | The sniffing settings for the inbound. It allows the connection to be routed based on its content and metadata.
41 |
42 | > `streamSettings`: [StreamObject](stream.md)
43 |
44 | The stream settings for the inbound. This determine how the protocol data is transferred.
45 |
46 | ## Supported Proxy Protocol
47 |
48 | * [SOCKS](proxy/socks.md)
49 | * [VMess](proxy/vmess.md)
50 | * [VLite](proxy/vlite.md)
51 | * [Shadowsocks](proxy/shadowsocks.md)
52 | * [HTTP](proxy/http.md)
53 | * [Dokodemo](proxy/dokodemo.md)
54 | * [Trojan](proxy/trojan.md)
55 | * [VLESS](proxy/vless.md)
56 |
57 | ## SniffingObject
58 |
59 | > `enabled`: true | false
60 |
61 | Whether to enable traffic detection.
62 |
63 | > `destOverride`: [ string ]
64 |
65 | When traffic is of the specified type, the destination of the current connection will be overridden with the destination included in the traffic.
66 |
67 | The `fakedns+others` setting will prioritize FakeDNS virtual DNS server matching. If the IP address is within the IP address range of the virtual DNS server but no corresponding domain name record is found, the matching results of `http` and `tls` are used. This option is only valid when `metadataOnly` is `false`.
68 |
69 | > `metadataOnly`: true | false
70 |
71 | Whether to use only metadata to detect the destination address without intercepting the traffic content. Only the metadata traffic destination detection module will be activated.
72 |
73 | If using only metadata to detect the destination address is turned off, the client must send data before the proxy server actually establishes a connection. This behavior is incompatible with protocols that require the server to initiate the first message, such as SMTP.
74 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/outbound.md:
--------------------------------------------------------------------------------
1 | # Outbounds
2 | outbound
3 |
4 | Outbound connections are used to send data to remote websites or the next level of proxy server. For available protocols, see the protocol list.
5 |
6 | ```json
7 | {
8 | "protocol":"vmess",
9 | "settings":{},
10 | "sendThrough":"1.2.3.4",
11 | "tag":"demo",
12 | "streamSettings":{},
13 | "proxySettings":{},
14 | "mux":{}
15 | }
16 | ```
17 |
18 | > `protocol`: name of ``
19 |
20 | The name of the outbound protocol.
21 |
22 | > `settings`: settings of ``
23 |
24 | The settings for the outbound protocol.
25 |
26 | > `sendThrough`: string
27 |
28 | The local address for creating connection.
29 |
30 | > `tag`: string
31 |
32 | The Tag of the outbound. This is used as an identifier for outbounds.
33 |
34 | > `streamSettings`: [StreamObject](stream.md)
35 |
36 | The stream settings for the outbound. This determine how the protocol data is transferred.
37 |
38 | > `proxySettings`: [ProxyObject](#proxyobject)
39 |
40 | Forward Proxy(Proxy Chaining) settings.
41 |
42 | > `mux`: [MuxObject](#muxobject)
43 |
44 | Connection multiplexor settings.
45 |
46 | > `domainStrategy`: [ "AsIs" | "UseIP" | "UseIP4" | "UseIP6" | "" ]
47 |
48 | Control whether how domain names in outgoing connection are processed. (v5.12.0+)
49 |
50 | - "AsIs" : Let operating system resolve it.
51 | - "UseIP" : Resolve it with built-in dns, and use any IP address.
52 | - "UseIP4" : Resolve it with built-in dns, and use any IPv4 address.
53 | - "UseIP6" : Resolve it with built-in dns, and use any IPv6 address.
54 |
55 | ## Supported Proxy Protocol
56 |
57 | * [SOCKS](proxy/socks.md)
58 | * [VMess](proxy/vmess.md)
59 | * [VLite](proxy/vlite.md)
60 | * [Shadowsocks](proxy/shadowsocks.md)
61 | * [Shadowsocks2022](proxy/shadowsocks2022.md)
62 | * [Freedom](proxy/freedom.md)
63 | * [Loopback](proxy/loopback.md)
64 | * [Blackhole](proxy/blackhole.md)
65 | * [DNS](proxy/dns.md)
66 | * [Trojan](proxy/trojan.md)
67 | * [HTTP](proxy/http.md)
68 | * [VLESS](proxy/vless.md)
69 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/overview.md:
--------------------------------------------------------------------------------
1 | # Configuration File Format (Draft)
2 |
3 | :::tip
4 | The document for V4 version of the config can be found [here](/en_US/config/overview.md).
5 | :::
6 |
7 | ## Overview
8 |
9 | In the V5 major release, a new configuration schema for users is introduced. This configuration format is designed to replace the previous version of configuration format. Currently this format is in the drafting phase, and may change at any time.
10 |
11 | :::tip
12 | To run your configure file in V5, execute `./v2ray run -c $configure_file_name -format jsonv5`
13 | :::
14 |
15 | ```json
16 | {
17 | "log": {},
18 | "dns": {},
19 | "router": {},
20 | "inbounds": [],
21 | "outbounds": [],
22 | "services": {}
23 | }
24 | ```
25 |
26 | > `log`: [LogObject](#logobject)
27 |
28 | Log collector setting. Specify the settings regarding the recording of events.
29 |
30 | A sensible default will be provided if this entry is not set.
31 |
32 | > `dns`: [DnsObject](dns.md)
33 |
34 | Built-in DNS client. Specify hostname resolution settings.
35 |
36 | Local DNS will be used if this entry is not set.
37 |
38 | > `router`: [RoutingObject](router.md)
39 |
40 | Routing.
41 |
42 | All traffic will be sent to the first outbound if this entry is left empty.
43 |
44 | > `inbounds`: \[ [InboundObject](inbound.md) \]
45 |
46 | Inbounds. Describe the listener for incoming connections.
47 |
48 | > `outbounds`: \[ [OutboundObject](outbound.md) \]
49 |
50 | Outbounds. Describe the configuration for outgoing connections.
51 |
52 | > `services`: \[ [ServiceObject](service.md) \]
53 |
54 | Auxiliary Services. Define additional components.
55 |
56 | These settings configure additional functionalities.
57 | They are not required for the essential functionality of the software. However, these settings enable advanced features that enable complex use cases.
58 |
59 | ## LogObject
60 |
61 | `LogObject` is a json field which the configuration file uses in `log`.
62 |
63 | ```json
64 | {
65 | "access":{},
66 | "error":{}
67 | }
68 | ```
69 |
70 | > `access`: LogSpecObject
71 |
72 | Access log settings.
73 |
74 | > `error`: LogSpecObject
75 |
76 | Error log settings.
77 |
78 | ## LogSpecObject
79 |
80 | > `type`: "None" | "Console" | "File"
81 |
82 | * `"None"`:Log will be discarded.
83 | * `"Console"`:Log will be outputed to standard output.
84 | * `"File"`:Log will be outputed to a file.
85 |
86 | > `path`: string
87 |
88 | File path of log. It should be a valid path string, such as `"/tmp/v2ray/_error.log"` (Linux) or `"C:\\Temp\\v2ray\\_error.log"` (Windows).
89 |
90 | > `level`: "Debug" | "Info" | "Warning" | "Error" | "None"
91 |
92 | Level of log. Default value is `"warning"`。
93 |
94 | * `"Debug"`:Information for developers. All `"Info"` included.
95 | * `"Info"`:Running stats of V2Ray,no effect for the functions. All `"Warning"` included.
96 | * `"Warning"`:V2Ray may have encountered some problem, usually some external problem that does not affect V2Ray but possibly the user experience. All `"Error"` included.
97 | * `"Error"`:V2Ray encountered a problem that needs to be resolved immediately.
98 | * `"None"`:Nothing will be printed.
99 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/protocol/server_spec.md:
--------------------------------------------------------------------------------
1 | ## ServerEndpointObject
2 |
3 | ### Structure
4 |
5 | ```json
6 | {
7 | "address": "",
8 | "port": 0,
9 | "user": []
10 | }
11 | ```
12 |
13 | ### Fields
14 |
15 | > `address`: string
16 |
17 | > `port`: uint32
18 |
19 | > `user`: [[User](user.md#userobject)]
20 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/protocol/user.md:
--------------------------------------------------------------------------------
1 | ## UserObject
2 |
3 | ### Structure
4 |
5 | ```json
6 | {
7 | "level": 0,
8 | "email": "",
9 | "account": {
10 | {
11 | "@type": "v2ray.core.proxy.trojan.Account",
12 | "password": ""
13 | }
14 | }
15 | }
16 | ```
17 |
18 | ### Fields
19 |
20 | > `level`: uint32
21 |
22 | > `email`: string
23 |
24 | > `account`: {}
25 |
26 | User account, see `AccountObject` under each protocol
27 |
28 | - trojan [AccountObject](../proxy/trojan.md#accountobject)
29 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy.md:
--------------------------------------------------------------------------------
1 | # Proxy Protocol
2 |
3 | Proxy protocol determine the way proxied data is encoded.
4 |
5 | * [VMess](proxy/vmess.md)
6 | * [VLite](proxy/vlite.md)
7 | * [Socks](proxy/socks.md)
8 | * [Freedom](proxy/freedom.md)
9 | * [Dokodemo](proxy/dokodemo.md)
10 | * [Blockhole](proxy/blackhole.md)
11 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/blackhole.md:
--------------------------------------------------------------------------------
1 | # Blackhole
2 |
3 | Blackhole (black hole) is an outbound data protocol, which will hinder the outbound of all data. When used with [Router](../router.md), it can achieve the effect of prohibiting access to certain websites.
4 |
5 |
6 | ## Blackhole Outbound
7 | * Name: `blackhole`
8 | * Type: Outbound Protocol
9 | * ID: `outbound.blackhole`
10 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/dns.md:
--------------------------------------------------------------------------------
1 | # DNS
2 |
3 | ## DNS Outbound
4 | * Name: `dns`
5 | * Type: Outbound Protocol
6 | * ID: `outbound.dns`
7 |
8 | DNS is an outbound protocol to intercept and forward DNS queries.
9 | It can only accept DNS traffic(including TCP and UDP based DNS).
10 | Other protocols will not be processed.
11 |
12 | The DNS requests will be sent to built-in [DNS Server](../dns.md) if it is requesting for an IP(A or AAAA),
13 | other queries will not be intercepted and thus send to the origin server as is.
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/dokodemo.md:
--------------------------------------------------------------------------------
1 | # Dokodemo
2 |
3 | Dokodemo door is an inbound data protocol. It can listen to a local port and send all data entering this port to a port of the designated server, so as to achieve the effect of port mapping.
4 |
5 |
6 | ## Dokodemo Inbound
7 | * Name: `blackhole`
8 | * Type: Inbound Protocol
9 | * ID: `inbound.blackhole`
10 |
11 | > `address`: string
12 |
13 | Forward traffic to this address. It can be an IP address, like `"1.2.3.4"`, or a domain name, like `"v2ray.com"`. String type.
14 |
15 | When `followRedirect` (see below) is `true`, `address` can be empty.
16 |
17 | > `port`: number
18 |
19 | Forward traffic to the specified port of the destination address, range \[1, 65535\], numeric type. Required parameters.
20 |
21 | > `networks`: string
22 |
23 | The type of network protocol that can be received. For example, when it is specified as `"tcp"`, any gate will only receive TCP traffic. The default value is `"tcp"`.
24 |
25 | > `followRedirect`: true | false
26 |
27 | When the value is `true`, dokodemo-door will recognize the data forwarded by iptables and forward it to the corresponding destination address.
28 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/freedom.md:
--------------------------------------------------------------------------------
1 | # Freedom
2 |
3 | Freedom is an outbound protocol that can be used to send (normal) TCP or UDP data to any network.
4 |
5 | This protocol will send the traffic to the internet without tunnelling in a proxy protocol. Typically, used for servers to send client traffic to origin servers.
6 |
7 | ## Freedom Outbound
8 | * Name: `freedom`
9 | * Type: Outbound Protocol
10 | * ID: `outbound.freedom`
11 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/http.md:
--------------------------------------------------------------------------------
1 | # HTTP
2 | HTTP Proxy Protocol can be used to exchange proxied traffic with other applications using HTTP protocol.
3 |
4 | ## HTTP Inbound
5 | * Name: `http`
6 | * Type: Inbound Protocol
7 | * ID: `inbound.http`
8 |
9 | :::tip
10 | Although HTTP inbound could be used to provide proxy service to remote users, it does not support encryption or authentication.
11 |
12 | It is designed for providing proxy service to a local device or local network.
13 | :::
14 |
15 | :::warning
16 | If the incoming HTTP proxy connection's HTTP Header's User Agent exists and is empty, that header would be removed. This could allow remote end point discover you are using this program.
17 | :::
18 |
19 | ## HTTP Outbound
20 | * Name: `http`
21 | * Type: Outbound Protocol
22 | * ID: `outbound.http`
23 |
24 | > `address`: string
25 |
26 | The server address. Both IP and domain name is supported.
27 |
28 | > `port`: number
29 |
30 | The server port number.
31 |
32 | > `h1SkipWaitForReply`: bool
33 |
34 | Do not wait for server reply before sending the connection data. (v5.6.0+)
35 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/loopback.md:
--------------------------------------------------------------------------------
1 | # Loopback
2 |
3 | Loopback is an outbound to send traffic back to the router.
4 |
5 | This is often used together with chained proxy support.
6 |
7 | ## Loopback Outbound
8 | * Name: `loopback`
9 | * Type: Outbound Protocol
10 | * ID: `outbound.loopback`
11 |
12 | > `inboundTag`: string
13 |
14 | The inbound tag for loopback traffic.
15 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/shadowsocks.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks
2 |
3 | [Shadowsocks](https://shadowsocks.org) Protocol,mostly compatible with other implementations。
4 |
5 | ## Shadowsocks Inbound
6 | * Name: `shadowsocks`
7 | * Type: Inbound Protocol
8 | * ID: `inbound.shadowsocks`
9 |
10 | > `method` : string
11 |
12 | Encryption method,one of [supported encryption methods](#supported encryption methods) .
13 |
14 | > `password`: string
15 |
16 | A recognized password for this inbound.
17 | Shadowsocks does not mandate the length of the password, but it would be easy to crack a short password,
18 | thus a password of 16 characters or more is recommended.
19 |
20 | > `networks`: "tcp" | "udp" | "tcp,udp"
21 |
22 | Enabled network type.
23 | For example, when `"tcp"` is specified, this inbound will only accept TCP traffic.
24 | This value is `"tcp"` by default.
25 |
26 | > `packetEncoding`: \["None" | "Packet"\]
27 |
28 | UDP packet encoding method,`None` by default。
29 |
30 | When this value is `None` , UDP connections will be split into streams based on their destination (Address and Port-Dependent Mapping)。
31 |
32 | When this value is `Packet`, UDP connections from a single source connection will be encoded as UDP packet addr connection, which will be restored to its original form by a supported outbound as an Endpoint Independent Mapping UDP connection.
33 | This UDP behaviour is also known as FullCone or NAT1.
34 |
35 | ## Shadowsocks Outbound
36 |
37 | * Name: `shadowsocks`
38 | * Type: Outbound Protocol
39 | * ID: `outbound.shadowsocks`
40 |
41 | > `address`: string
42 |
43 | The server address. Both IP and domain name is supported.
44 |
45 | > `port`: number
46 |
47 | The server port number.
48 |
49 | > `method` : string
50 |
51 | Encryption method,one of [supported encryption methods](#supported encryption methods) .
52 |
53 | > `password`: string
54 |
55 | A password recognized by server.
56 |
57 | ## Supported Encryption Methods
58 |
59 | * `"AES_256_GCM"`
60 | * `"AES_128_GCM"`
61 | * `"CHACHA20_POLY1305"`
62 | * `"NONE"`
63 |
64 | ::: warning
65 | In "NONE" unencrypted and unauthenticated mode, the server will not try to validate the password.
66 |
67 | This is typically used when authentication is already completed by the transport layer, like enabling TLS encryption and WebSocket transport with a long and unpredictable path.
68 | :::
69 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/shadowsocks2022.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks2022
2 |
3 | [Shadowsocks2022](https://github.com/Shadowsocks-NET/shadowsocks-specs/) Protocol, mostly compatible with other implementations.
4 |
5 | ::: tip
6 | Only outbound are currently implemented, and does not fully confirm to spec as of v5.12.0 . We are working on making it more align with its spec with future updates.
7 | :::
8 |
9 | ## Shadowsocks2022 Outbound
10 | * Name: `shadowsocks2022`
11 | * Type: Outbound Protocol
12 | * ID: `outbound.shadowsocks2022`
13 |
14 | Shadowsocks2022 outbound. (v5.12.0+)
15 |
16 | > `address` : string
17 |
18 | Server address.
19 |
20 | > 'port': number
21 |
22 | Server port.
23 |
24 | > `method` : string
25 |
26 | - `2022-blake3-aes-128-gcm` 16 bytes key size.
27 | - `2022-blake3-aes-256-gcm` 32 bytes key size.
28 |
29 | > `psk` : string
30 |
31 | Base64 encoded psk, should have exact length as required by method.
32 |
33 | > `ipsk` : [ string ]
34 |
35 | Base64 encoded ipsk ([identity hint](https://github.com/Shadowsocks-NET/shadowsocks-specs/blob/main/2022-2-shadowsocks-2022-extensible-identity-headers.md) psk) array, should have exact length as required by method.
36 |
37 | Example:
38 | ```json
39 | {
40 | "protocol": "shadowsocks2022",
41 | "settings": {
42 | "address": "127.0.0.1",
43 | "port": 20220,
44 | "method": "2022-blake3-aes-128-gcm",
45 | "psk": "oE/s2z9Q8EWORAB8B3UCxw==",
46 | "ipsk": [
47 | "qQln3GlVCZi5iJUObJVNCw=="
48 | ]
49 | }
50 | }
51 | ```
52 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/socks.md:
--------------------------------------------------------------------------------
1 | # Socks
2 | Socks Protocol can be used to exchange proxied traffic with other applications.
3 |
4 |
5 | ## Socks Inbound
6 | * Name: `socks`
7 | * Type: Inbound Protocol
8 | * ID: `inbound.socks`
9 |
10 | > `address` : string
11 |
12 | The server address for the purpose of UDP communication.
13 |
14 | > `udpEnabled`: true | false
15 |
16 | Is UDP support enabled.
17 |
18 | > `packetEncoding`: \["None" | "Packet"\]
19 |
20 | UDP packet encoding method,`None` by default。
21 |
22 | When this value is `None` , UDP connections will be split into streams based on their destination (Address and Port-Dependent Mapping)。
23 |
24 | When this value is `Packet`, UDP connections from a single source connection will be encoded as UDP packet addr connection, which will be restored to its original form by a supported outbound as an Endpoint Independent Mapping UDP connection.
25 | This UDP behaviour is also known as FullCone or NAT1.
26 |
27 | ## Socks Outbound
28 | * Name: `socks`
29 | * Type: Outbound Protocol
30 | * ID: `outbound.socks`
31 |
32 | > `address`: string
33 |
34 | The server address.
35 |
36 | > `port`: number
37 |
38 | The server port.
39 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/trojan.md:
--------------------------------------------------------------------------------
1 | # Trojan
2 |
3 | :::tip
4 | Trojan is designed to operate in correctly configured TLS connections, as it does not provide encryption on its own.
5 | :::
6 |
7 | ## Trojan Inbound (simplified)
8 |
9 | * Name: `trojan`
10 | * Type: Inbound Protocol
11 | * ID: `inbound.trojan`
12 |
13 | ### Structure
14 |
15 | ```json
16 | {
17 | "users": [],
18 | "packetEncoding": "None"
19 | }
20 | ```
21 |
22 | ### Fields
23 |
24 | > `users` : [string]
25 |
26 | A set of recognized password for this inbound.
27 |
28 | > `packetEncoding`: \["None" | "Packet"\]
29 |
30 | UDP packet encoding method,`None` by default。(v5.4.0+)
31 |
32 | When this value is `None` , UDP connections will be split into streams based on their destination (Address and Port-Dependent Mapping)。
33 |
34 | When this value is `Packet`, UDP connections from a single source connection will be encoded as UDP packet addr connection, which will be restored to its original form by a supported outbound as an Endpoint Independent Mapping UDP connection.
35 | This UDP behaviour is also known as FullCone or NAT1.
36 |
37 | ## Trojan Outbound (simplified)
38 |
39 | * Name: `trojan`
40 | * Type: Outbound Protocol
41 | * ID: `outbound.trojan`
42 |
43 | ### Structure
44 |
45 | ```json
46 | {
47 | "address": "",
48 | "port": 0,
49 | "password": ""
50 | }
51 | ```
52 |
53 | ### Fields
54 |
55 | > `address`: string
56 |
57 | The server address. Both IP and domain name is supported.
58 |
59 | > `port`: number
60 |
61 | The server port number.
62 |
63 | > `password`: string
64 |
65 | A password recognized by server.
66 |
67 | ## Trojan Inbound (complete)
68 |
69 | * Name: `#v2ray.core.proxy.trojan.ServerConfig`
70 |
71 | ### Structure
72 |
73 | ```json
74 | {
75 | "users": [],
76 | "packetEncoding": "None",
77 | "fallbacks": []
78 | }
79 | ```
80 |
81 | ### Fields
82 |
83 | > `users`: [[UserObject](../protocol/user.md#user)]
84 |
85 | > `packetEncoding`: \["None" | "Packet"\]
86 |
87 | > `fallbacks`: [[FallbackObject](#fallbackobject)]
88 |
89 | ## Trojan Outbound (complete)
90 |
91 | * Name: `#v2ray.core.proxy.trojan.ClientConfig`
92 |
93 | ### Structure
94 |
95 | ```json
96 | {
97 | "server": []
98 | }
99 | ```
100 |
101 | > `server`: [[ServerEndpoint](../protocol/server_spec.md#serverendpoint)]
102 |
103 | ## AccountObject
104 |
105 | ### Structure
106 |
107 | ```json
108 | {
109 | "@type": "v2ray.core.proxy.trojan.Account",
110 | "password": ""
111 | }
112 | ```
113 |
114 | ### Fields
115 |
116 | > `@type`: "v2ray.core.proxy.trojan.Account"
117 |
118 | > `password`: string
119 |
120 | ## FallbackObject
121 |
122 | ### Structure
123 |
124 | ```json
125 | {
126 | "alpn": "",
127 | "path": "",
128 | "type": "",
129 | "dest": "",
130 | "xver": 0
131 | }
132 | ```
133 |
134 | ### Fields
135 |
136 | > `alpn`: string
137 |
138 | > `path`: string
139 |
140 | > `type`: string
141 |
142 | > `dest`: string
143 |
144 | > `xver`: uint64
145 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/vless.md:
--------------------------------------------------------------------------------
1 | # VLESS
2 |
3 | :::tip
4 | VLESS is designed to operate in correctly configured TLS connections, as it does not provide encryption on its own.
5 | :::
6 |
7 | ::: warning
8 | VLESS is deprecated and subject to removal.
9 |
10 | Please consider using the Trojan protocol as a replacement for new deployments.
11 | :::
12 | ## VLESS Inbound
13 | * Name: `vless`
14 | * Type: Inbound Protocol
15 | * ID: `inbound.vless`
16 |
17 | > `users` : [string]
18 |
19 | A set of recognized uuid for this inbound.
20 |
21 | ## VLESS Outbound
22 | * Name: `vless`
23 | * Type: Outbound Protocol
24 | * ID: `outbound.vless`
25 |
26 | > `address`: string
27 |
28 | The server address. Both IP and domain name is supported.
29 |
30 | > `port`: number
31 |
32 | The server port number.
33 |
34 | > `uuid`: string
35 |
36 | A password recognized by server.
37 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/proxy/vmess.md:
--------------------------------------------------------------------------------
1 | # VMess
2 |
3 | VMess is V2Ray's indigenous proxy protocol. The traffic is obfuscated with encryption to look like random streams.
4 | It is required for the client and server to have an accurate clock to function correctly.
5 |
6 | ## VMess Inbound
7 | * Name: `vmess`
8 | * Type: Inbound Protocol
9 | * ID: `inbound.vmess`
10 |
11 | > `users` : [string]
12 |
13 | The users UUIDs for this inbound. This value is used to derive encryption key.
14 |
15 | ## VMess Outbound
16 | * Name: `vmess`
17 | * Type: Outbound Protocol
18 | * ID: `outbound.vmess`
19 |
20 | > `address`: string
21 |
22 | The server address. Both IP and domain name is supported.
23 |
24 | > `port`: number
25 |
26 | The server port number.
27 |
28 | > `uuid`: string
29 |
30 | The user UUIDs. This value is used to derive encryption key.
31 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/router.md:
--------------------------------------------------------------------------------
1 | # Router
2 | service.router
3 |
4 | ```json
5 | {
6 | "domainStrategy":"AsIs",
7 | "rule":[],
8 | "balancingRule":[]
9 | }
10 | ```
11 |
12 | > `domainStrategy`: `AsIs` | `UseIp` | `IpIfNonMatch` | `IpOnDemand`
13 |
14 | > `rule`: [ [RuleObject](#ruleobject) ]
15 |
16 | > `balancingRule`: [ [BalancingRuleObject](#balancingruleobject) ]
17 |
18 | ## RuleObject
19 |
20 | > `tag`: string
21 |
22 | > `balancingTag`: string
23 |
24 | > `domain`: string
25 |
26 | > `geoip` :
27 |
28 | > `portList`: string
29 |
30 | > `networks`: string
31 |
32 | > `sourceGeoip`
33 |
34 | > `sourcePortList`: [ string ]
35 |
36 | > `userEmail`: [ string ]
37 |
38 | > `inboundTag`: [ string ]
39 |
40 | > `protocol`: [ string ]
41 |
42 | > `domainMatcher`: string
43 |
44 | > `geoDomain` :
45 |
46 | ## BalancingRuleObject
47 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service.md:
--------------------------------------------------------------------------------
1 | # Service
2 |
3 | V2Ray have some built-in services that supplement the primary function of V2Ray.
4 |
5 | * [Browser Forwarder](service/browser.md)
6 | * [Policy](service/policy.md)
7 | * [Stats](service/stats.md)
8 | * [Background Observatory](service/backgroundObservatory.md)
9 | * [Burst Observatory](service/burstObservatory.md)
10 | * [Tun](service/tun.md)
11 | * [Subscription Manager](service/subscription.md)
12 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/backgroundObservatory.md:
--------------------------------------------------------------------------------
1 | # Background Observatory
2 | * Name: `backgroundObservatory`
3 | * Type: Service
4 | * ID: `service.backgroundObservatory`
5 |
6 | > `subjectSelector`: string
7 |
8 | The selectors for outbound under observation
9 |
10 | > `probeUrl`: string
11 |
12 | The URL to send probe request to.
13 |
14 | > `probeInterval`: number
15 |
16 | The time between each probe in second.
17 |
18 | > `persistentProbeResult`: bool
19 |
20 | Whether to store probe result in persistent storage. (v5.27.0+)
21 | This requires persistent storage support.
22 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/browser.md:
--------------------------------------------------------------------------------
1 | # Browser Forwarder
2 | * Name: `browser`
3 | * Type: Service
4 | * ID: `service.browser`
5 |
6 | > `listenAddr`: string
7 |
8 | The listening address for the browser forwarder.
9 |
10 | > `listenPort`: number
11 |
12 | The listening port for the browser forwarder.
13 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/burstObservatory.md:
--------------------------------------------------------------------------------
1 | # Burst Observatory
2 | * Name: `burstObservatory`
3 | * Type: Service
4 | * ID: `service.burstObservatory`
5 |
6 | > `subjectSelector`: string
7 |
8 | The selectors for outbound under observation
9 |
10 | >`pingConfig`: [PingConfigObject](#pingconfigobject)
11 |
12 |
13 | ### PingConfigObject
14 |
15 |
16 |
17 | > `destination`: string
18 |
19 | Ping destination URL. It should return 204 on success.
20 |
21 | > `connectivity`: string
22 |
23 | Connectivity check URL.
24 |
25 | > `interval`: number
26 |
27 | Health check interval, int64 values of time.Duration
28 |
29 | > `samplingCount`: number
30 |
31 | Sampling count is the amount of recent ping results which are kept for calculation
32 |
33 | > `timeout`: number
34 |
35 | Ping timeout, int64 values of time.Duration
36 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/filesystemstorage.md:
--------------------------------------------------------------------------------
1 | # File System Storage
2 | * Name: `filesystemstorage`
3 | * Type: Service
4 | * ID: `service.filesystemstorage`
5 |
6 | File system storage is a persistent storage implementation that stores information using plain files. (v5.27.0+)
7 |
8 | Please ensure that the provided file system supports long file names.
9 |
10 | > `stateStorageRoot`: ["WorkDir"]
11 |
12 | The location to store states. Currently, only `WorkDir` is supported. This is the directory from which v2ray is running.
13 |
14 | > `instanceName`: string
15 |
16 | The name of the current instance. This will become the directory name where the states are stored.
17 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/policy.md:
--------------------------------------------------------------------------------
1 | # Policy
2 | * Name: `policy`
3 | * Type: Service
4 | * ID: `service.policy`
5 |
6 | ### Policy
7 |
8 | > `system`: [SystemPolicyObject](#systempolicyobject)
9 |
10 | The system level policies that determine the global level policies applied everywhere.
11 |
12 | > `level`: map of [PolicyObject](#policyobject)
13 |
14 | The level based policy.
15 |
16 | ### SystemPolicyObject
17 |
18 | > `stats`: [StatsObject](#statsobject)
19 |
20 | The stats settings.
21 |
22 | ### StatsObject
23 |
24 | > `inboundUplink`: bool
25 |
26 | Whether the upload data count from inbound should be recorded.
27 |
28 | > `inboundDownlink`: bool
29 |
30 | Whether the download data count from inbound should be recorded.
31 |
32 | > `outboundUplink`: bool
33 |
34 | Whether the upload data count from outbound should be recorded.
35 |
36 | > `outboundDownlink`: bool
37 |
38 | Whether the download data count from outbound should be recorded.
39 |
40 |
41 | ### PolicyObject
42 |
43 | > `timeout`: [TimeoutPolicyObject](#timeoutpolicyobject)
44 |
45 | > `stats`: [PolicyStatsObject](#policystatsobject)
46 |
47 | > `buffer`: [BufferPolicyObject](#bufferpolicyobject)
48 |
49 | ### TimeoutPolicyObject
50 |
51 | > `handshake`: [SecondObject](#secondobject)
52 |
53 | > `connectionIdle`: [SecondObject](#secondobject)
54 |
55 | > `uplinkOnly`: [SecondObject](#secondobject)
56 |
57 | > `downlinkOnly`: [SecondObject](#secondobject)
58 |
59 | ### SecondObject
60 |
61 | > `value`: number
62 |
63 | The time in second.
64 |
65 | ### PolicyStatsObject
66 |
67 | > `userUplink`: bool
68 |
69 | Whether the user upload data count should be recorded.
70 |
71 | > `userDownlink`: bool
72 |
73 | Whether the user download data count should be recorded.
74 |
75 | ### BufferPolicyObject
76 |
77 | > `connection`: number
78 |
79 | Buffer size per connection, in bytes. -1 for unlimited buffer.
80 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/stats.md:
--------------------------------------------------------------------------------
1 | # Stats
2 | * Name: `stats`
3 | * Type: Service
4 | * ID: `service.stats`
5 |
6 | The statistics collector maintain counter informations.
7 |
8 | The setting object should be set to an empty object.
9 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/service/tun.md:
--------------------------------------------------------------------------------
1 | # Tun
2 | * Name: `tun`
3 | * Type: Service
4 | * ID: `service.tun`
5 |
6 | Tun is an interface that accepts and forwards packet based network traffic, and converts traffic processed by inbounds to streams. (v5.9.0+)
7 |
8 | Look at its [pull request](https://github.com/v2fly/v2ray-core/pull/2541) for working examples of how to configure it.
9 |
10 | Supports Linux operating system on amd64 and arm64.
11 |
12 | ### Tun
13 |
14 | > `name`: string
15 |
16 | The name of the tun interface.
17 |
18 | > `mtu`: number
19 |
20 | The mtu of the tun interface. The recommanded value is 1500.
21 |
22 | > `tag`: string
23 |
24 | The inbound tag associated with tun generated traffic.
25 |
26 | > `ips`: [ [IPObject](#ipobject) ]
27 |
28 | The ip address associated with tun. You will need to add them to tun on the operating system side as well.
29 |
30 | > `routes`: [ [RouteObject](#routeobject) ]
31 |
32 | The routes associated with tun. You will need to add them to tun on the operating system side as well.
33 |
34 | > `enablePromiscuousMode`: bool
35 |
36 | Recommanded to set to true.
37 |
38 | > `enableSpoofing`: bool
39 |
40 | Recommanded to set to true.
41 |
42 | > `packetEncoding`: \["None" | "Packet"\]
43 |
44 | UDP packet encoding method,`None` by default。
45 |
46 | When this value is `None` , UDP connections will be split into streams based on their destination (Address and Port-Dependent Mapping)。
47 |
48 | When this value is `Packet`, UDP connections from a single source connection will be encoded as UDP packet addr connection, which will be restored to its original form by a supported outbound as an Endpoint Independent Mapping UDP connection.
49 | This UDP behaviour is also known as FullCone or NAT1.
50 |
51 | > `sniffingSettings`: [SniffingObject](../inbound.md#sniffingobject)
52 |
53 | The sniffing settings for the tun inbound. It allows the connection to be routed based on its content and metadata.(v5.11.0+)
54 |
55 | ### IPObject
56 |
57 | > `ip`: [ number ]
58 |
59 | The IP address in base 10 expression.
60 |
61 | > `prefix`: number
62 |
63 | ### RouteObject
64 |
65 | > `ip`: [ number ]
66 |
67 | > `prefix`: number
68 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/grpc.md:
--------------------------------------------------------------------------------
1 | # gRPC
2 |
3 | gRPC uses HTTP/2 protocol for transmission.
4 |
5 | ## gRPC Stream
6 | grpc.stream
7 |
8 | > `serviceName`: string
9 |
10 | The name of the gRPC service. It is similar to the function of `path` and is used to prevent detection of whether this transport protocol is deployed. It is recommended to use a complex random string.
11 |
12 | According to [the official gRPC specification](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#appendix-a---grpc-for-protobuf), it is not recommended to use characters other than uppercase and lowercase English letters, numbers, underscores, and periods in this field.
13 |
14 | :::tip
15 | If you need to use Nginx, Caddy, or other software for traffic diversion, the diversion path should be set to `/${serviceName}/Tun`.
16 | :::
17 |
18 | ## Credits
19 |
20 | [Qv2ray/gun](https://github.com/Qv2ray/gun)
21 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/httpupgrade.md:
--------------------------------------------------------------------------------
1 | # HTTPUpgrade
2 |
3 | HTTPUpgrade complete a HTTP 1.1 Upgrade request and response before using the connection directly. It is similar to WebSocket in the way it create an direction channel that can be forwarded by many reverse proxies and CDNs, without the need to deal with all the issue around WebSocket Protocol itself. TLS or other security protocol are required for this transport for it function as designed. (v5.10.0+)
4 |
5 | Look at its [pull request](https://github.com/v2fly/v2ray-core/pull/2541) for working examples of how to configure it.
6 |
7 |
8 | ## HTTPUpgrade
9 |
10 | * Name: `httpupgrade`
11 | * Type: Transport Protocol
12 | * ID: `stream.httpupgrade`
13 |
14 | > `path` : string
15 |
16 | > `host` : string
17 |
18 | The host domain name for HTTP request.
19 |
20 | > `maxEarlyData`: number
21 |
22 | The max number of bytes of early data. (v5.24.0)
23 |
24 | > `earlyDataHeaderName`: string
25 |
26 | The header name for WebSocket Early Data. (v5.24.0)
27 |
28 | > 'header': [ [Header](#header) ]
29 |
30 | The header to be sent in HTTP request. (v5.24.0)
31 |
32 | ## Header
33 |
34 | > 'key' : string
35 |
36 | The HTTP header key.
37 |
38 | > 'value' : string
39 |
40 | The HTTP header value.
41 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | The documentation for this page is missing. Please submit a [pull request](https://github.com/v2fly/v2fly-github-io/pulls) or refer to the Chinese documentation.
4 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/kcp.md:
--------------------------------------------------------------------------------
1 | # KCP(mKCP)
2 |
3 | mKCP constructs a TCP like stream tunnel based on a UDP connection.
4 | Please make sure firewall rules have been set up correctly.
5 | mKCP consumes additional traffic to transfer data with less delay
6 | and may consume for traffic than TCP based transport.
7 |
8 | ## mKCP Stream Transport
9 | * Name: `kcp`
10 | * Type: Transport Protocol
11 | * ID: `stream.kcp`
12 |
13 | > `seed`: string
14 |
15 | The encryption seed for traffic obfuscator. Need to be the same on both sides.
16 |
17 | > `mtu`: number
18 |
19 | Maximum transmission unit. This value is typically between `576` - `1460`. It is `1350` by default.
20 |
21 | > `tti`: number
22 |
23 | Transmission time interval in a millisecond.
24 | mKCP will send data at this frequency.
25 | Please choose a value between `10` - `100`.
26 | It is `50` by default.
27 |
28 | > `uplinkCapacity`: number
29 |
30 | Upload bandwidth capacity.
31 | The maximum speed to send data in MB/s.
32 | It is `5` by default.
33 | Beware it is Byte, not Bit.
34 | You can set it to `0` for very low bandwidth.
35 |
36 | > `downlinkCapacity`: number
37 |
38 | Download bandwidth capacity.
39 | The maximum speed to receive data in MB/s.
40 | It is `20` by default.
41 | Beware it is Byte, not Bit.
42 | You can set it to `0` for very low bandwidth.
43 |
44 | :::tip
45 | `uplinkCapacity` and `downlinkCapacity` decide the transfer speed of mKCP.
46 | In the client uplink's case, the client's `uplinkCapacity` determines the speed packets are sent,
47 | and the server side's `downlinkCapacity` determines the speed server receives the traffic.
48 | and the lower one will be the effective one.
49 | It is recommended to set `downlinkCapacity` to a relatively large value,
50 | like 100, and set `uplinkCapacity` to the actual network speed.
51 | If the speed is insufficient, one may increase the value of `uplinkCapacity`
52 | , until 2 times the actual bandwidth.
53 | :::
54 |
55 | > `congestion`: true | false
56 |
57 | Whether congestion control is enabled. It is `false` by default.
58 | This will instruct V2Ray to decrease transfer speed if there is too much packet loss.
59 |
60 | > `readBufferSize`: number
61 |
62 | The read buffer size of a single connection, in MB.
63 | It is `2` by default.
64 |
65 | > `writeBufferSize`: number
66 |
67 | The write buffer size of a single connection, in MB.
68 | It is `2` by default.
69 |
70 | :::tip
71 | `readBufferSize` and `writeBufferSize` determine the memory usage of a connection.
72 | If transfer speed is the priority,
73 | one may set a higher `readBufferSize` and `writeBufferSize`,
74 | to increase transfer speed at the cost of higher memory usage.
75 | If the network speed is less than 20 MB/s, the default value should
76 | sufficient. Otherwise, increase `readBufferSize` and `writeBufferSize`'s
77 | and balance the memory usage and transfer speed manually.
78 | :::
79 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/meek.md:
--------------------------------------------------------------------------------
1 | # Meek
2 |
3 | Meek is a censorship resistent protocol that encode traffic into plain HTTP request/responses. This would allow the traffic to be reflected over significant amount of platforms to migrate the effect of IP blocking. (v5.7.0+)
4 |
5 | This transport have low transfer performance and is only recommended when other transport protocols are not working.
6 |
7 | ## Meek Stream
8 | * Name: `meek`
9 | * Type: Transport Protocol
10 | * ID: `stream.meek`
11 |
12 | > `url`: string
13 |
14 | The url of meek tansport server.
15 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/mekya.md:
--------------------------------------------------------------------------------
1 | # mekya
2 |
3 | Meek is a censorship resistent protocol that encode mkcp traffic into plain HTTP request/responses. This would allow the traffic to be reflected over significant amount of platforms to migrate the effect of IP blocking. (v5.21.0+)
4 |
5 | This transport has improved performance compare to meek as a result of utilizing mkcp protocol instead of sequential transmission.
6 |
7 | Subscription have been enabled for this transport protocol.
8 |
9 | ## mekya Stream Transport
10 | * Name: `mekya`
11 | * Type: Transport Protocol
12 | * ID: `stream.mekya`
13 |
14 | > `kcp`: [KCPSetting](kcp.md)
15 |
16 | The mkcp settings to be applied to this transport.
17 |
18 | > `maxWriteSize`: number
19 |
20 | (Server only)
21 |
22 | The maximum size of a response that will be written to a single response.
23 |
24 | > `maxWriteDurationMs`: number
25 |
26 | (Server only)
27 |
28 | The maximum time in milliseconds that a server will hold a request for write.
29 |
30 | > `maxSimultaneousWriteConnection`: number
31 |
32 | (Server only)
33 |
34 | The maximum amount of in-flight http request a server will hold for write.
35 |
36 | > `packetWritingBuffer`: number
37 |
38 | (Server only)
39 |
40 | The maxium amount of packets that a server will hold awaiting write.
41 |
42 | > `url`: string
43 |
44 | (Client only)
45 |
46 | The url of the server.
47 |
48 | > `maxWriteDelay`: number
49 |
50 | (Client only)
51 |
52 | The maximum amount of time in milliseconds that writes are accumulated for a single request.
53 |
54 | > `maxRequestSize`: number
55 |
56 | (Client only)
57 |
58 | The maximum size of a request that will be written to a single response.
59 |
60 | > `pollingIntervalInitial`: number
61 |
62 | (Client only)
63 |
64 | The initial polling time for response.
65 |
66 | > `h2PoolSize`: number
67 |
68 | (Client only)
69 |
70 | The size of the http2 clients to use for higher concurrency.
71 |
72 | ## mekya Usage Examples
73 |
74 | The configuration examples of mekya based proxy can be found:
75 |
76 | [mekya Client](https://github.com/v2fly/v2ray-core/blob/master/testing/scenarios/config/mekya_client.json)
77 |
78 | [mekya Server](https://github.com/v2fly/v2ray-core/blob/master/testing/scenarios/config/mekya_server.json)
79 |
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/quic.md:
--------------------------------------------------------------------------------
1 | # QUIC
2 |
3 | ## QUIC Stream Transport
4 | * Name: `quic`
5 | * Type: Transport Protocol
6 | * ID: `stream.quic`
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/tcp.md:
--------------------------------------------------------------------------------
1 | # TCP
2 |
3 | ## TCP Stream
4 | * Name: `tcp`
5 | * Type: Transport Protocol
6 | * ID: `stream.tcp`
--------------------------------------------------------------------------------
/docs/en_US/v5/config/stream/websocket.md:
--------------------------------------------------------------------------------
1 | # WebSocket
2 |
3 | ## WebSocket Stream
4 | * Name: `ws`
5 | * Type: Transport Protocol
6 | * ID: `stream.ws`
7 |
8 | > `path`: string
9 |
10 | The HTTP path for the websocket request. Empty value means root(/).
11 |
12 | > `maxEarlyData`: number
13 |
14 | The max number of bytes of early data.
15 |
16 | > `useBrowserForwarding`: true | false
17 |
18 | Whether to enable browser forwarder.
19 |
20 | > `earlyDataHeaderName`: string
21 |
22 | The header name for WebSocket Early Data. If not set, the early data will be send through path.
23 |
24 | > 'header': [ [Header](#header) ]
25 |
26 | The header to be sent in HTTP request.
27 |
28 | ## Header
29 |
30 | > 'key' : string
31 |
32 | The HTTP header key.
33 |
34 | > 'value' : string
35 |
36 | The HTTP header value.
--------------------------------------------------------------------------------
/docs/guide/command.md:
--------------------------------------------------------------------------------
1 | # 命令行参数
2 |
3 | ## V2Ray
4 |
5 | V2Ray 的程序文件的命令行参数如下:
6 |
7 | ```bash
8 | v2ray [-version] [-test] [-config=config.json] [-format=json]
9 | ```
10 |
11 | > `-version`
12 |
13 | 只输出当前版本然后退出,不运行 V2Ray 主程序。
14 |
15 | > `-test`
16 |
17 | 测试配置文件有效性,如果有问题则输出错误信息,不运行 V2Ray 主程序。
18 |
19 | > `-config`
20 |
21 | 配置文件路径,可选的形式如下:
22 |
23 | * 本地路径,可以是一个绝对路径,或者相对路径。
24 | * `"stdin:"`: 表示将从标准输入读取配置文件内容,调用者必须在输入完毕后关闭标准输入流。
25 | * 以`http://`或`https://`(均为小写)开头: V2Ray 将尝试从这个远程地址加载配置文件。
26 |
27 | > `-format`
28 |
29 | 配置文件格式,可选的值有:
30 |
31 | * `json`: JSON 格式;
32 | * `pb` 或 `protobuf`: Protobuf 格式;
33 |
34 | :::tip
35 | 当`-config`没有指定时,V2Ray 将先后尝试从以下路径加载`config.json`:
36 | * 工作目录(Working Directory)
37 | * [环境变量](../config/env.md)中`v2ray.location.asset`所指定的路径
38 | :::
39 |
40 | ## V2Ctl
41 |
42 | V2Ctl 是一个集合,它有若干个子命令组成。全局的命令行形式如下:
43 |
44 | ```bash
45 | v2ctl
46 | ```
47 |
48 | > `command`
49 |
50 | 子命令,有以下选项:
51 |
52 | * `api`: 调用 V2Ray 进程的远程控制指令。
53 | * `config`: 从标准输入读取 JSON 格式的配置,然后从标准输出打印 Protobuf 格式的配置。
54 | * `cert`: 生成 TLS 证书。
55 | * `fetch`: 抓取远程文件。
56 | * `tlsping`: (V2Ray 4.17+) 尝试进行 TLS 握手。
57 | * `verify`: 验证文件是否由 Project V 官方签名。
58 | * `uuid`: 输出一个随机的 UUID。
59 |
60 | ### V2Ctl Api
61 |
62 | `v2ctl api [--server=127.0.0.1:8080] `
63 |
64 | 调用 V2Ray 进程的远程控制指令。示例:
65 |
66 | `v2ctl api --server=127.0.0.1:8080 LoggerService.RestartLogger ''`
67 |
68 | ### V2Ctl Config
69 |
70 | `v2ctl config`
71 |
72 | 此命令没有参数。它从标准输入读取 JSON 格式的配置,然后从标准输出打印 Protobuf 格式的配置。
73 |
74 | ### V2Ctl Cert
75 |
76 | `v2ctl cert [--ca] [--domain=v2ray.com] [--expire=240h] [--name="V2Ray Inc"] [--org="V2Ray Inc] [--json] [--file=v2ray]`
77 |
78 | 生成一个 TLS 证书。
79 |
80 | > `--ca`
81 |
82 | 如果指定此选项,将会生成一个 CA 证书。
83 |
84 | > `--domain`
85 |
86 | 证书的 Subject Alternative Name(SAN) 项。该参数可以多次使用,来指定多个域名。比如`--domain=v2ray.com --domain=v2ray.cool`。
87 |
88 | > `--expire`
89 |
90 | 证书有效期。格式为 Golang 的[时间长度](https://golang.org/pkg/time/#ParseDuration)。
91 |
92 | > `--name`
93 |
94 | 证书的 Common Name(CN) 项。
95 |
96 | > `--org`
97 |
98 | 证书的 Orgnization 项。
99 |
100 | > `--json`
101 |
102 | 将生成的证书以 V2Ray 支持的 JSON 格式输出到标准输出。默认开启。
103 |
104 | > `--file`
105 |
106 | 将证书以 PEM 格式输出到文件。当指定时,将会生成证书与密钥两个文件。示例:当键入 `--file=a` 时,将生成 `a_cert.pem` 和 `a_key.pem` 两个文件。
107 |
108 | ### V2Ctl Fetch
109 |
110 | `v2ctl fetch `
111 |
112 | 抓取指定的 URL 的内容并输出,只支持 HTTP 和 HTTPS。
113 |
114 | ### V2Ctl TlsPing
115 |
116 | `v2ctl tlsping --ip=[ip]`
117 |
118 | 向指定的域名发起 TLS 握手。
119 |
120 | > domain
121 |
122 | 目标域名
123 |
124 | > --ip
125 |
126 | 此域名的 IP 地址。如果未指定此参数,V2Ctl 将使用系统的 DNS 进行域名解析。
127 |
128 | ### V2Ctl Verify
129 |
130 | `v2ctl verify [--sig=/path/to/sigfile] `
131 |
132 | 此命令用于验证文件是否由 Project V 官方签名。
133 |
134 | > `--sig`
135 |
136 | 签名文件路径,默认值为待验证文件加入'.sig'后缀。
137 |
138 | > `filepath`
139 |
140 | 待验证文件路径。
141 |
142 | ### V2Ctl UUID
143 |
144 | `v2ctl uuid`
145 |
146 | 此命令没有参数。每次运行都会输出一个新的 UUID。
147 |
--------------------------------------------------------------------------------
/docs/guide/faq.md:
--------------------------------------------------------------------------------
1 | # 常见问题
2 |
3 | 奇奇怪怪的问题和答案
4 |
5 | ## 一般问题
6 |
7 | ### 制作 V2Ray 的目的是什么
8 |
9 | 对于已公开的合法信息,人民有自由获取的权利。同时,人民也有言论自由的权利。
10 |
11 | ### 是否反对管制
12 |
13 | 不反对管制。事实上任何事物都需要管制,以减少大众的生活成本,比如奶粉。但监管需要有法可依、有据可循。民众都认可的监管方式也是合理的,可接受的。
14 |
15 | ### Project V 由谁主导开发
16 |
17 | 我们是一群爱好自由的人们。由于政策压力,我们倾向于保持匿名,尽可能地不透露任何身份信息。
18 |
19 | ## V2Ray 使用相关
20 |
21 | ### V2Ray 如何升级
22 |
23 | * 重新下载安装包。
24 | * 如果你使用安装脚本进行安装,重新运行安装脚本即可。
25 |
26 | ### V2Ray 闪退
27 |
28 | * 如果你使用 Linux 并开启了 systemd,可以使用 `journalctl -u v2ray` 查看 V2Ray 退出时的日志。
29 | * 一般情况可以手动运行 `v2ray -config= -test` 来查看错误信息。
30 |
31 | ## V2Ray 错误信息
32 |
33 | ### VMess: Invalid User
34 |
35 | 可能的原因:
36 |
37 | 1. 客户端和服务器端的用户 ID 不匹配。
38 | 1. 客户端和服务器端的用户 alterId 不匹配。
39 | 1. 客户端与服务器的时间不匹配,误差超过 90 秒钟。
40 |
41 | ### Shadowsocks: Unknown address type
42 |
43 | 可能的原因:
44 |
45 | * Shadowsocks 协议的加密方式或是密码不匹配。
46 |
47 | ### Socks: Unknown Socks version: 67
48 |
49 | 可能的原因:
50 |
51 | * 你开启的是 Socks 代理,但在浏览器中配置了 HTTP 代理。
52 |
53 | 解决方案:
54 |
55 | * 在 V2Ray 中配置一个 HTTP 入站代理,然后把浏览器的设置指向这个代理。
56 |
57 | ## 其它软件错误
58 |
59 | ### 访问 Google 时,浏览器中显示证书无效
60 |
61 | 错误信息:攻击者可能试图从 www.google.com 窃取您的信息(例如:密码、通讯内容或信用卡信息)。了解详情 NET::ERR_CERT_COMMON_NAME_INVALID
62 |
63 | 原因:你的 DNS 缓存可能已被污染。
64 |
65 | 解决方案:
66 |
67 | * 需要在使用代理的情况下,清空缓存并重新抓取 DNS 数据。
68 | * 在 V2Ray 中可使用 `sniffing` 功能克服一部分 DNS 污染。
69 |
70 | ## 项目授权
71 |
72 | Project V 使用以下方式进行授权。
73 |
74 | ### V2Ray
75 |
76 | 源代码以官方发布的安装包,使用 MIT 协议授权。包括以下代码仓库中的源代码及安装包:
77 |
78 | * [v2fly/v2ray-core](https://www.github.com/v2fly/v2ray-core/)
79 |
80 | ### 官方网站
81 |
82 | 官方网站([v2fly.org](https://www.v2fly.org/))以 [知识共享署名 4.0 国际许可协议](https://creativecommons.org/licenses/by/4.0/deed.zh) 协议授权。
83 |
84 | * 包括网站中所有可见的文字内容和图片。
85 | * 包括 Project V 图标文件。
86 | * 包括生成网站所使用到的源代码,即 [v2fly/v2fly-github-io](https://github.com/v2fly/v2fly-github-io)。
87 |
88 | ### 软件截图和其它文件
89 |
90 | 第三方所创作的内容,其版权归其创作者所有。Project V 放弃对这些内容的所有权。
91 |
92 | * 包括 Project V 使用过程中的截图。
93 | * 包括运行 Project V 所需的配置文件。
94 | * 包括 Project V 运行时产生的日志文件。
95 |
96 | ### 其它内容
97 |
98 | 未在上述提及的内容,其版权视具体情况而定。
99 |
--------------------------------------------------------------------------------
/docs/guide/start.md:
--------------------------------------------------------------------------------
1 | # 新手上路
2 |
3 | [下载并安装](install.md) 了 V2Ray 之后,你需要对它进行一下配置。为了演示,这里只介绍简单的配置方式,如需配置更复杂的功能,请参考后续的 [配置文档](../config/overview.md)。
4 |
5 | ## 服务器
6 |
7 | 你需要一台防火墙外的服务器,来运行服务器端的 V2Ray。配置如下:
8 |
9 | ```json
10 | {
11 | "inbounds": [
12 | {
13 | "port": 10086, // 服务器监听端口
14 | "protocol": "vmess",
15 | "settings": {
16 | "clients": [
17 | {
18 | "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
19 | }
20 | ]
21 | }
22 | }
23 | ],
24 | "outbounds": [
25 | {
26 | "protocol": "freedom"
27 | }
28 | ]
29 | }
30 | ```
31 |
32 | 服务器的配置中需要确保 `id` 和端口与客户端一致,就可以正常连接了。
33 |
34 | ## 客户端
35 |
36 | 在你的 PC(或手机)中,需要用以下配置运行 V2Ray :
37 |
38 | ```json
39 | {
40 | "inbounds": [
41 | {
42 | "port": 1080, // SOCKS 代理端口,在浏览器中需配置代理并指向这个端口
43 | "listen": "127.0.0.1",
44 | "protocol": "socks",
45 | "settings": {
46 | "udp": true
47 | }
48 | }
49 | ],
50 | "outbounds": [
51 | {
52 | "protocol": "vmess",
53 | "settings": {
54 | "vnext": [
55 | {
56 | "address": "server", // 服务器地址,请修改为你自己的服务器 ip 或域名
57 | "port": 10086, // 服务器端口
58 | "users": [
59 | {
60 | "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
61 | }
62 | ]
63 | }
64 | ]
65 | }
66 | },
67 | {
68 | "protocol": "freedom",
69 | "tag": "direct"
70 | }
71 | ],
72 | "routing": {
73 | "domainStrategy": "IPOnDemand",
74 | "rules": [
75 | {
76 | "type": "field",
77 | "ip": [
78 | "geoip:private"
79 | ],
80 | "outboundTag": "direct"
81 | }
82 | ]
83 | }
84 | }
85 | ```
86 |
87 | 上述配置唯一要更改的地方是你的服务器 IP,配置中已注明。上述配置会把除局域网(比如访问路由器)以外的所有流量转发至你的服务器。
88 |
89 | ## 运行
90 |
91 | * 在 Windows 和 macOS 中,配置文件通常是 V2Ray 同目录下的 `config.json` 文件。直接运行 `v2ray` 或 `v2ray.exe` 即可。
92 | * 在 Linux 中,配置文件通常位于 `/etc/v2ray/` 或 `/usr/local/etc/v2ray/` 目录下。运行 `v2ray run -c /etc/v2ray/config.json`,或使用 systemd 等工具将 V2Ray 作为服务在后台运行。
93 |
94 | > 可以使用 `v2ray help` 查看具体命令。在 `5.*` 版本之前,运行 `v2ray --config=/etc/v2ray/config.json`.
95 |
96 | 更多详细的说明可以参考 [配置文档](../config/overview.md) 和 [新白话文指南](https://guide.v2fly.org/)。
97 |
--------------------------------------------------------------------------------
/docs/guide/workflow.md:
--------------------------------------------------------------------------------
1 | # 工作机制
2 |
3 | ## 单服务器模式
4 |
5 | 与其它的网络代理工具一样,你需要一台配置了 V2Ray 的服务器,然后在自己的设备上安装并配置 V2Ray 客户端,然后即可流畅地访问互联网。
6 |
7 | [](https://mermaid.live/edit#pako:eNqrVkrOT0lVslJKL0osyFDwCbKOyXPUCHDWVNDV01Vw0ng5Y9PzxtVPF83UBEo4gQTtFJw1gPynS6Y93zvx-WqwhKOCLlDcRSPMKCixUj8sIBgk6AIWdIZLu4K1tbXCtCnpKOWmFuUmZqYAra-OyVNQiFEqyUjNTY1RsgIyUxKLsmOUYvJqgepKC1ISS1JdUzJL8ouUrNISc4pTdZQSS0vygyvzkpWsSopKU2GKXDITgV7JhaqqBQCd9lDP)
8 |
9 | 一个 V2Ray 服务器可同时支持多台设备使用不同的代理协议访问。同时,经过合理的配置,V2Ray 可以识别并区分需要代理以及不需要代理的流量,直连的流量不需要绕路。
10 |
11 | ## 桥接模式
12 |
13 | 如果你不想在每一台设备上都配置路由,你也可以设置一台中转服务器,用于接收客户端发来的所有流量,然后在服务器中进行转发判断。
14 |
15 | [](https://mermaid.live/edit#pako:eNqrVkrOT0lVslJKL0osyFDwCbKOyXPUCHDWVNDV07VTcNJ4OWPT88bVTxfN1ATKOEFEnTWA_KdLpj3fO_H5arCEo4IuUNwFLN7WGhYQDBJ0AQu6QhVDBV3Bgs5waTeoHphZSjpKualFuYmZKUBHVcfkKSjEKJVkpOamxihZAZkpiUXZMUoxebVAdaUFKYklqa4pmSX5RUpWaYk5xak6SomlJfnBlXnJSlYlRaWpMEUumYlAD-ZCVdUCAHRbWy4)
16 |
17 | ## 工作原理
18 |
19 | 在配置 V2Ray 之前,不妨先来看一下 V2Ray 的工作原理,以下是单个 V2Ray 进程的内部结构示意图。多个 V2Ray 之间相互独立,互不影响。
20 |
21 | [](https://mermaid.live/edit#pako:eNptkD0LwjAQQP9KuKmFFunHFEFQ4iYO7ZolNtEGTVLSZJDS_25aFUW7Pd49Du4GaAwXgOFiWdeiQ7WmeptFUp-M1zxGabpBJCKy75hrWmHRClXGuxnIsY6nPP_JJ1csuPLfkZl2WRR2PkcfmS_JYkmWXxISUMIqJnk4aqAaIQquFUpQwAE5s1cKVI-h8x1nTuy5dMYCPrNbLxJg3pn6rhvAznrxjohk4UHqVY0PgRNhlQ)
22 |
23 | * 需要配置至少一个入站协议(Inbound)和一个出站协议(Outbound)才可以正常工作。
24 | * 入站协议负责与客户端(如浏览器)通信:
25 | * 入站协议通常可以配置用户认证,如 ID 和密码等;
26 | * 入站协议收到数据之后,会交给分发器(Dispatcher)进行分发;
27 | * 出站协议负责将数据发给服务器,如另一台主机上的 V2Ray。
28 | * 当有多个出站协议时,可以配置路由(Routing)来指定某一类流量由某一个出站协议发出。
29 | * 路由会在必要时查询 DNS 以获取更多信息来进行判断。
30 |
31 | 具体的配置格式详见 [第二章节](../config/overview.md)。
32 |
--------------------------------------------------------------------------------
/docs/v5/config/geo.md:
--------------------------------------------------------------------------------
1 | # Geo
2 |
3 | ## GeoIP
4 |
5 | > `cidr` : \[[CIDRObject](#cidrobject)\]
6 |
7 | 一个数组,数组中每一项是一个 [CIDR](https://zh.wikipedia.org/zh-hans/%E6%97%A0%E7%B1%BB%E5%88%AB%E5%9F%9F%E9%97%B4%E8%B7%AF%E7%94%B1) 地址块
8 |
9 | > `inverseMatch` : true | false
10 |
11 | 反向匹配,当此项为 `true` 时,如果匹配则返回 `false`,否则返回 `true`。
12 |
13 | > `code`: string
14 |
15 | GeoIP 的双字符[国家或地区代码](https://zh.wikipedia.org/wiki/國家地區代碼),支持所有可以上网的国家和地区。
16 |
17 | > `filePath`: string
18 |
19 | GeoIP 文件路径。
20 |
21 | ### CIDRObject
22 |
23 | > `ipAddr`: string
24 |
25 | IP 地址。
26 |
27 | > `prefix`: number
28 |
29 | CIDR 地址前缀。
30 |
31 | ## GeoDomain
32 |
33 | > `domain` : [DomainObject](#domainobject)
34 |
35 | > `code`: string
36 |
37 | GeoDomain 的类别名称(域名列表)。
38 |
39 | > `filePath`: string
40 |
41 | GeoDomain 文件路径。
42 |
43 | ### DomainObject
44 |
45 | > `type` : "Plain" | "Regex" | "RootDomain" | "Full"
46 |
47 | 域名匹配模式,可选值为:
48 |
49 | * **Plain**:纯字符串匹配模式,当匹配目标域名中任意部分时,该规则生效。比如 `sina.com` 可以匹配 `sina.com`、`sina.com.cn`、`sina.company` 和 `www.sina.com`,但不匹配 `sina.cn`。
50 | * **Regex**:正则表达式匹配模式,当正则表达式匹配目标域名时,该规则生效。例如 `\.goo.*\.com$` 匹配 `www.google.com`、`fonts.googleapis.com`,但不匹配 `google.com`。
51 | * **RootDomain**:根域名匹配模式,当域名是目标域名或其子域名时,该规则生效。例如 `v2ray.com` 匹配 `www.v2ray.com`、`v2ray.com`,但不匹配 `xv2ray.com`。
52 | * **Full**:完整匹配模式,当域名完整匹配目标域名时,该规则生效。例如 `v2ray.com` 匹配 `v2ray.com` 但不匹配 `www.v2ray.com`。
53 |
54 | > `value`: string
55 |
56 | 匹配域名的值。
57 |
--------------------------------------------------------------------------------
/docs/v5/config/inbound.md:
--------------------------------------------------------------------------------
1 | # Inbounds
2 |
3 | inbound
4 |
5 | ```json
6 | {
7 | "protocol":"vmess",
8 | "settings":{},
9 | "port":"",
10 | "listen":"",
11 | "tag":"",
12 | "sniffing":{},
13 | "streamSettings":{}
14 | }
15 | ```
16 |
17 | > `protocol`: name of `[inbound]`
18 |
19 | 入站协议名称。
20 |
21 | > `settings`: settings of `[inbound]`
22 |
23 | 入站协议设置。
24 |
25 | > `port`: string
26 |
27 | 接受的格式如下:
28 |
29 | * 整型数值:实际的端口号。
30 | * 字符串:可以是一个数值类型的字符串,如 `"1234"`;或者一个数值范围,如 `"5-10"` 表示端口 5 到端口 10,这 6 个端口。
31 |
32 | > `listen`: string
33 |
34 | 监听地址,只允许 IP 地址,默认值为 `"0.0.0.0"`,表示接收所有网卡上的连接。除此之外,必须指定一个现有网卡的地址。
35 |
36 | v4.32.0+,支持填写 Unix domain socket,格式为绝对路径,形如 `"/dev/shm/domain.socket"`,可在开头加 `"@"` 代表 [abstract](https://www.man7.org/linux/man-pages/man7/unix.7.html),`"@@"` 则代表带 padding 的 abstract。
37 |
38 | 填写 Unix domain socket 时,`port` 将被忽略,协议暂时可选 VLESS、VMess、Trojan,传输方式可选 TCP、WebSocket、HTTP/2。
39 |
40 | 对于常规(非 abstract)Unix domain socket,支持添加访问权限,格式为 `"/dev/shm/domain.socket,0666"`。即在路径后面加上逗号和八进制数(代表权限),权限的设定方式与类 Unix 系统的 `chmod` 命令相同。(v5.9.0+)
41 |
42 | > `tag`: string
43 |
44 | 此入站连接的标识,用于在其它的配置中定位此连接。当其不为空时,其值必须在所有 `tag` 中唯一。
45 |
46 | > `sniffing`: [SniffingObject](#sniffingobject)
47 |
48 | 入站连接的流量探测设置。流量探测允许路由根据连接的内容和元数据转发连接。
49 |
50 | > `streamSettings`: [StreamObject](stream.md)
51 |
52 | 底层传输配置。
53 |
54 | ## 支持的代理协议
55 |
56 | * [SOCKS](proxy/socks.md)
57 | * [VMess](proxy/vmess.md)
58 | * [VLite](proxy/vlite.md)
59 | * [Shadowsocks](proxy/shadowsocks.md)
60 | * [HTTP](proxy/http.md)
61 | * [Dokodemo](proxy/dokodemo.md)
62 | * [Trojan](proxy/trojan.md)
63 | * [VLESS](proxy/vless.md)
64 |
65 | ## SniffingObject
66 |
67 | > `enabled`: true | false
68 |
69 | 是否开启流量探测。
70 |
71 | > `destOverride`: \["http" | "tls" | "quic" | "fakedns" | "fakedns+others"\]
72 |
73 | 当流量为指定类型时,按其中包括的目标地址重置当前连接的目标。
74 |
75 | `fakedns+others` 选项会优先进行 FakeDNS 虚拟 DNS 服务器匹配。如果 IP 地址处于虚拟 DNS 服务器的 IP 地址区间内,但是没有找到相应的域名记录时,使用 `http`、`tls` 的匹配结果。此选项仅在 `metadataOnly` 为 `false` 时有效。
76 |
77 | > `metadataOnly`: true | false
78 |
79 | 是否仅使用元数据推断目标地址而不截取流量内容。只有元数据流量目标侦测模块会被激活。
80 |
81 | 如果关闭仅使用元数据推断目标地址,客户端必须先发送数据,代理服务器才会实际建立连接。此行为与需要服务器首先发起第一个消息的协议如 SMTP 协议不兼容。
82 |
--------------------------------------------------------------------------------
/docs/v5/config/outbound.md:
--------------------------------------------------------------------------------
1 | # Outbounds
2 | outbound
3 |
4 | 出站连接用于向远程网站或下一级代理服务器发送数据,可用的协议请见协议列表。
5 |
6 | ```json
7 | {
8 | "protocol": "vmess",
9 | "settings": {},
10 | "sendThrough": "1.2.3.4",
11 | "tag": "demo",
12 | "streamSettings": {},
13 | "proxySettings": {},
14 | "mux": {
15 | "enabled": false,
16 | "concurrency": 8
17 | }
18 | }
19 | ```
20 |
21 | > `protocol`: name of ``
22 |
23 | 出站协议名称。
24 |
25 | > `settings`: settings of ``
26 |
27 | 出站协议设置。
28 |
29 | > `sendThrough`: string
30 |
31 | 用于发送数据的 IP 地址,当主机有多个 IP 地址时有效,默认值为 `"0.0.0.0"`。
32 |
33 | > `tag`: string
34 |
35 | 此出站连接的标识,用于在其它的配置中定位此连接。当其值不为空时,必须在所有 tag 中唯一。
36 |
37 | > `streamSettings`: [StreamObject](stream.md)
38 |
39 | 底层传输配置。
40 |
41 | > `proxySettings`: [ProxyObject](#proxyobject)
42 |
43 | 出站代理配置。当出站代理生效时。
44 |
45 | > `mux`: [MuxObject](#muxobject)
46 |
47 | Mux 配置。
48 |
49 |
50 | > `domainStrategy`: [ "AsIs" | "UseIP" | "UseIP4" | "UseIP6" | "" ]
51 |
52 | 控制如何如何处理传出连接中的域名. (v5.12.0+)
53 |
54 | - "AsIs" : 让操作系统来解析。
55 | - "UseIP" : 使用内置 dns 解析它,并使用结果中的任意 IP 地址。
56 | - "UseIP4" : 使用内置 dns 解析它,并使用结果中的任意 IPv4 地址。
57 | - "UseIP6" : 使用内置 dns 解析它,并使用结果中的任意 IPv6 地址。
58 |
59 | ## 支持的代理协议
60 |
61 | * [SOCKS](proxy/socks.md)
62 | * [VMess](proxy/vmess.md)
63 | * [VLite](proxy/vlite.md)
64 | * [Shadowsocks](proxy/shadowsocks.md)
65 | * [Shadowsocks2022](proxy/shadowsocks2022.md)
66 | * [Freedom](proxy/freedom.md)
67 | * [Loopback](proxy/loopback.md)
68 | * [Blackhole](proxy/blackhole.md)
69 | * [DNS](proxy/dns.md)
70 | * [Trojan](proxy/trojan.md)
71 | * [VLESS](proxy/vless.md)
72 |
73 | ## ProxyObject
74 |
75 | ```json
76 | {
77 | "tag": "another-outbound-tag",
78 | "transportLayer": false
79 | }
80 | ```
81 |
82 | > `tag`: string
83 |
84 | 当指定另一个出站连接的标识时,此出站连接发出的数据,将被转发至所指定的出站连接发出。
85 |
86 | > `transportLayer`: true | false
87 |
88 | 是否启用传输层转发支持。在启用后,此出站连接的传输层协议将保持生效(如果传输层协议支持)。
89 |
90 | 如果不启用此选项, 在转发时传输层协议将失效,只能使用默认的 TCP 传输协议。
91 |
92 | ## MuxObject
93 |
94 | Mux 功能实现了在一条 TCP 连接上分发多条 TCP 连接的数据。协议细节详见 [Mux.Cool](../../developer/protocols/muxcool.md)。
95 |
96 | ```json
97 | {
98 | "enabled": false,
99 | "concurrency": 8
100 | }
101 | ```
102 |
103 | > `enabled`: true | false
104 |
105 | 是否启用 Mux,默认值为 `false`。
106 |
107 | > `concurrency`: number
108 |
109 | 最大并发连接数。最小值 `1`,最大值 `1024`,默认值 `8`。
110 |
111 | 如果填负数,如 `-1`,则不加载 Mux 模块。
112 |
113 | 此数值表示了一个 TCP 连接上最多承载的 Mux 连接数量。当客户端发出了 8 个 TCP 请求,而 `concurrency=8` 时,V2Ray 只会发出一条实际的连接,客户端的 8 个请求全部由这条连接传输。
114 |
--------------------------------------------------------------------------------
/docs/v5/config/overview.md:
--------------------------------------------------------------------------------
1 | # 配置文件格式
2 |
3 | :::tip
4 | 您可以在 [这里](/config/overview.md) 查看 V4 版本的配置文件文档。
5 | :::
6 |
7 | ## 概述
8 |
9 | 在 V5 版本中,引入了新的配置格式。此配置格式旨在替换过去版本的配置格式。目前此格式仍处于草案阶段,可能会被随时更改。
10 |
11 | :::tip
12 | 执行 `./v2ray run -c $configure_file_name -format jsonv5` 命令以运行您的配置文件。
13 | :::
14 |
15 | ```json
16 | {
17 | "log": {},
18 | "dns": {},
19 | "router": {},
20 | "inbounds": [],
21 | "outbounds": [],
22 | "services": {}
23 | }
24 | ```
25 |
26 | > `log`: [LogObject](#logobject)
27 |
28 | 日志设置,设置 V2Ray 日志记录的
29 |
30 | 若未设置此项,则使用默认值。
31 |
32 | > `dns`: [DnsObject](dns.md)
33 |
34 | 内置的 DNS 客户端,用于设置 DNS 解析。
35 |
36 | 若未设置此项,则默认使用本机的 DNS 设置。
37 |
38 | > `router`: [RoutingObject](router.md)
39 |
40 | 路由功能。
41 |
42 | 若未设置此项,则所有流量都会被转发到第一个出站。
43 |
44 | > `inbounds`: \[ [InboundObject](inbound.md) \]
45 |
46 | 入站设置。
47 |
48 | > `outbounds`: \[ [OutboundObject](outbound.md) \]
49 |
50 | 出站设置。
51 |
52 | > `services`: \[ [ServiceObject](service.md) \]
53 |
54 | 辅助服务,配置附加组件的功能。
55 |
56 | 使用软件的基本功能不需要配置此项,但是可以通过配置此项以使用高级功能。
57 |
58 | ## LogObject
59 |
60 | `LogObject` 是配置文件中 `log` 字段所使用的 JSON 字段。
61 |
62 | ```json
63 | {
64 | "access":{},
65 | "error":{}
66 | }
67 | ```
68 |
69 | > `access`: [LogSpecObject](#logspecobject)
70 |
71 | 访问日志设置。
72 |
73 | > `error`: [LogSpecObject](#logspecobject)
74 |
75 | 错误日志设置。
76 |
77 | ## LogSpecObject
78 |
79 | > `type`: "None" | "Console" | "File"
80 |
81 | * `"None"`:日志将被丢弃。
82 | * `"Console"`:日志将被输出到标准输出。
83 | * `"File"`:日志将被输出到一个文件。
84 |
85 | > `path`: string
86 |
87 | 日志的文件路径,其值是一个合法的文件路径, 例如 `"/tmp/v2ray/_error.log"` (Linux) 或 `"C:\\Temp\\v2ray\\_error.log"` (Windows)。
88 |
89 | > `level`: "Debug" | "Info" | "Warning" | "Error" | "None"
90 |
91 | 日志等级,默认值为 `"Warning"`。
92 |
93 | * `"Debug"`:详细的调试性信息。同时包含所有 `"Info"` 内容
94 | * `"Info"`:V2Ray 在运行时的状态,不影响正常使用。同时包含所有 `"Warning"` 内容。
95 | * `"Warning"`:V2Ray 可能遇到了一些问题,通常是外部问题,不影响 V2Ray 的正常运行,但有可能影响用户的体验。同时包含所有 `"Error"` 内容。
96 | * `"Error"`:V2Ray 遇到了无法正常运行的问题,需要立即解决。
97 | * `"None"`:不记录任何内容。
98 |
--------------------------------------------------------------------------------
/docs/v5/config/protocol/server_spec.md:
--------------------------------------------------------------------------------
1 | ## ServerEndpointObject
2 |
3 | ### Structure
4 |
5 | ```json
6 | {
7 | "address": "",
8 | "port": 0,
9 | "user": []
10 | }
11 | ```
12 |
13 | ### Fields
14 |
15 | > `address`: string
16 |
17 | > `port`: uint32
18 |
19 | > `user`: [[User](user.md#userobject)]
20 |
--------------------------------------------------------------------------------
/docs/v5/config/protocol/user.md:
--------------------------------------------------------------------------------
1 | ## UserObject
2 |
3 | ### 结构
4 |
5 | ```json
6 | {
7 | "level": 0,
8 | "email": "",
9 | "account": {}
10 | }
11 | ```
12 |
13 | ### 字段
14 |
15 | > `level`: uint32
16 |
17 | > `email`: string
18 |
19 | > `account`: {}
20 |
21 | 用户账户,参具体协议对应的AccountObject
22 |
23 | - trojan [AccountObject](../proxy/trojan.md#accountobject)
24 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy.md:
--------------------------------------------------------------------------------
1 | # Proxy 代理协议
2 |
3 | 代理协议定义了代理数据的编码方式。
4 |
5 | * [VMess](proxy/vmess.md)
6 | * [VLESS](proxy/vless.md)
7 | * [VLite](proxy/vlite.md)
8 | * [Trojan](proxy/trojan.md)
9 | * [Shadowsocks](proxy/shadowsocks.md)
10 | * [Socks](proxy/socks.md)
11 | * [HTTP](proxy/http.md)
12 | * [Freedom](proxy/freedom.md)
13 | * [Dokodemo](proxy/dokodemo.md)
14 | * [Blockhole](proxy/blackhole.md)
15 | * [DNS](proxy/dns.md)
16 | * [Loopback](proxy/loopback.md)
17 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/blackhole.md:
--------------------------------------------------------------------------------
1 | # Blackhole
2 |
3 | ## Blackhole 出站
4 | outbound.blackhole
5 |
6 | Blackhole(黑洞)是一个出站数据协议,它会阻碍所有数据的出站,配合路由一起使用,可以达到禁止访问某些网站的效果。
7 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/dns.md:
--------------------------------------------------------------------------------
1 | # DNS
2 |
3 | ## DNS 出站
4 | outbound.dns
5 |
6 | DNS 是一个出站协议,主要用于拦截和转发 DNS 查询。此出站协议只能接收 DNS 流量(包含基于 UDP 和 TCP 协议的查询),其它类型的流量会导致错误。
7 |
8 | 在处理 DNS 查询时,此出站协议会将 IP 查询(即 A 和 AAAA)转发给内置的 [DNS 服务器](../dns.md)。其它类型的查询流量将被转发至它们原本的目标地址。
9 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/dokodemo.md:
--------------------------------------------------------------------------------
1 | # Dokodemo-door
2 |
3 | Dokodemo door(任意门)是一个入站数据协议,它可以监听一个本地端口,并把所有进入此端口的数据发送至指定服务器的一个端口,从而达到端口映射的效果。
4 |
5 | ## Dokodemo-door 入站
6 |
7 | inbound.dokodemo
8 |
9 | > `address`: address
10 |
11 | 将流量转发到此地址。可以是一个 IP 地址,形如 `"1.2.3.4"`,或者一个域名,形如 `"v2ray.com"`。字符串类型。
12 |
13 | 当 `followRedirect`(见下文)为 `true` 时,`address` 可为空。
14 |
15 | > `port`: number
16 |
17 | 将流量转发到目标地址的指定端口,范围 \[1, 65535\],数值类型。必填参数。
18 |
19 | > `networks`: "tcp" | "udp" | "tcp,udp"
20 |
21 | 可接收的网络协议类型。比如当指定为 `"tcp"` 时,任意门仅会接收 TCP 流量。默认值为 `"tcp"`。
22 |
23 | > `followRedirect`: true | false
24 |
25 | 当值为 `true` 时,Dokodemo door 会识别出由 iptables 转发而来的数据,并转发到相应的目标地址。
26 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/freedom.md:
--------------------------------------------------------------------------------
1 | # Freedom
2 |
3 | ## Freedom 出站
4 | outbound.freedom
5 |
6 | Freedom 是一个出站协议,可以用来向任意网络发送(正常的) TCP 或 UDP 数据。
7 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/http.md:
--------------------------------------------------------------------------------
1 | # HTTP
2 |
3 | ## HTTP 入站
4 |
5 | inbound.http
6 |
7 | :::tip
8 | 虽然 HTTP 入站可以用于提供公共服务,但 HTTP 协议没有对传输加密,不适宜在公网中传输。HTTP 入站更有意义的用法是在局域网或本机环境下监听,为其他程序提供本地服务。
9 | :::
10 |
11 | :::warning
12 | HTTP 入站连接的 HTTP 头中 User Agent 存在且为空时,该 HTTP 头会被移除。这可能使您连接的目标服务器知晓您使用了本程序。
13 | :::
14 |
15 | ## HTTP 出站
16 |
17 | outbound.http
18 |
19 | > `address`: string
20 |
21 | 服务器地址。
22 |
23 | > `port`: number
24 |
25 | 服务器端口。
26 |
27 | > `h1SkipWaitForReply`: bool
28 |
29 | 在服务器回复前发送连接数据。 (v5.6.0+)
30 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | ## Hysteria2 入站
4 |
5 | inbound.hysteria2
6 |
7 | 无需配置
8 |
9 | ## Hysteria2 出站
10 |
11 | outbound.hysteria2
12 |
13 | ```json
14 | {
15 | "server": [
16 | {
17 | "address": "127.0.0.1",
18 | "port": 1234
19 | }
20 | ]
21 | }
22 | ```
23 |
24 | > `address`: string
25 |
26 | 服务器地址,支持 IP 地址或者域名。
27 |
28 | > `port`: number
29 |
30 | 服务器端口号。
31 |
32 | ## Hysteria2 兼容
33 |
34 | 若要使用与[官方版](https://hysteria.network/)完全兼容的 Hysteria2,请把传输层也设置成 Hysteria2,并设置密码
35 |
36 | :::tip
37 |
38 | - 配置 TLS 时,可以使用 allowInsecure 和系统根证书,暂不支持自签证书和 PinnedPeerCertificateChainSha256
39 |
40 | - 若不配置 TLS,则默认使用 allowInsecure
41 |
42 | :::
43 |
44 | ## 最佳实践
45 |
46 | - 无需 UDP
47 |
48 | 如果你不需要代理 UDP,那么 `vmess + hysteria2`、`trojan + hysteria2`、`hysteria2 + hysteria2` (代理层+ 传输层)三者的效果是一样的。 `trojan + hysteria2` 的性能可能会更佳。
49 |
50 | - 需 UDP(透明代理、socks5 等)
51 |
52 | 如果你选择搭配 `vmess + hysteria2`、`trojan + hysteria2`,那么就是 UDP over stream。参考 TUIC 的 `quic` udp 模式。
53 |
54 | 代理 TCP 时,效果都是一致的。
55 |
56 | - 无需再使用 grpc、h2、smux 等多路复用
57 |
58 | QUIC 彻头彻尾地解决了多路复用带来的各种小问题,其本身就自带多路复用,无需再多此一举。
59 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/loopback.md:
--------------------------------------------------------------------------------
1 | # Loopback
2 |
3 | Loopback 是一个出站协议,可使出站连接被重新路由。
4 |
5 | ## Loopback 出站
6 |
7 | outbound.loopback
8 |
9 | > `inboundTag`: string
10 |
11 | 匹配入站来源的标识。
12 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/shadowsocks.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks
2 |
3 | [Shadowsocks](https://shadowsocks.org) 协议,兼容大部分其它版本的实现。
4 |
5 | ## Shadowsocks 入站
6 |
7 | inbound.shadowsocks
8 |
9 | > `method` : string
10 |
11 | 加密方式,可选值见[加密方式列表](#加密方式列表)。
12 |
13 | > `password`: string
14 |
15 | 服务器认可的密码。Shadowsocks 协议不限制密码长度,但短密码会更可能被破解,建议使用 16 字符或更长的密码。
16 |
17 | > `networks`: "tcp" | "udp" | "tcp,udp"
18 |
19 | 可接收的网络连接类型,比如当指定为 `"tcp"` 时,Shadowsocks 入站仅会接收 TCP 流量。默认值为 `"tcp"`。
20 |
21 | > `packetEncoding`: \["None" | "Packet"\]
22 |
23 | UDP 包编码方式,默认值为 `None`。
24 | 当该值为 `None` 时,UDP 将根据目标地址被映射 (Address and Port-Dependent Mapping)。
25 | 当该值为 `Packet` 时,UDP 将被端点独立映射 (Endpoint Independent Mapping),此 UDP 行为也被称为 FullCone 或 NAT1。
26 |
27 | ## Shadowsocks 出站
28 |
29 | outbound.shadowsocks
30 |
31 | > `address`: string
32 |
33 | 服务器地址,支持 IP 地址或者域名。
34 |
35 | > `port`: number
36 |
37 | 服务器端口号。
38 |
39 | > `method` : string
40 |
41 | 加密方式,可选值见[加密方式列表](#加密方式列表)。
42 |
43 | > `password`: string
44 |
45 | 服务器认可的密码。Shadowsocks 协议不限制密码长度,但短密码会更可能被破解,建议使用 16 字符或更长的密码。
46 |
47 | ## 加密方式列表
48 |
49 | * `"aes-256-gcm"`
50 | * `"aes-128-gcm"`
51 | * `"chacha20-poly1305"` 或 `"chacha20-ietf-poly1305"`
52 | * `"none"` 或 `"plain"`
53 |
54 | ::: warning
55 | "none" 不加密方式下,服务器端不会验证 "password" 中的密码。一般需要加上 TLS 并在传输层使用安全配置,例如 WebSocket 配置较长的 path
56 | :::
57 | Shadowsocks+aes-256-gcm配置示例,这是一个最简单的配置,不是最佳实践,这个配置可以用于回国,但是切勿用于翻墙!
58 | ```json
59 | {
60 | "log": {
61 | "access": "",
62 | "error": "",
63 | "loglevel": "info"
64 | },
65 | "inbounds": [
66 | {
67 | "port": 443,
68 | "listen": "0.0.0.0",
69 | "protocol": "shadowsocks",
70 | "settings": {
71 | "method": "aes-256-gcm", //这里使用`aes-256-gcm`加密方式,如果你的CPU不带aes加密指令集也可以使用`"chacha20-poly1305"` 或 `"chacha20-ietf-poly1305"`
72 | "password": "ukrxmqlkYTnyyb5sgc8mqiDe5vMoFqRwxefqiigxfdzgigLASE=", //更改这里的密码,让它变得更加复杂
73 | "network": "tcp,udp"
74 | },
75 | "sniffing": {
76 | "enabled": false,//如果需要流量探测,请将其改为`true`
77 | "destOverride": [
78 | "http",
79 | "tls"
80 | ]
81 | }
82 | }
83 | ],
84 | "outbounds": [
85 | {
86 | "protocol": "freedom",
87 | "settings": {}
88 | }
89 | ]
90 | }
91 | ```
92 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/shadowsocks2022.md:
--------------------------------------------------------------------------------
1 | # Shadowsocks2022
2 |
3 | [Shadowsocks2022](https://github.com/Shadowsocks-NET/shadowsocks-specs/) 协议, 与其他实现基本兼容.
4 |
5 | ::: tip
6 | 目前仅实现了出站协议,截至到 v5.12.0 版本为止并未完全拟合协议标准. 我们会在未来的更新中提高协议的协议标准拟合度.
7 | :::
8 |
9 | ## Shadowsocks2022 出站
10 | * 名称: `shadowsocks2022`
11 | * 类型: 出站协议
12 | * ID: `outbound.shadowsocks2022`
13 |
14 | Shadowsocks2022 出站协议. (v5.12.0+)
15 |
16 | > `address` : string
17 |
18 | 服务器地址.
19 |
20 | > 'port': number
21 |
22 | 服务器端口号.
23 |
24 | > `method` : string
25 |
26 | 协议加密方式。
27 |
28 | - `2022-blake3-aes-128-gcm` 16 字节密钥.
29 | - `2022-blake3-aes-256-gcm` 32 字节密钥.
30 |
31 | > `psk` : string
32 |
33 | Base64 编码的预共享密钥,其长度必须符合加密方式的要求.
34 |
35 | > `ipsk` : [ string ]
36 |
37 | Base64 编码的用户 ([身份提示](https://github.com/Shadowsocks-NET/shadowsocks-specs/blob/main/2022-2-shadowsocks-2022-extensible-identity-headers.md) psk) 密钥数组 , 其长度必须符合加密方式的要求.
38 |
39 | 示例:
40 | ```json
41 | {
42 | "protocol": "shadowsocks2022",
43 | "settings": {
44 | "address": "127.0.0.1",
45 | "port": 20220,
46 | "method": "2022-blake3-aes-128-gcm",
47 | "psk": "oE/s2z9Q8EWORAB8B3UCxw==",
48 | "ipsk": [
49 | "qQln3GlVCZi5iJUObJVNCw=="
50 | ]
51 | }
52 | }
53 | ```
54 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/socks.md:
--------------------------------------------------------------------------------
1 | # Socks
2 |
3 | 标准 Socks 协议实现。
4 |
5 | :::warning
6 | 如果你将 Socks5 代理在不安全的网络环境中分享给其他人使用,建议搭配防火墙使用。
7 |
8 | Rfc: [SOCKS 5 的认证在使用 UDP 时可被绕过](https://github.com/v2fly/v2fly-github-io/issues/104)
9 | :::
10 |
11 | ## Socks 入站
12 |
13 | inbound.socks
14 |
15 | > `address` : string
16 |
17 | SOCKS5 通过 UDP ASSOCIATE 命令建立 UDP 会话。服务端在对客户端发来的该命令的回复中,指定客户端发包的目标地址。默认值为空。
18 |
19 | 若此项为空,对于通过本地回环 IPv4/IPv6 连接的客户端,回复对应的回环 IPv4/IPv6 地址;对于非本机的客户端,回复当前入站的监听地址。
20 |
21 | 你可以通过配置此项使 V2Ray 固定回复你配置的地址。如果你不知道此项的作用,留空即可。
22 |
23 | > `udpEnabled`: true | false
24 |
25 | 是否开启 UDP 协议的支持。默认值为 `false`。
26 |
27 | > `packetEncoding`: \["None" | "Packet"\]
28 |
29 | UDP 包编码方式,默认值为 `None`。
30 | 当该值为 `None` 时,UDP 将根据目标地址被映射 (Address and Port-Dependent Mapping)。
31 | 当该值为 `Packet` 时,UDP 将被端点独立映射 (Endpoint Independent Mapping),此 UDP 行为也被称为 FullCone 或 NAT1。
32 |
33 | ## Socks 出站
34 |
35 | outbound.socks
36 |
37 | > `address`: string
38 |
39 | 服务器地址。
40 |
41 | :::tip
42 | 仅支持连接到 Socks 5 服务器。
43 | :::
44 |
45 | > `port`: number
46 |
47 | 服务器端口。
48 |
49 | 如果出现 `Unknown socks version: 72` 说明目标socks5服务器实现有误
50 | https://github.com/v2fly/v2ray-core/pull/2933
51 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/trojan.md:
--------------------------------------------------------------------------------
1 | # Trojan
2 |
3 | :::tip
4 | Trojan 被设计工作在正确配置的加密 TLS 隧道中。
5 | :::
6 |
7 | ## Trojan 入站 (简化版)
8 |
9 | * 协议名称: `trojan`
10 |
11 | ### 结构
12 |
13 | ```json
14 | {
15 | "users": [],
16 | "packetEncoding": "None"
17 | }
18 | ```
19 |
20 | ### 字段
21 |
22 | > `users` : [string]
23 |
24 | 一组服务器认可用户的密码。
25 |
26 | > `packetEncoding`: \["None" | "Packet"\]
27 |
28 | UDP 包编码方式,默认值为 `None`。(v5.4.0+)
29 | 当该值为 `None` 时,UDP 将根据目标地址被映射 (Address and Port-Dependent Mapping)。
30 | 当该值为 `Packet` 时,UDP 将被端点独立映射 (Endpoint Independent Mapping),此 UDP 行为也被称为 FullCone 或 NAT1。
31 |
32 | ## Trojan 出站 (简化版)
33 |
34 | * 协议名称: `trojan`
35 |
36 | ### 结构
37 |
38 | ```json
39 | {
40 | "address": "",
41 | "port": 0,
42 | "password": ""
43 | }
44 | ```
45 |
46 | ### 字段
47 |
48 | > `address`: string
49 |
50 | 服务器地址,支持 IP 地址或者域名。
51 |
52 | > `port`: number
53 |
54 | 服务器端口号。
55 |
56 | > `password`: string
57 |
58 | 服务器认可的 Trojan 用户的密码。
59 |
60 | ## Trojan 入站 (完整版)
61 |
62 | * 协议名称: `#v2ray.core.proxy.trojan.ServerConfig`
63 |
64 | ### 结构
65 |
66 | ```json
67 | {
68 | "server": []
69 | }
70 | ```
71 |
72 | ### 字段
73 |
74 | > `users`: [[UserObject](../protocol/user.md#userobject)]
75 |
76 | > `packetEncoding`: \["None" | "Packet"\]
77 |
78 | > `fallbacks`: [[FallbackObject](#fallbackobject)]
79 |
80 | ## Trojan 出站 (完整版)
81 |
82 | * 协议名称: `#v2ray.core.proxy.trojan.ClientConfig`
83 |
84 | > `server`: [[ServerEndpointObject](../protocol/server_spec.md#serverendpointobject)]
85 |
86 | ## AccountObject
87 |
88 | ### 结构
89 |
90 | ```json
91 | {
92 | "@type": "v2ray.core.proxy.trojan.Account",
93 | "password": ""
94 | }
95 | ```
96 |
97 | ### 字段
98 |
99 | > `@type`: "v2ray.core.proxy.trojan.Account"
100 |
101 | > `password`: string
102 |
103 | ## FallbackObject
104 |
105 | ### 结构
106 |
107 | ```json
108 | {
109 | "alpn": "",
110 | "path": "",
111 | "type": "",
112 | "dest": "",
113 | "xver": 0
114 | }
115 | ```
116 |
117 | ### 字段
118 |
119 | > `alpn`: string
120 |
121 | > `path`: string
122 |
123 | > `type`: string
124 |
125 | > `dest`: string
126 |
127 | > `xver`: uint64
128 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/vless.md:
--------------------------------------------------------------------------------
1 | # VLESS
2 |
3 | VLESS 是一个无状态的轻量传输协议,它分为入站和出站两部分,可以作为 V2Ray 客户端和服务器之间的桥梁。
4 |
5 | :::tip
6 | VLESS 没有自带加密,请用于可靠信道,如 TLS。
7 | :::
8 |
9 |
10 | :::warning
11 | VLESS 已被弃用并且可能被移除。
12 |
13 | 请考虑使用 Trojan 作为替代品。
14 | :::
15 |
16 | ## VLESS 入站
17 |
18 | inbound.vless
19 |
20 | > `users` : [string]
21 |
22 | 一组服务器认可用户的 ID,必须为合法的 UUID。
23 |
24 | ## VLESS 出站
25 |
26 | outbound.vless
27 |
28 | > `address`: string
29 |
30 | 服务器地址,支持 IP 地址或者域名。
31 |
32 | > `port`: number
33 |
34 | 服务器端口号。
35 |
36 | > `uuid`: string
37 |
38 | 服务器认可的 VLESS 用户 ID,必须为合法的 UUID。
39 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/vlite.md:
--------------------------------------------------------------------------------
1 | # VLite
2 |
3 | VLite 是一个数据包 加速,保护,稳定,转发 协议。
4 |
5 | 它为基于 UDP 的流量而设计,并有针对对等式网络 (P2P) 的应用优化。其不支持转发基于TCP的流量。
6 |
7 | :::tip
8 | 使用路由功能仅将 UDP Packet Addr 流量转发至 VLite。下方是示例配置:
9 | ```
10 | "router": {
11 | "domainStrategy": "AsIs",
12 | "rule": [
13 | {
14 | "tag": "vlite",
15 | "domain": [
16 | {
17 | "type":"RootDomain",
18 | "value": "packet-addr.v2fly.arpa"
19 | }
20 | ]
21 | }
22 | ]
23 | }
24 | ```
25 | :::
26 |
27 | ## VLite UDP 出站协议
28 | * 名称: `vliteu`
29 | * 类型: 出站协议
30 | * 标识符: `outbound.vliteu`
31 |
32 | > `address`: string
33 |
34 | 服务器地址,支持 IP 地址或者域名。
35 |
36 | > `port`: number
37 |
38 | 服务器端口号。
39 |
40 | > `password`: string
41 |
42 | 服务器认可的密码。 此项必须与服务器端一致。
43 |
44 | > `scramblePacket`: true | false
45 |
46 | 是否启用数据包混淆。 此项必须与服务器端一致。
47 |
48 | 启用后将隐藏数据包的 DTLS 特征,使握手后的数据包内容类似随机数据。
49 |
50 | > `enableFec`: true | false
51 |
52 | 是否启用前向错误修复 此项必须与服务器端一致。
53 |
54 | 启用后将耗费更多流量以对抗丢包。
55 |
56 | > `enableStabilization`: true | false
57 |
58 | 是否启用通用连接稳定机制。 此项必须与服务器端一致。
59 |
60 | 启用后将通过连接转世机制在连接中断后自动重连并恢复连接状态以主动稳定连接。
61 |
62 | > `enableRenegotiation`: true | false
63 |
64 | 是否启用通用连接稳定重协议协商机制。 此项必须与服务器端一致。
65 |
66 | 启用后将尝试重新协商协议以提高稳定性。
67 |
68 | > `handshakeMaskingPaddingSize`: number
69 |
70 | 是否混淆通用连接稳定握手消息。 此项建议与服务器端一致。
71 |
72 | 此处填入握手数据包填充至的长度。
73 |
74 | ## VLite UDP 入站协议
75 | * 名称: `vliteu`
76 | * 类型: 入站协议
77 | * 标识符: `inbound.vliteu`
78 |
79 |
80 | > `password`: string
81 |
82 | 服务器所认可的密码。 此项必须与客户端一致。
83 |
84 | > `scramblePacket`: true | false
85 |
86 | 是否启用数据包混淆。 此项必须与客户端一致。
87 |
88 | 启用后将隐藏数据包的 DTLS 特征,使握手后的数据包内容类似随机数据。
89 |
90 | > `enableFec`: true | false
91 |
92 | 是否启用前向错误修复 此项必须与客户端一致。
93 |
94 | 启用后将耗费更多流量以对抗丢包。
95 |
96 | > `enableStabilization`: true | false
97 |
98 | 是否启用通用连接稳定机制。 此项必须与客户端一致。
99 |
100 | 启用后将通过连接转世机制在连接中断后自动重连并恢复连接状态以主动稳定连接。
101 |
102 | > `enableRenegotiation`: true | false
103 |
104 | 是否启用通用连接稳定重协议协商机制。 此项必须与客户端一致。
105 |
106 | 启用后将尝试重新协商协议以提高稳定性。
107 |
108 | > `handshakeMaskingPaddingSize`: number
109 |
110 | 是否混淆通用连接稳定握手消息。 此项必须与客户端一致。
111 |
112 | 此处填入握手数据包填充至的长度。
113 |
--------------------------------------------------------------------------------
/docs/v5/config/proxy/vmess.md:
--------------------------------------------------------------------------------
1 | # VMess
2 |
3 | [VMess](../../../developer/protocols/vmess.md) 是一个加密传输协议,它分为入站和出站两部分,通常作为 V2Ray 客户端和服务器之间的桥梁。
4 |
5 | VMess 依赖于系统时间,请确保使用 V2Ray 的系统 UTC 时间误差在 90 秒之内,时区无关。在 Linux 系统中可以安装`ntp`服务来自动同步系统时间。
6 |
7 | ## VMess 入站
8 |
9 | inbound.vmess
10 |
11 | > `users` : [string]
12 |
13 | 一组服务器认可用户的 ID,必须为合法的 UUID。
14 |
15 | ## VMess 出站
16 |
17 | outbound.vmess
18 |
19 | > `address`: string
20 |
21 | 服务器地址,支持 IP 地址或者域名。
22 |
23 | > `port`: number
24 |
25 | 服务器端口号。
26 |
27 | > `uuid`: string
28 |
29 | 服务器认可的 VMess 用户 ID,必须为合法的 UUID。
30 |
31 | #### 服务器示例配置:
32 |
33 | 此配置为vmess+ws+tls实践配置,此配置推荐用于直连服务器:
34 | ```json
35 | {
36 | "log": {
37 | "loglevel": "info"
38 | },
39 | "inbounds": [
40 | {
41 | "port": 443, //这里建议用443(HTTPS标准端口,虽然现在所有的实践表明端口号和被封禁频率没有关系,但是设置为443可以加强伪装)
42 | "protocol": "vmess",
43 | "settings": {
44 | "clients": [
45 | {
46 | "id": "6225d026-dfda-4bcc-a5f5-07cd22fc0c8f",
47 | "alterId": 0, //设置为0以开启AEAD
48 | "security": "auto"
49 | }
50 | ]
51 | },
52 | "streamSettings": {
53 | "network": "ws",
54 | "wsSettings": {
55 | "path": "/guojixinwen" //加入TLS后,这个path用于认证,请设置不易被猜测的路径
56 | },
57 | "security": "tls",
58 | "tlsSettings": {
59 | "certificates": [
60 | {
61 | "certificateFile": "/root/crt.crt", //使用CA或自签名证书
62 | "keyFile": "/root/key.key"
63 | }
64 | ]
65 | }
66 | }
67 | }
68 | ],
69 | "outbounds": [
70 | {
71 | "protocol": "freedom",
72 | "settings": {}
73 | }
74 | ]
75 | }
76 | ```
77 | vmess+httpupgrade配置如下,这个传输层在性能上有一定的提升,适合过CDN:
78 | ```json
79 | {
80 | "log": {
81 | "error": {
82 | "level": "info"
83 | },
84 | "access": {
85 | "type": "None"
86 | }
87 | },
88 | "inbounds": [
89 | {
90 | "protocol": "vmess",
91 | "settings": {
92 | "users": [
93 | "34455e67-fb2f-4fba-9b06-a633937a2263"
94 | ]
95 | },
96 | "port": 80,
97 | "streamSettings": {
98 | "transport": "httpupgrade",
99 | "transportSettings": {
100 | "path": "/download",
101 | "host": "proxy.example.net" //这里请改为你的服务器地址
102 | },
103 | "security": "none"
104 | }
105 | }
106 | ],
107 | "outbounds": [
108 | {
109 | "protocol": "freedom"
110 | }
111 | ]
112 | }
113 | ```
114 |
--------------------------------------------------------------------------------
/docs/v5/config/router.md:
--------------------------------------------------------------------------------
1 | # Router 路由
2 | service.router
3 |
4 | V2Ray 内建了一个路由模块,可以将入站数据按需求由不同的出站连接发出,以达到按需代理的目的。这一功能的常见用法是分流国内外流量。V2Ray 可以通过内部机制判断不同国家或地区的流量,然后将它们发送到不同的出站代理。
5 |
6 | ```json
7 | {
8 | "domainStrategy":"AsIs",
9 | "rule":[],
10 | "balancingRule":[]
11 | }
12 | ```
13 |
14 | > `domainStrategy`: `AsIs` | `UseIp` | `IpIfNonMatch` | `IpOnDemand`
15 |
16 | * `AsIs`:只使用域名进行路由选择,默认值;
17 | * `IpIfNonMatch`:当域名没有匹配任何基于域名的规则时,将域名解析成 IP(A 记录或 AAAA 记录),进行基于 IP 规则的匹配;
18 | * 当一个域名有多个 IP 地址时,会尝试匹配所有的 IP 地址,直到其中一个与某个 IP 规则匹配为止;
19 | * 解析后的 IP 仅在路由选择时起作用,转发的数据包中依然使用原始域名。
20 | * `IpOnDemand`:当匹配时碰到任何基于 IP 的规则,立即将域名解析为 IP 进行匹配。
21 |
22 | > `rule`: [ [RuleObject](#ruleobject) ]
23 |
24 | 对应一个数组,数组中每一项是一个规则。对于每一个连接,路由将根据这些规则依次进行判断,当一个规则生效时,即将这个连接转发至它所指定的 `outboundTag` 或 `balancingTag`。当没有匹配到任何规则时,流量默认被转发至第一个 `outbound`。
25 |
26 | > `balancingRule`: [ [BalancingRuleObject](#balancingruleobject) ]
27 |
28 | 一个数组,数组中每一项是一个负载均衡器的配置。当一个规则指向一个负载均衡器时,V2Ray 会通过此负载均衡器选出一个 `outbound`,然后由它转发流量。
29 |
30 | ## RuleObject
31 |
32 | > `tag`: string
33 |
34 | 对应一个额外 [出站连接配置](outbounds.md) 的标识。
35 |
36 | > `balancingTag`: string
37 |
38 | 对应一个负载均衡器的标识。`balancerTag` 和 `tag` 须二选一。当同时指定时,`tag` 生效。
39 |
40 | > `domain`: \[ [DomainObject](./geo.md#DomainObject) \]
41 |
42 | 当匹配目标域名时,此规则生效。
43 |
44 | > `geoDomain`: \[ [GeoDomain](./geo.md#GeoDomain) \]
45 |
46 | 当匹配目标域名时,此规则生效。
47 |
48 | > `geoip` : \[ [GeoIP](./geo.md#GeoIP) \]
49 |
50 | 当匹配目标 IP 时,此规则生效。
51 |
52 | > `portList`: string
53 |
54 | 目标端口范围,有三种形式:
55 |
56 | * `a-b`:a 和 b 均为正整数,且小于 65536。这个范围是一个前后闭合区间,当端口落在此范围内时,此规则生效。
57 | * `a`:a 为正整数,且小于 65536。当目标端口为 a 时,此规则生效。
58 | * 以上两种形式的混合,以逗号 "," 分隔。形如:`53,443,1000-2000`。
59 |
60 | > `networks`: "tcp" | "udp" | "tcp,udp"
61 |
62 | 可选的值有 "tcp"、"udp" 或 "tcp,udp",当连接方式是指定的方式时,此规则生效。
63 |
64 | > `sourceGeoip`: \[ [GeoIP](./geo.md#GeoIP) \]
65 |
66 | 当匹配来源 IP 时,此规则生效。
67 |
68 | > `sourcePortList`: string
69 |
70 | 来源端口范围,格式与 `portList` 相同。
71 |
72 | > `userEmail`: [ string ]
73 |
74 | 一个数组,数组内每一项是一个邮箱地址。当某一项匹配来源用户时,此规则生效。
75 |
76 | > `inboundTag`: [ string ]
77 |
78 | 一个数组,数组内每一项是一个标识。当某一项匹配入站协议的标识时,此规则生效。
79 |
80 | > `protocol`: \[ "http" | "tls" | "bittorrent" \]
81 |
82 | 一个数组,数组内每一项表示一种协议。当某一个协议匹配当前连接的流量时,此规则生效。必须开启入站代理中的 `sniffing` 选项。
83 |
84 | > `domainMatcher`: "linear" | "mph"
85 |
86 | 选择要使用的域名匹配算法。
87 |
88 | * `linear`:使用线性匹配算法,默认值;
89 | * `mph`:使用最小完美散列(minimal perfect hash)算法。
90 | * 测试数据约 17 万条,匹配速度提升约 30%,内存占用减少约 15%
91 |
92 | > `geoDomain` :
93 |
94 | ## BalancingRuleObject
95 |
96 | 负载均衡器配置。当一个负载均衡器生效时,它会从指定的出站协议中,按配置选出一个最合适的出站协议,进行流量转发。
97 |
98 | ```json
99 | {
100 | "tag": "balancer",
101 | "selector": [],
102 | "strategy": {
103 | "type": "random"
104 | }
105 | }
106 | ```
107 |
108 | > `tag`: string
109 |
110 | 此负载均衡器的标识,用于匹配 `RuleObject` 中的 `balancerTag`。
111 |
112 | > `outboundSelector`: \[ string \]
113 |
114 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"outboundSelector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
115 |
116 | > `strategy`: "random" | "leastping" | "leastload"
117 |
118 | 进行负载均衡的策略类型。
119 |
120 | 可以填入的类型包括 `random` 、`leastping` 以及 `leastload`。
121 |
122 | > strategySettings: [StrategySettingsObject](#strategysettingsobject)
123 |
124 | > fallbackTag: string
125 |
126 | ### StrategySettingsObject
127 |
--------------------------------------------------------------------------------
/docs/v5/config/service.md:
--------------------------------------------------------------------------------
1 | # Service
2 |
3 | V2Ray 内置了一些服务来补充 V2Ray 的主要功能。
4 |
5 | * [浏览器转发模块](service/browser.md)
6 | * [Policy 本地策略](service/policy.md)
7 | * [Stats 统计信息](service/stats.md)
8 | * [后台连接观测](service/backgroundObservatory.md)
9 | * [并发连接观测](service/burstObservatory.md)
10 | * [Tun](service/tun.md)
11 | * [订阅管理器](service/subscription.md)
12 |
--------------------------------------------------------------------------------
/docs/v5/config/service/backgroundObservatory.md:
--------------------------------------------------------------------------------
1 | # 后台连接观测
2 |
3 | 后台连接观测服务通过定时通过指定的出站连接建立连接来确定出站代理的状态。
4 |
5 | > `subjectSelector`: string
6 |
7 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"subjectSelector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
8 |
9 | 被匹配到的出站连接将被定时连接以确定是否可用。
10 |
11 | > `probeUrl`: string
12 |
13 | 用于检测连接状态的网址。默认会使用内构的连接状态检测地址。
14 |
15 | :::tip
16 | 此目标地址的服务器可以推断出您使用了本程序。如果您使用了第三方提供的服务器,该服务器的运营商可能基于此信息作出不利于您的决定,如展示更多验证码,拒绝服务或封禁您的帐号。
17 | :::
18 |
19 | > `probeInterval`: number
20 |
21 | 发起探测的间隔。每经过这个时间,就会对一个服务器进行服务器状态检测。时间格式为数字+单位,比如`"10s"`, `"2h45m"`,支持的时间单位有 `ns`, `us`, `ms`, `s`, `m`, `h`, 分别对应纳秒、微秒、毫秒、秒、分、时。
22 |
23 | > `persistentProbeResult`: bool
24 |
25 | 是否将探测结果存储在持久存储中。(v5.27.0+)
26 | 依赖于持久存储模块。
27 |
--------------------------------------------------------------------------------
/docs/v5/config/service/browser.md:
--------------------------------------------------------------------------------
1 | # 浏览器转发模块
2 | service.browser
3 |
4 | > `listenAddr`: string
5 |
6 | 浏览器转发页面的本地监听地址。
7 |
8 | > `listenPort`: number
9 |
10 | 浏览器转发页面的本地监听端口。
11 |
--------------------------------------------------------------------------------
/docs/v5/config/service/burstObservatory.md:
--------------------------------------------------------------------------------
1 | # 并发连接观测
2 |
3 | 并发连接观测服务。
4 |
5 | > `subjectSelector`: string
6 |
7 | 一个字符串数组,其中每一个字符串将用于和出站协议标识的前缀匹配。在以下几个出站协议标识中:`[ "a", "ab", "c", "ba" ]`,`"subjectSelector": ["a"]` 将匹配到 `[ "a", "ab" ]`。
8 |
9 | >`pingConfig`: [PingConfigObject](#pingconfigobject)
10 |
11 | ### PingConfigObject
12 |
13 | > `destination`: string
14 |
15 | Ping destination URL. It should return 204 on success.
16 |
17 | > `connectivity`: string
18 |
19 | Connectivity check URL.
20 |
21 | > `interval`: number
22 |
23 | 发起健康检查的事件间隔, 时间格式为数字+单位,比如`"10s"`, `"2h45m"`,支持的时间单位有 `ns`, `us`, `ms`, `s`, `m`, `h`, 分别对应纳秒、微秒、毫秒、秒、分、时。
24 |
25 | > `samplingCount`: number
26 |
27 | 保留的最近 Ping 结果的数量。
28 |
29 | > `timeout`: number
30 |
31 | Ping 超时时间, 时间格式为数字+单位,比如`"10s"`, `"2h45m"`。
32 |
--------------------------------------------------------------------------------
/docs/v5/config/service/filesystemstorage.md:
--------------------------------------------------------------------------------
1 | # 文件系统持久存储
2 | * 名称: `filesystemstorage`
3 | * 类型: Service
4 | * ID: `service.filesystemstorage`
5 |
6 | 文件系统存储是一种使用普通文件存储数据的持久存储实现。(v5.27.0+)
7 |
8 | 请确保所使用的文件系统支持长文件名。
9 |
10 | > `stateStorageRoot`: ["WorkDir"]
11 |
12 | 存储位置。目前,仅支持 `WorkDir`。这是 v2ray 运行的目录。
13 |
14 | > `instanceName`: 字符串
15 |
16 | 当前实例的名称。这将成为存储状态的目录名。
17 |
--------------------------------------------------------------------------------
/docs/v5/config/service/policy.md:
--------------------------------------------------------------------------------
1 | # Policy 本地策略
2 |
3 | 本地策略可以配置信息统计、内部缓存大小和一些用户相关的权限。V2Ray 处理的每一个连接都对应一个用户,按照用户的等级(level)应用不同的策略。本地策略可根据等级的不同而变化。
4 |
5 | service.policy
6 |
7 | ## Policy
8 |
9 | > `system`: [SystemPolicyObject](#systempolicyobject)
10 |
11 | V2Ray 全局系统策略。
12 |
13 | > `level`: map{string: [PolicyObject](#policyobject)}
14 |
15 | 一组键值对,每个键是一个字符串形式的数字(JSON 的要求),比如 "0"、"1" 等,双引号不能省略,此数字对应用户等级。每一个值是一个 [PolicyObject](#policyobject)。
16 |
17 | ### SystemPolicyObject
18 |
19 | > `stats`: [StatsObject](#statsobject)
20 |
21 | 统计信息设置。
22 |
23 | ### StatsObject
24 |
25 | > `inboundUplink`: bool
26 |
27 | 当值为 `true` 时,开启所有入站代理的上行流量统计。
28 |
29 | > `inboundDownlink`: bool
30 |
31 | 当值为 `true` 时,开启所有入站代理的下行流量统计。
32 |
33 | > `outboundUplink`: bool
34 |
35 | 当值为 `true` 时,开启所有出站代理的上行流量统计。
36 |
37 | > `outboundDownlink`: bool
38 |
39 | 当值为 `true` 时,开启所有出站代理的下行流量统计。
40 |
41 |
42 | ### PolicyObject
43 |
44 | > `timeout`: [TimeoutPolicyObject](#timeoutpolicyobject)
45 |
46 | 超时策略。
47 |
48 | > `stats`: [PolicyStatsObject](#policystatsobject)
49 |
50 | 统计信息策略。
51 |
52 | > `buffer`: [BufferPolicyObject](#bufferpolicyobject)
53 |
54 | 内部缓存策略。
55 |
56 | ### TimeoutPolicyObject
57 |
58 | > `handshake`: number
59 |
60 | 连接建立时的握手时间限制。单位为秒。默认值为 `4`。在入站代理处理一个新连接时,在握手阶段(比如 VMess 读取头部数据,判断目标服务器地址),如果使用的时间超过这个时间,则中断该连接。
61 |
62 | > `connectionIdle`: number
63 |
64 | 连接空闲的时间限制。单位为秒。默认值为 `300`。在入站出站代理处理一个连接时,如果在 `connIdle` 时间内,没有任何数据被传输(包括上行和下行数据),则中断该连接。
65 |
66 | > `uplinkOnly`: number
67 |
68 | 当连接下行线路关闭后的时间限制。单位为秒。默认值为 `2`。当服务器(如远端网站)关闭下行连接时,出站代理会在等待 `uplinkOnly` 时间后中断连接。
69 |
70 | > `downlinkOnly`: number
71 |
72 | 当连接上行线路关闭后的时间限制。单位为秒。默认值为 `5`。当客户端(如浏览器)关闭上行连接时,入站代理会在等待 `downlinkOnly` 时间后中断连接。
73 |
74 | ### PolicyStatsObject
75 |
76 | > `userUplink`: bool
77 |
78 | 当值为 `true` 时,开启当前等级的所有用户的上行流量统计。
79 |
80 | > `userDownlink`: bool
81 |
82 | 当值为 `true` 时,开启当前等级的所有用户的下行流量统计。
83 |
84 | ### BufferPolicyObject
85 |
86 | > `connection`: number
87 |
88 | 每个连接的内部缓存大小,单位为 Bytes。 当值为 `-1` 时,缓存大小无限。
89 |
--------------------------------------------------------------------------------
/docs/v5/config/service/stats.md:
--------------------------------------------------------------------------------
1 | # Stats 统计信息
2 |
3 | V2Ray 提供了一些关于其运行状况的统计信息。
4 |
5 | ## StatsObject
6 |
7 | `StatsObject` 对应配置文件的 `stats` 项。
8 |
9 | ```json
10 | {}
11 | ```
12 |
13 | 目前统计信息没有任何参数,只要 `StatsObject` 项存在,内部的统计即会开启。同时你还需要在 [Policy](policy.md) 中开启对应的项,才可以统计对应的数据。
14 |
15 | 目前已有的统计信息如下:
16 |
17 | ## 用户数据
18 |
19 | > `user>>>[email]>>>traffic>>>uplink`
20 |
21 | 特定用户的上行流量,单位为字节。
22 |
23 | > `user>>>[email]>>>traffic>>>downlink`
24 |
25 | 特定用户的下行流量,单位为字节。
26 |
27 | :::tip
28 | 如果对应用户没有指定 Email,则不会开启统计。
29 | :::
30 |
31 | ## 全局数据
32 |
33 | > `inbound>>>[tag]>>>traffic>>>uplink`
34 |
35 | 特定入站代理的上行流量,单位为字节。
36 |
37 | > `inbound>>>[tag]>>>traffic>>>downlink`
38 |
39 | 特定入站代理的下行流量,单位为字节。
40 |
41 | > `outbound>>>[tag]>>>traffic>>>uplink`
42 |
43 | 特定出站代理的上行流量,单位为字节。
44 |
45 | > `outbound>>>[tag]>>>traffic>>>downlink`
46 |
47 | 特定出站代理的下行流量,单位为字节。
48 |
--------------------------------------------------------------------------------
/docs/v5/config/service/subscription.md:
--------------------------------------------------------------------------------
1 | # 订阅管理器
2 | * 名称: `subscription`
3 | * 类型: Service
4 | * ID: `service.subscription`
5 |
6 | 订阅管理器自动刷新出站信息并将它们转换为出站实例. (v5.13.0+)
7 |
8 | ## 订阅
9 | > `imports` : [ [SubscriptionImportObject](#subscriptionimportobject) ]
10 |
11 | ## SubscriptionImportObject
12 |
13 | > `name`: string
14 |
15 | 订阅源名称
16 |
17 | > `url`: string
18 |
19 | 订阅源的地址:
20 |
21 | 目前有两种收到支持的发地址
22 | - HTTP(S) 地址 : 通过 HTTP(S) 即 「超文本传输协议」或 「超文本传输安全协议」下载订阅文档。
23 | - DataURL : 链接本身即为订阅文档。文档类型需为 "application/vnd.v2ray.subscription-singular" 才会被接受。
24 |
25 | > `tagPrefix`: string
26 |
27 | 创建的订阅的出站实例前缀。
28 |
29 | > `importUsingTag`: string
30 |
31 | 指定下载订阅文档的出站代理标志。
32 |
33 | > `defaultExpireSeconds`: number
34 |
35 | 默认的订阅过期时间。
36 |
37 | > `persistence`: bool
38 |
39 | 是否启用订阅信息的持久存储。 (v5.28.0+)
40 |
41 | 英语文档中包含更多细节。
42 |
--------------------------------------------------------------------------------
/docs/v5/config/service/tun.md:
--------------------------------------------------------------------------------
1 | # Tun
2 | * 名称 : `tun`
3 | * 类型 : 服务
4 | * ID: `service.tun`
5 |
6 | Tun 是一个接受网络层数据包的服务,输入进入操作系统 tun 接口的数据包会被转换为一般数据流被传出代理处理。 (v5.9.0+)
7 |
8 | 您可以参考 [pull request](https://github.com/v2fly/v2ray-core/pull/2541) 中的示例。
9 |
10 | 目前仅支持 amd64 以及 arm64 架构下的 Linux 操作系统.
11 |
12 | ### Tun
13 |
14 | > `name`: string
15 |
16 | tun 网络适配器的名字。
17 |
18 | > `mtu`: number
19 |
20 | tun 网络适配器的最大传输单元。建议设置为 1500.
21 |
22 | > `tag`: string
23 |
24 | 生成的流量的入站流量标签。
25 |
26 | > `ips`: [ [IPObject](#ipobject) ]
27 |
28 | tun 网络适配器的 IP 地址段。建议设置为私有地址段。
29 |
30 | > `routes`: [ [RouteObject](#routeobject) ]
31 |
32 | tun 网络适配器的路由表。建议设置为 `0.0.0.0/0` 和 `::/0` 以路由所有进入 tun 网络适配器的数据包。
33 |
34 | > `enablePromiscuousMode`: bool
35 |
36 | 是否开启混杂模式。建议设置为 `true`。
37 |
38 | > `enableSpoofing`: bool
39 |
40 | 是否开启 IP 欺骗。建议设置为 `true`。
41 |
42 | > `packetEncoding`: \["None" | "Packet"\]
43 |
44 | UDP 包的编码方式,默认为 `None`。
45 |
46 | > `sniffingSettings`: [SniffingObject](../inbound.md#sniffingobject)
47 |
48 | tun 入站连接的流量探测设置。流量探测允许路由根据连接的内容和元数据转发连接。(v5.11.0+)
49 |
50 | ### IPObject
51 |
52 | > `ip`: [ number ]
53 |
54 | > `prefix`: number
55 |
56 | ### RouteObject
57 |
58 | > `ip`: [ number ]
59 |
60 | > `prefix`: number
61 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/grpc.md:
--------------------------------------------------------------------------------
1 | # gRPC
2 |
3 | gRPC 使用 HTTP/2 协议传输。
4 |
5 | ## gRPC Stream
6 | grpc.stream
7 |
8 | > `serviceName`: string
9 |
10 | gRPC 服务的名称。其作用类似 `path` 的功能,用于防止探测是否部署了本传输协议。建议使用复杂的随机字符串。
11 |
12 | 根据 [gRPC 规范官方](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#appendix-a---grpc-for-protobuf) 规定,此字段不建议使用除英文大小写字母、数字、下划线及英文句号之外的字符组成。
13 |
14 | :::tip
15 | 如需使用 Nginx、Caddy 等软件进行分流,设置的分流路径应为 `/${serviceName}/Tun`。
16 | :::
17 |
18 | ## Credits
19 |
20 | [Qv2ray/gun](https://github.com/Qv2ray/gun)
--------------------------------------------------------------------------------
/docs/v5/config/stream/httpupgrade.md:
--------------------------------------------------------------------------------
1 | # HTTPUpgrade
2 |
3 | HTTPUpgrade 在完成一个 HTTP 1.1 协议迁移握手后直接使用连接传输数据. 它类似于 WebSocket, 但是避免了使用 WebSocket 库所带来的相关开销,并在于此同时保证了流量可以被很多反向代理和 CDN(内容分发网络)转发. 您需要启用 TLS 或其他安全协议来使本协议按预期方式运作。 (v5.10.0+)
4 |
5 | 您可以参考 [pull request](https://github.com/v2fly/v2ray-core/pull/2727) 中的示例。
6 |
7 | ## HTTPUpgrade 流传输协议
8 | * 名称: `httpupgrade`
9 | * 类型: 传输协议
10 | * ID: `stream.httpupgrade`
11 |
12 | > `path` : string
13 |
14 | HTTP 路径。
15 |
16 | > `host` : string
17 |
18 | HTTP 主机域名。
19 |
20 | > `maxEarlyData`: number
21 |
22 | 所要发送的前置数据的最长长度。用于减少连接建立的时间。
23 |
24 | > `earlyDataHeaderName`: string
25 | >
26 | 发送的前置数据的 HTTP 头的名字,设置后启用基于 HTTP 头的前置数据。(v5.24.0)
27 |
28 | > `headers`: [ struct{ key, value string } ]
29 |
30 | 自定义 HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是字符串。默认值为空。(v5.24.0)
31 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/hy2.md:
--------------------------------------------------------------------------------
1 | # Hysteria2
2 |
3 | 魔改 [quic-go](https://github.com/quic-go/quic-go) 拥塞控制的代理协议。
4 |
5 | 1. 得益于 QUIC 的全加密和填充,大大地增加中间防火墙嗅探的负担
6 | 2. 强制要求使用 TLS 1.3
7 | 3. 真正的多路复用,还从根本上解决了 TLS 和多路复用带来的队头阻塞问题
8 |
9 | ## 协议修改说明
10 |
11 | - 在 V2ray 中,Hysteria2 TCP 被分成了两个部分:
12 |
13 | 1. `TLS + HTTP3` 传输层;包含认证、协商、拥塞控制等
14 | 2. `Proxy Header` 代理层;包含解析目标地址、Padding 等
15 |
16 | Hysteria2 可以作为传输层与 Vmess、Shadowsocks、Trojan 搭配使用,也可以兼用官方版。若把 Hysteria2 作为传输层,只能使用其 Stream,也就是说传输 UDP 时就是 UDP Over Stream。
17 |
18 | - Padding 目前为固定长度和内容,不影响实际使用和兼容性
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | ## Hysteria2 Stream
31 |
32 | stream.hysteria
33 |
34 | > `password`: string
35 |
36 | 认证密码,留空为不认证
37 |
38 | > `use_udp_extension`: bool
39 |
40 | 是否启用 UDP,默认不启用
41 |
42 | 使用 QUIC 的 udp extension 功能,解决代理基于 UDP 的可靠传输层协议时会导致队头阻塞;仅 hysteria2 代理协议可用,其他协议不支持。不代理 UDP 时,无需启用。
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | > `congestion`: [CongestionObject](#CongestionObject)
56 |
57 | 拥塞算法配置
58 |
59 | ## CongestionObject
60 |
61 | stream.hysteria2.congestion
62 |
63 | 用于控制本地网络的发包速度。理论上能够充分利用网络带宽,做到效益最大化,即为最佳拥塞算法。不同的拥塞算法会影响 Hysteria2 的性能表现。
64 |
65 | > `type`: string
66 |
67 | 可选:
68 |
69 | - `bbr` 被广泛使用的,推荐在移动网络环境下使用(默认)
70 | - `brutal` 需要正确地设置好本机实际带宽才能生效,推荐在带宽稳定的环境下使用
71 |
72 | > `up_mbps`: int
73 |
74 | 本机的上传速度,单位 Mbit/s
75 |
76 | 选择 `brutal` 时,必填;留空或 0 时转换成 `bbr`
77 |
78 | > `down_mbps`: int
79 |
80 | 本机的下传速度,单位 Mbit/s
81 |
82 | 选择 `brutal` 时,必填;留空或 0 时转换成 `bbr`
83 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/kcp.md:
--------------------------------------------------------------------------------
1 | # mKCP
2 |
3 |
4 | mKCP 使用 UDP 来模拟 TCP 连接,请确定主机上的防火墙配置正确。mKCP 牺牲带宽来降低延迟。传输同样的内容,mKCP 一般比 TCP 消耗更多的流量。
5 |
6 | ## mKCP Stream
7 | stream.kcp
8 |
9 | > `mtu`: number
10 |
11 | 最大传输单元(maximum transmission unit),请选择一个介于 `576` - `1460` 之间的值。默认值为 `1350`。
12 |
13 | > `tti`: number
14 |
15 | 传输时间间隔(transmission time interval),单位毫秒(ms),mKCP 将以这个时间频率发送数据。请选译一个介于 `10` - `100` 之间的值。默认值为 `50`。
16 |
17 | > `uplinkCapacity`: number
18 |
19 | 上行链路容量,即主机发出数据所用的最大带宽,单位 MB/s,默认值 `5`。注意是 Byte 而非 bit。可以设置为 `0`,表示一个非常小的带宽。
20 |
21 | > `downlinkCapacity`: number
22 |
23 | 下行链路容量,即主机接收数据所用的最大带宽,单位 MB/s,默认值 `20`。注意是 Byte 而非 bit。可以设置为 `0`,表示一个非常小的带宽。
24 |
25 | :::tip
26 | `uplinkCapacity` 和 `downlinkCapacity` 决定了 mKCP 的传输速度。以客户端发送数据为例,客户端的 `uplinkCapacity` 指定了发送数据的速度,而服务器端的 `downlinkCapacity` 指定了接收数据的速度。两者的值以较小的一个为准。推荐把 `downlinkCapacity` 设置为一个较大的值,比如 100,而 `uplinkCapacity` 设为实际的网络速度。当速度不够时,可以逐渐增加 `uplinkCapacity` 的值,直到带宽的两倍左右。
27 | :::
28 |
29 | > `congestion`: true | false
30 |
31 | 是否启用拥塞控制,默认值为 `false`。开启拥塞控制之后,V2Ray 会自动监测网络质量,当丢包严重时,会自动降低吞吐量;当网络畅通时,也会适当增加吞吐量。
32 |
33 | > `readBufferSize`: number
34 |
35 | 单个连接的读取缓冲区大小,单位是 MB。默认值为 `2`。
36 |
37 | > `writeBufferSize`: number
38 |
39 | 单个连接的写入缓冲区大小,单位是 MB。默认值为 `2`。
40 |
41 | :::tip
42 | `readBufferSize` 和 `writeBufferSize` 指定了单个连接所使用的内存大小。在需要高速传输时,指定较大的 `readBufferSize` 和 `writeBufferSize` 会在一定程度上提高速度,但也会使用更多的内存。在网速不超过 20MB/s 时,默认值 1MB 可以满足需求;超过之后,可以适当增加 `readBufferSize` 和 `writeBufferSize` 的值,然后手动平衡速度和内存的关系。
43 | :::
44 |
45 | > `seed`: string
46 |
47 | 可选的混淆密码,使用 AES-128-GCM 算法混淆流量数据,客户端和服务端需要保持一致,启用后会输出"NewAEADAESGCMBasedOnSeed Used"到命令行。本混淆机制不能用于保证通信内容的安全,但可能可以对抗部分封锁,在开发者测试环境下开启此设置后没有出现原版未混淆版本的封端口现象。
48 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/meek.md:
--------------------------------------------------------------------------------
1 | # Meek
2 |
3 | Meek 是一个将请求编码为普通 HTTP 请求 / 回应的传输协议. 您可以使用任何支持转发 HTTP 请求的服务来转发 meek 连接。(v5.7.0+)
4 |
5 | 这个传输协议的传输速度较低,适用于其他传输协议无法使用的情况。
6 |
7 |
8 | ## Meek 流传输协议
9 | * 名称: `meek`
10 | * 类型: 传输协议
11 | * ID: `stream.meek`
12 |
13 | > `url`: string
14 |
15 | 服务器地址链接。
16 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/mekya.md:
--------------------------------------------------------------------------------
1 | # mekya
2 |
3 | mekya(美咔) 是一种反审查协议,它将 mkcp 流量编码成普通的 HTTP 请求/响应。这将允许流量在大量平台上转发,以减轻 IP 阻断的影响。(v5.21.0+)
4 |
5 | 相比于 meek 的顺序传输,此传输方式性能有所提升,得益于采用 mkcp 协议。
6 |
7 | 此传输协议已启用订阅。
8 |
9 | ## mekya 流传输
10 | * 名称:`mekya`
11 | * 类型:传输协议
12 | * ID:`stream.mekya`
13 |
14 | > `kcp`: [KCPSetting](kcp.md)
15 |
16 | 应用于此传输方式的 mkcp 设置。
17 |
18 | > `maxWriteSize`: number
19 |
20 | (仅限服务器)
21 |
22 | 将写入单个响应的最大响应大小。
23 |
24 | > `maxWriteDurationMs`: number
25 |
26 | (仅限服务器)
27 |
28 | 服务器将保持请求打开以进行写入的最长时间(毫秒)。
29 |
30 | > `maxSimultaneousWriteConnection`: number
31 |
32 | (仅限服务器)
33 |
34 | 服务器将保留打开以进行写入的未完成 HTTP 请求的最大数量。
35 |
36 | > `packetWritingBuffer`: number
37 |
38 | (仅限服务器)
39 |
40 | 服务器将保持请求打开以进行的数据包的最大数量。
41 |
42 | > `url`: string
43 |
44 | (仅限客户端)
45 |
46 | 服务器的 URL。
47 |
48 | > `maxWriteDelay`: number
49 |
50 | (仅限客户端)
51 |
52 | 为单个请求积累写入数据的最大时间(毫秒)。
53 |
54 | > `maxRequestSize`: number
55 |
56 | (仅限客户端)
57 |
58 | 将写入单个响应的最大请求大小。
59 |
60 | > `pollingIntervalInitial`: number
61 |
62 | (仅限客户端)
63 |
64 | 初始轮询时间。
65 |
66 | > `h2PoolSize`: number
67 |
68 | (仅限客户端)
69 |
70 | 并发性 http2 客户端的数量。
71 |
72 | ## mekya 使用示例
73 |
74 | 基于 mekya 的代理配置示例可在以下位置找到:
75 |
76 | [mekya 客户端](https://github.com/v2fly/v2ray-core/blob/master/testing/scenarios/config/mekya_client.json)
77 |
78 | [mekya 服务器](https://github.com/v2fly/v2ray-core/blob/master/testing/scenarios/config/mekya_server.json)
79 |
80 | (本文档为机器翻译自英文版本后手工校对)
81 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/quic.md:
--------------------------------------------------------------------------------
1 | # QUIC
2 |
3 | QUIC 全称 Quick UDP Internet Connection,是由 Google 提出的使用 UDP 进行多路并发传输的协议。其主要优势是:
4 |
5 | 1. 减少了握手的延迟(1-RTT 或 0-RTT)
6 | 2. 多路复用,并且没有 TCP 的阻塞问题
7 | 3. 连接迁移,(主要是在客户端)当由 Wifi 转移到 4G 时,连接不会被断开。
8 |
9 | ## QUIC Stream
10 | stream.quic
11 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/tcp.md:
--------------------------------------------------------------------------------
1 | # TCP
2 |
3 | ## TCP Stream
4 | tcp.stream
5 |
6 | > `acceptProxyProtocol`: true | false
7 |
8 | 仅用于入站,是否接收 Proxy Protocol,默认值为 `false`。该值为 `true` 时,底层 TCP 连接建立后,请求方必须先发送 Proxy Protocol,否则连接将被关闭。
9 |
--------------------------------------------------------------------------------
/docs/v5/config/stream/websocket.md:
--------------------------------------------------------------------------------
1 | # WebSocket
2 |
3 | ## WebSocket Stream
4 | stream.ws
5 |
6 | > `acceptProxyProtocol`: true | false
7 |
8 | 仅用于入站,是否接收 Proxy Protocol,默认值为 `false`。该值为 `true` 时,底层 TCP 连接建立后,请求方必须先发送 Proxy Protocol,否则连接将被关闭。
9 |
10 | [Proxy Protocol](https://www.haproxy.org/download/2.2/doc/proxy-protocol.txt) 用于传递请求的真实来源 IP 和端口。
11 |
12 | > `path`: string
13 |
14 | WebSocket 所使用的 HTTP 协议路径,默认值为 `"/"`。
15 |
16 | > `headers`: map \{string: string\}
17 |
18 | 自定义 HTTP 头,一个键值对,每个键表示一个 HTTP 头的名称,对应的值是字符串。默认值为空。
19 |
20 | > `maxEarlyData`: number
21 |
22 | 所要发送的前置数据的最长长度。用于减少连接建立的时间。
23 | 数据会以 Base64 RawURLEncoding 的形式附加在 path 之后,转发时需要根据前缀进行匹配。
24 |
25 | 如果设置 `earlyDataHeaderName` 则会将前置数据放置于该 HTTP 头。
26 |
27 | 对于接收端,设置为任何非 0 数值都代表启用前置数据支持。
28 |
29 | > `useBrowserForwarding`: true | false
30 |
31 | 是否启用浏览器转发。如果启用浏览器转发,相应的 WebSockets 连接就会经过浏览器转发模块进行转发后再发送至互联网。
32 |
33 | v4.37.0+ 服务器端程序会自动适配客户端的浏览器转发功能,无需额外设置。
34 |
35 | 只兼容基于基于路径的前置数据或者 HTTP 头的名字为 "Sec-WebSocket-Protocol" 的启用基于 HTTP 头的前置数据。
36 |
37 | 相关配置请参考浏览器转发模块文档。[service.browser](../service/browser.md)
38 |
39 | > `earlyDataHeaderName`: string
40 | >
41 | 发送的前置数据的 HTTP 头的名字,设置后启用基于 HTTP 头的前置数据。如果留空则使用基于路径的前置数据。
42 |
43 | 当且仅当 HTTP 头的名字为 "Sec-WebSocket-Protocol" 时可以启用基于 HTTP 头的前置数据浏览器转发功能。
44 |
45 | :::tip
46 | V2Ray 的 WebSocket 前置数据实现已经完成与其他项目的兼容,正确设置后可以连接其他实现的服务器端。
47 |
48 | 其他项目的客户端可能无法连接 V2Ray 服务器端。
49 | :::
50 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "v2fly-github-io",
3 | "license": "CC-BY-SA-4.0",
4 | "version": "1.0.0",
5 | "scripts": {
6 | "dev": "vuepress dev docs",
7 | "build": "vuepress build docs",
8 | "precommit": "lint-staged"
9 | },
10 | "lint-staged": {
11 | "docs/**/*.{md,markdown}": "lint-md"
12 | },
13 | "devDependencies": {
14 | "@vuepress/plugin-docsearch": "^2.0.0-rc.19",
15 | "@vuepress/plugin-register-components": "^2.0.0-rc.19",
16 | "lint-staged": "^15.4.3",
17 | "sass-embedded": "^1.83.4",
18 | "vuepress": "^2.0.0-rc.19"
19 | },
20 | "dependencies": {
21 | "@algolia/client-search": ">= 4.9.1 < 6",
22 | "@vuepress/bundler-vite": "^2.0.0-rc.19",
23 | "@vuepress/theme-default": "^2.0.0-rc.76",
24 | "search-insights": ">= 1 < 3",
25 | "uuid": "^11.0.5",
26 | "vue": "^3.5.0"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------