Explorar el Código

Add documentation for vmess

世界 hace 3 años
padre
commit
14b6200fd8

+ 1 - 0
docs/configuration/inbound/index.md

@@ -20,6 +20,7 @@
 | `socks`       | [Socks](./socks)             |
 | `socks`       | [Socks](./socks)             |
 | `http`        | [HTTP](./http)               |
 | `http`        | [HTTP](./http)               |
 | `shadowsocks` | [Shadowsocks](./shadowsocks) |
 | `shadowsocks` | [Shadowsocks](./shadowsocks) |
+| `vmess`       | [VMess](./vmess)             |
 | `tun`         | [Tun](./tun)                 |
 | `tun`         | [Tun](./tun)                 |
 | `redirect`    | [Redirect](./redirect)       |
 | `redirect`    | [Redirect](./redirect)       |
 | `tproxy`      | [TProxy](./tproxy)           |
 | `tproxy`      | [TProxy](./tproxy)           |

+ 1 - 1
docs/configuration/inbound/redirect.md

@@ -1,4 +1,4 @@
-`redirect` inbound is a linux Redirect server.
+`redirect` inbound is a linux redirect server.
 
 
 ### Structure
 ### Structure
 
 

+ 0 - 2
docs/configuration/inbound/shadowsocks.md

@@ -1,5 +1,3 @@
-`shadowsocks` inbound is a shadowsocks server.
-
 ### Structure
 ### Structure
 
 
 ```json
 ```json

+ 0 - 2
docs/configuration/inbound/tproxy.md

@@ -1,5 +1,3 @@
-`tproxy` inbound is a linux TProxy server.
-
 ### Structure
 ### Structure
 
 
 ```json
 ```json

+ 2 - 0
docs/configuration/inbound/tun.md

@@ -10,12 +10,14 @@
     {
     {
       "type": "tun",
       "type": "tun",
       "tag": "tun-in",
       "tag": "tun-in",
+
       "inet4_address": "172.19.0.1/30",
       "inet4_address": "172.19.0.1/30",
       "inet6_address": "fdfe:dcba:9876::1/128",
       "inet6_address": "fdfe:dcba:9876::1/128",
       "mtu": 1500,
       "mtu": 1500,
       "auto_route": true,
       "auto_route": true,
       "endpoint_independent_nat": false,
       "endpoint_independent_nat": false,
       "udp_timeout": 300,
       "udp_timeout": 300,
+      
       "sniff": true,
       "sniff": true,
       "sniff_override_destination": false,
       "sniff_override_destination": false,
       "domain_strategy": "prefer_ipv4"
       "domain_strategy": "prefer_ipv4"

+ 85 - 0
docs/configuration/inbound/vmess.md

@@ -0,0 +1,85 @@
+### Structure
+
+```json
+{
+  "inbounds": [
+    {
+      "type": "vmess",
+      "tag": "vmess-in",
+      
+      "listen": "::",
+      "listen_port": 2080,
+      "tcp_fast_open": false,
+      "sniff": false,
+      "sniff_override_destination": false,
+      "domain_strategy": "prefer_ipv6",
+      
+      "users": [
+        {
+          "name": "sekai",
+          "uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
+          "alterId": 0
+        }
+      ],
+      "tls": {}
+    }
+  ]
+}
+```
+
+### Listen Fields
+
+#### listen
+
+==Required==
+
+Listen address.
+
+#### listen_port
+
+==Required==
+
+Listen port.
+
+#### tcp_fast_open
+
+Enable tcp fast open for listener.
+
+#### sniff
+
+Enable sniffing.
+
+See [Sniff](/configuration/route/sniff/) for details.
+
+#### sniff_override_destination
+
+Override the connection destination address with the sniffed domain.
+
+If the domain name is invalid (like tor), this will not work.
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the requested domain name will be resolved to IP before routing.
+
+If `sniff_override_destination` is in effect, its value will be taken as a fallback.
+
+### VMess Fields
+
+#### users
+
+VMess users.
+
+| Alter ID | Description             |
+|----------|-------------------------|
+| 0        | Disable legacy protocol |
+| > 0      | Enable legacy protocol  |
+
+!!! warning ""
+
+    Legacy protocol support (VMess MD5 Authentication) is provided for compatibility purposes only, use of alterId > 1 is not recommended.
+
+#### tls
+
+TLS configuration, see [TLS inbound structure](/configuration/shared/tls/#inbound-structure).

+ 1 - 0
docs/configuration/outbound/index.md

@@ -20,6 +20,7 @@
 | `socks`       | [Socks](./socks)             |
 | `socks`       | [Socks](./socks)             |
 | `http`        | [HTTP](./http)               |
 | `http`        | [HTTP](./http)               |
 | `shadowsocks` | [Shadowsocks](./shadowsocks) |
 | `shadowsocks` | [Shadowsocks](./shadowsocks) |
+ | `vmess`       | [VMess](./vmess)             |
 | `dns`         | [DNS](./dns)                 |
 | `dns`         | [DNS](./dns)                 |
 | `selector`    | [Selector](./selector)       |
 | `selector`    | [Selector](./selector)       |
 
 

+ 2 - 0
docs/configuration/outbound/socks.md

@@ -8,12 +8,14 @@
     {
     {
       "type": "socks",
       "type": "socks",
       "tag": "socks-out",
       "tag": "socks-out",
+      
       "server": "127.0.0.1",
       "server": "127.0.0.1",
       "server_port": 1080,
       "server_port": 1080,
       "version": "5",
       "version": "5",
       "username": "sekai",
       "username": "sekai",
       "password": "admin",
       "password": "admin",
       "network": "udp",
       "network": "udp",
+      
       "detour": "upstream-out",
       "detour": "upstream-out",
       "bind_interface": "en0",
       "bind_interface": "en0",
       "routing_mark": 1234,
       "routing_mark": 1234,

+ 143 - 0
docs/configuration/outbound/vmess.md

@@ -0,0 +1,143 @@
+### Structure
+
+```json
+{
+  "outbounds": [
+    {
+      "type": "vmess",
+      "tag": "vmess-out",
+      
+      "server": "127.0.0.1",
+      "server_port": 1080,
+      "uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
+      "security": "auto",
+      "alter_id": 0,
+      "global_padding": false,
+      "authenticated_length": true,
+      "network": "tcp",
+      "tls": {},
+      
+      "detour": "upstream-out",
+      "bind_interface": "en0",
+      "routing_mark": 1234,
+      "reuse_addr": false,
+      "connect_timeout": "5s",
+      "tcp_fast_open": false,
+      "domain_strategy": "prefer_ipv6",
+      "fallback_delay": "300ms"
+    }
+  ]
+}
+```
+
+### VMess Fields
+
+#### server
+
+==Required==
+
+The server address.
+
+#### server_port
+
+==Required==
+
+The server port.
+
+#### uuid
+
+==Required==
+
+The VMess user id.
+
+#### security
+
+Encryption methods:
+
+* `auto`
+* `none`
+* `zero`
+* `aes-128-gcm`
+* `chancha20-poly1305`
+
+Legacy encryption methods:
+
+* `aes-128-ctr`
+
+#### alter_id
+
+| Alter ID | Description         |
+|----------|---------------------|
+| 0        | Use AEAD protocol   |
+| 1        | Use legacy protocol |
+| > 1      | Unused, same as 1   |
+
+#### global_padding
+
+Protocol parameter. Will waste traffic randomly if enabled (enabled by default in v2ray and cannot be disabled).
+
+#### authenticated_length
+
+Protocol parameter. Enable length block encryption.
+
+#### network
+
+Enabled network
+
+One of `tcp` `udp`.
+
+Both is enabled by default.
+
+#### tls
+
+TLS configuration, see [TLS outbound structure](/configuration/shared/tls/#outbound-structure).
+
+### Dial Fields
+
+#### detour
+
+The tag of the upstream outbound.
+
+Other dial fields will be ignored when enabled.
+
+#### bind_interface
+
+The network interface to bind to.
+
+#### routing_mark
+
+!!! error ""
+
+    Linux only
+
+The iptables routing mark.
+
+#### reuse_addr
+
+Reuse listener address.
+
+#### connect_timeout
+
+Connect timeout, in golang's Duration format.
+
+A duration string is a possibly signed sequence of
+decimal numbers, each with optional fraction and a unit suffix,
+such as "300ms", "-1.5h" or "2h45m".
+Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
+
+#### domain_strategy
+
+One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
+
+If set, the server domain name will be resolved to IP before connecting.
+
+`dns.strategy` will be used if empty.
+
+#### fallback_delay
+
+The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
+That is, is the amount of time to wait for IPv6 to succeed before assuming
+that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
+If zero, a default delay of 300ms is used.
+
+Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

+ 1 - 1
go.mod

@@ -17,7 +17,7 @@ require (
 	github.com/sagernet/sing-dns v0.0.0-20220730061139-c8e0fb296da9
 	github.com/sagernet/sing-dns v0.0.0-20220730061139-c8e0fb296da9
 	github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8
 	github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8
 	github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8
 	github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8
-	github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3
+	github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a
 	github.com/spf13/cobra v1.5.0
 	github.com/spf13/cobra v1.5.0
 	github.com/stretchr/testify v1.8.0
 	github.com/stretchr/testify v1.8.0
 	go.uber.org/atomic v1.9.0
 	go.uber.org/atomic v1.9.0

+ 2 - 2
go.sum

@@ -157,8 +157,8 @@ github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8 h1:d6Sda
 github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8/go.mod h1:aNTIkd+bCIUgr5C43aZBGXDxIc0Y9NOozLLzH2vUydM=
 github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8/go.mod h1:aNTIkd+bCIUgr5C43aZBGXDxIc0Y9NOozLLzH2vUydM=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 h1:xXpkIml1GbkNlQwlmdLWvXBmOBPHDEIjv/QSrKPsLgY=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 h1:xXpkIml1GbkNlQwlmdLWvXBmOBPHDEIjv/QSrKPsLgY=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8/go.mod h1:1V/Scct3DGHi925AasPCj1k+6SRWIcg0TvRHM0ZXB8I=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8/go.mod h1:1V/Scct3DGHi925AasPCj1k+6SRWIcg0TvRHM0ZXB8I=
-github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3 h1:2ZTNZND525FxPkal2hiibrsVjtT8DRjAKA15PXkvggE=
-github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3/go.mod h1:NnKMgOr0WvyHsLICWTIz4xW3+yd3Ft2BtU8N5ycT4OU=
+github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a h1:U4I/CHpGposYUF6RkQjzixr93ww2trnFJDo7JhFrBY0=
+github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a/go.mod h1:4/SUIlK6Xn+hT7srzTcqVFQ/jX3EX4y3nYDfP0BnAuk=
 github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
 github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
 github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
 github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=

+ 2 - 0
mkdocs.yml

@@ -45,6 +45,7 @@ nav:
           - Socks: configuration/inbound/socks.md
           - Socks: configuration/inbound/socks.md
           - HTTP: configuration/inbound/http.md
           - HTTP: configuration/inbound/http.md
           - Shadowsocks: configuration/inbound/shadowsocks.md
           - Shadowsocks: configuration/inbound/shadowsocks.md
+          - VMess: configuration/inbound/vmess.md
           - Tun: configuration/inbound/tun.md
           - Tun: configuration/inbound/tun.md
           - Redirect: configuration/inbound/redirect.md
           - Redirect: configuration/inbound/redirect.md
           - TProxy: configuration/inbound/tproxy.md
           - TProxy: configuration/inbound/tproxy.md
@@ -55,6 +56,7 @@ nav:
           - Socks: configuration/outbound/socks.md
           - Socks: configuration/outbound/socks.md
           - HTTP: configuration/outbound/http.md
           - HTTP: configuration/outbound/http.md
           - Shadowsocks: configuration/outbound/shadowsocks.md
           - Shadowsocks: configuration/outbound/shadowsocks.md
+          - VMess: configuration/outbound/vmess.md
           - DNS: configuration/outbound/dns.md
           - DNS: configuration/outbound/dns.md
           - Selector: configuration/outbound/selector.md
           - Selector: configuration/outbound/selector.md
       - Route:
       - Route:

+ 1 - 1
test/go.mod

@@ -54,7 +54,7 @@ require (
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/sagernet/sing-dns v0.0.0-20220730061139-c8e0fb296da9 // indirect
 	github.com/sagernet/sing-dns v0.0.0-20220730061139-c8e0fb296da9 // indirect
 	github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 // indirect
 	github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 // indirect
-	github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3 // indirect
+	github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a // indirect
 	github.com/sirupsen/logrus v1.8.1 // indirect
 	github.com/sirupsen/logrus v1.8.1 // indirect
 	github.com/vishvananda/netlink v1.1.0 // indirect
 	github.com/vishvananda/netlink v1.1.0 // indirect
 	github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
 	github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect

+ 2 - 2
test/go.sum

@@ -180,8 +180,8 @@ github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8 h1:d6Sda
 github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8/go.mod h1:aNTIkd+bCIUgr5C43aZBGXDxIc0Y9NOozLLzH2vUydM=
 github.com/sagernet/sing-shadowsocks v0.0.0-20220730132258-5c45f99276b8/go.mod h1:aNTIkd+bCIUgr5C43aZBGXDxIc0Y9NOozLLzH2vUydM=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 h1:xXpkIml1GbkNlQwlmdLWvXBmOBPHDEIjv/QSrKPsLgY=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8 h1:xXpkIml1GbkNlQwlmdLWvXBmOBPHDEIjv/QSrKPsLgY=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8/go.mod h1:1V/Scct3DGHi925AasPCj1k+6SRWIcg0TvRHM0ZXB8I=
 github.com/sagernet/sing-tun v0.0.0-20220731115551-4a805410a2e8/go.mod h1:1V/Scct3DGHi925AasPCj1k+6SRWIcg0TvRHM0ZXB8I=
-github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3 h1:2ZTNZND525FxPkal2hiibrsVjtT8DRjAKA15PXkvggE=
-github.com/sagernet/sing-vmess v0.0.0-20220801041428-8f2785c629c3/go.mod h1:NnKMgOr0WvyHsLICWTIz4xW3+yd3Ft2BtU8N5ycT4OU=
+github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a h1:U4I/CHpGposYUF6RkQjzixr93ww2trnFJDo7JhFrBY0=
+github.com/sagernet/sing-vmess v0.0.0-20220801082718-0b96d703437a/go.mod h1:4/SUIlK6Xn+hT7srzTcqVFQ/jX3EX4y3nYDfP0BnAuk=
 github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
 github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
 github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
 github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=