### DnsObject Configuration Example (JSON) Source: https://www.v2fly.org/config/dns This snippet shows a comprehensive example of the DnsObject configuration in JSON format. It includes host mappings, DNS server configurations with various protocols and routing rules, client IP settings, query strategies, and options to disable caching and fallback. ```json { "hosts": { "baidu.com": "127.0.0.1", "example.com": [ "127.0.0.1", "::1", "proxy.example.com", "127.0.0.2" ], "dns.google": "8.8.8.8", "proxy.example.com": "127.0.0.1", "geosite:test": [ "another-proxy.example.com", "127.0.0.1" ], "geosite:category-ads-all": [ "127.0.0.1", "127.0.0.2", "::1" ] }, "servers": [ "https://dns.google/dns-query", { "address": "223.5.5.5", "port": 5353, "clientIp": "5.6.7.8", "skipFallback": true, "domains": [ "domain:baidu.com", "geosite:cn" ], "expectIPs": [ "geoip:cn", "ext:customizedGeoIPFile.dat:cn", "ext-ip:customizedGeoIPFile.dat:cn" ] }, { "address": "fakedns", "domains": [ "domain:v2fly.org", "geosite:geolocation-!cn" ] }, { "address": "https://1.1.1.1/dns-query", "domains": [ "domain:v2fly.org", "geosite:geolocation-!cn" ], "expectIPs": [ "geoip:!cn", "ext:customizedGeoIPFile.dat:!cn", "ext-ip:customizedGeoIPFile.dat:!cn" ] }, "1.0.0.1", "localhost" ], "clientIp": "1.2.3.4", "queryStrategy": "UseIPv4", "disableCache": true, "disableFallback": true, "tag": "dns_inbound" } ``` -------------------------------- ### V2Fly Socks Inbound Configuration Example Source: https://www.v2fly.org/config/protocols/socks Example configuration for the Socks inbound protocol in V2Fly. This covers authentication methods, user accounts, UDP support, IP address for UDP association, user level, and packet encoding. ```json { "auth": "noauth", "accounts": [ { "user": "my-username", "pass": "my-password" } ], "udp": false, "ip": "127.0.0.1", "userLevel": 0, "packetEncoding": "None" } ``` -------------------------------- ### StrategyObject Configuration Example Source: https://www.v2fly.org/config/routing Defines the strategy for load balancing. Supported types include 'random' for random selection and 'leastPing' (v4.38.0+) for selecting the fastest outbound connection based on latency measurements. ```json { "type": "random" } ``` -------------------------------- ### V2Fly Socks Outbound Configuration Example Source: https://www.v2fly.org/config/protocols/socks Example configuration for the Socks outbound protocol in V2Fly. This includes server addresses, ports, and user authentication details. Note that Socks protocol does not provide transport encryption and is not suitable for public internet transmission. ```json { "servers": [ { "address": "127.0.0.1", "port": 1234, "users": [ { "user": "test user", "pass": "test pass", "level": 0 } ] } ] } ``` -------------------------------- ### V2Ray Recommended Multi-File Structure Setup Source: https://www.v2fly.org/config/multiple_config Provides shell commands to create a recommended set of empty configuration files for V2Ray. This structure helps organize configurations by module (e.g., log, api, dns) and can be used with the `-confdir` option. The files are created in either `/etc/v2ray/` or `/usr/local/etc/v2ray/`. ```bash for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do echo '{}' > "/etc/v2ray/$BASE.json"; done ``` ```bash for BASE in 00_log 01_api 02_dns 03_routing 04_policy 05_inbounds 06_outbounds 07_transport 08_stats 09_reverse; do echo '{}' > "/usr/local/etc/v2ray/$BASE.json"; done ``` -------------------------------- ### BalancerObject Configuration Example Source: https://www.v2fly.org/config/routing Configures a load balancer that selects an appropriate outbound connection based on a specified strategy. The `tag` is used to link with `RuleObject`, and `selector` is used to filter outbound connections. ```json { "tag": "balancer", "selector": [], "strategy": { "type": "random" } } ``` -------------------------------- ### ServerObject Configuration Example (JSON) Source: https://www.v2fly.org/config/dns This snippet illustrates the structure of a ServerObject within the DnsObject configuration. It specifies a DNS server address, port, client IP, and rules for domain matching and expected IP addresses. This object is used to define individual DNS server configurations. ```json { "address": "223.5.5.5", "port": 5353, "clientIp": "5.6.7.8", "skipFallback": true, "domains": [ "domain:baidu.com", "geosite:cn" ], "expectIPs": [ "geoip:cn", "ext:customizedGeoIPFile.dat:cn", "ext-ip:customizedGeoIPFile.dat:cn" ] } ``` -------------------------------- ### RuleObject Configuration Example Source: https://www.v2fly.org/config/routing Defines routing rules based on various criteria such as domain, IP, port, user, and protocol. The `domainMatcher` property specifies the algorithm for domain matching, with 'mph' (minimal perfect hash) offering performance improvements over 'linear'. ```json { "domainMatcher": "mph", "type": "field", "domains": [ "baidu.com", "qq.com", "geosite:cn", "ext:customizedGeoSiteFile.dat:cn" ], "ip": [ "0.0.0.0/8", "10.0.0.0/8", "fc00::/7", "fe80::/10", "geoip:cn", "geoip:!cn", "ext:customizedGeoIPFile.dat:cn", "ext:customizedGeoIPFile.dat:!cn", "ext-ip:customizedGeoIPFile.dat:cn", "ext-ip:customizedGeoIPFile.dat:!cn" ], "port": "53,443,1000-2000", "sourcePort": "53,443,1000-2000", "network": "tcp", "source": [ "10.0.0.1" ], "user": [ "love@v2ray.com" ], "inboundTag": [ "tag-vmess" ], "protocol": [ "http", "tls", "bittorrent" ], "attrs": "attrs[':method'] == 'GET'", "outboundTag": "direct", "balancerTag": "balancer" } ``` -------------------------------- ### Trojan Fallback Object Source: https://www.v2fly.org/config/protocols/trojan Defines fallback server configurations for the Trojan inbound protocol. It includes ALPN, path, destination port, and version. ```json { "alpn": "", "path": "", "dest": 80, "xver": 0 } ``` -------------------------------- ### V2Ray Portal Inbound Proxies Configuration (JSON) Source: https://www.v2fly.org/config/reverse Example of inbound proxy configurations for a V2Ray portal. Includes 'dokodemo-door' for external HTTP access and 'vmess' for receiving connections from the bridge. ```json { "tag": "external", "port": 80, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1", "port": 80, "network": "tcp" } }, { "port": 1024, "tag": "interconn", "protocol": "vmess", "settings": { "clients": [ { "id": "27848739-7e62-4138-9fd3-098a63964b6b" } ] } } ``` -------------------------------- ### Trojan Inbound Configuration Object Source: https://www.v2fly.org/config/protocols/trojan Defines the settings for the inbound Trojan configuration. It includes client details, fallback options, and packet encoding. ```json { "clients":[ { "password": "password", "email": "love@v2fly.org", "level": 0 } ], "fallbacks": [ { "dest": 80 } ], "packetEncoding": "None" } ``` -------------------------------- ### V2Ray ApiObject Configuration Example Source: https://www.v2fly.org/config/api This JSON configuration snippet defines the ApiObject for V2Ray's remote control. It specifies the 'tag' for the outbound proxy and lists the 'services' to be enabled, such as HandlerService, LoggerService, and StatsService. This configuration is essential for enabling remote API access. ```json { "tag": "api", "services": [ "HandlerService", "LoggerService", "StatsService" ] } ``` -------------------------------- ### Setting HTTP Proxy Environment Variables (Linux) Source: https://www.v2fly.org/config/protocols/http Example commands to set global HTTP and HTTPS proxy environment variables in a Linux session. This allows many applications to automatically use the configured HTTP inbound proxy. ```bash export http_proxy=http://127.0.0.1:8080/ export https_proxy=$http_proxy ``` -------------------------------- ### Trojan Client Object Source: https://www.v2fly.org/config/protocols/trojan Represents a single client configuration for the Trojan inbound protocol. It specifies the password, an optional email for identification, and user level. ```json { "password": "password", "email": "love@v2fly.org", "level": 0 } ``` -------------------------------- ### Trojan Server Object Source: https://www.v2fly.org/config/protocols/trojan Represents a single server configuration for the Trojan outbound protocol. It requires server address, port, and password, with optional email and level. ```json { "address": "127.0.0.1", "port": 1234, "password": "password", "email": "love@v2fly.org", "level": 0 } ``` -------------------------------- ### V2Ray Bridge Outbound Proxies Configuration (JSON) Source: https://www.v2fly.org/config/reverse Example of outbound proxy configurations for a V2Ray bridge. Includes a 'freedom' proxy for redirecting traffic and a 'vmess' proxy for connecting to the portal. ```json { "tag": "out", "protocol": "freedom", "settings": { "redirect": "127.0.0.1:80" } }, { "protocol": "vmess", "settings": { "vnext": [ { "address": "portal 的 IP 地址", "port": 1024, "users": [ { "id": "27848739-7e62-4138-9fd3-098a63964b6b" } ] } ] }, "tag": "interconn" } ``` -------------------------------- ### SockoptObject JSON Configuration Example Source: https://www.v2fly.org/config/transport This JSON object defines various socket options for network connections. It includes settings for TCP Fast Open, TProxy mode, TCP Keep Alive interval, binding to a specific network device, and enabling Multipath TCP. Note that some options are specific to Linux or require certain system permissions. ```json { "mark": 0, "tcpFastOpen": false, "tcpFastOpenQueueLength": 4096, "tproxy": "off", "tcpKeepAliveInterval": 0, "bindToDevice": "eth0", "mptcp": false } ``` -------------------------------- ### V2Ray Multi-File Configuration Command Line Source: https://www.v2fly.org/config/multiple_config Demonstrates how to launch V2Ray using multiple configuration files specified via the `-c` or `-config` flag. This allows for additive configuration, where later files can override or supplement earlier ones. The order of specification is crucial for determining precedence. ```bash v2ray -c v2ray.json -c 00_base.json -c 01_info.json -c 02_log.json -c outbound.json ``` ```bash v2ray -config base.json -config cf1.json -c cf2.json -c cf3.json ``` -------------------------------- ### Trojan Outbound Configuration Object Source: https://www.v2fly.org/config/protocols/trojan Specifies the settings for the outbound Trojan configuration, primarily focusing on the server details. ```json { "servers": [ { "address": "127.0.0.1", "port": 1234, "password": "password", "email": "love@v2fly.org", "level": 0 } ] } ``` -------------------------------- ### V2Ray Directory-Based Configuration Source: https://www.v2fly.org/config/multiple_config Shows how to use the `-confdir` option to load all `.json` files within a specified directory. V2Ray reads these files in alphabetical order, providing a convenient way to manage a large number of configurations. This method can be combined with individual `-c` flags. ```bash v2ray -confdir /etc/v2ray/confs ``` ```bash v2ray -c cf1.json -c cf2.json -confdir /etc/v2ray/confs ``` -------------------------------- ### V2Ray BridgeObject Configuration (JSON) Source: https://www.v2fly.org/config/reverse Represents the configuration for a 'bridge' in V2Ray's reverse proxy setup. It includes a 'tag' for identification and a 'domain' used for communication between bridge and portal. ```json { "tag": "bridge", "domain": "test.v2fly.org" } ``` -------------------------------- ### V2Fly Configuration Overview Source: https://www.v2fly.org/config/overview This JSON object represents the overall structure of a V2Fly configuration file. It includes placeholders for various components such as logging, API, DNS, routing, policies, inbound and outbound connections, transport, stats, reverse proxy, fake DNS, browser forwarder, and observatory. ```json { "log": {}, "api": {}, "dns": {}, "routing": {}, "policy": {}, "inbounds": [], "outbounds": [], "transport": {}, "stats": {}, "reverse": {}, "fakedns": [], "browserForwarder": {}, "observatory": {} } ``` -------------------------------- ### TUN Service Configuration Source: https://www.v2fly.org/config/service/tun Configuration details for the TUN service, which handles network layer packets and routes them through the proxy. ```APIDOC ## TUN Service Configuration ### Description Configures the TUN service, which accepts network layer packets, converts them into a general data stream, and forwards them for proxy processing. This feature is available from v5.9.0+ and currently supports Linux operating systems on amd64 and arm64 architectures. ### Method Not Applicable (Configuration setting) ### Endpoint Not Applicable (Configuration setting) ### Parameters #### Request Body (TUN Service Configuration) - **name** (string) - Required - The name of the TUN network adapter. - **mtu** (number) - Recommended: 1500 - The Maximum Transmission Unit for the TUN network adapter. - **tag** (string) - Required - The inbound tag for the generated traffic. - **ips** (array of IPObject) - Recommended: Private IP ranges - The IP address range for the TUN network adapter. - **routes** (array of RouteObject) - Recommended: `0.0.0.0/0` and `::/0` - The routing table for the TUN network adapter, used to route all incoming packets. - **enablePromiscuousMode** (bool) - Recommended: `true` - Enables promiscuous mode for the TUN adapter. - **enableSpoofing** (bool) - Recommended: `true` - Enables IP spoofing for the TUN adapter. - **packetEncoding** (array of strings) - Optional, Default: `None` - The encoding method for UDP packets. Possible values: `"None"`, `"Packet"`. - **sniffingSettings** (SniffingObject) - Optional (v5.11.0+) - Traffic sniffing settings for TUN inbound connections, allowing connections to be forwarded based on content and metadata. ### IPObject Structure - **ip** (array of numbers) - The IP address. - **prefix** (number) - The prefix length of the IP address. ### RouteObject Structure - **ip** (array of numbers) - The IP address. - **prefix** (number) - The prefix length of the IP address. ### SniffingObject Structure (Structure not provided in the input text, but it's a configuration object for traffic sniffing.) ### Request Example ```json { "name": "tun0", "mtu": 1500, "tag": "tun-inbound", "ips": [ { "ip": [172, 16, 0, 1], "prefix": 24 } ], "routes": [ { "ip": [0, 0, 0, 0], "prefix": 0 }, { "ip": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "prefix": 0 } ], "enablePromiscuousMode": true, "enableSpoofing": true, "packetEncoding": "Packet" } ``` ### Response Not Applicable (Configuration setting, no direct response to a request is documented here.) ``` -------------------------------- ### Concurrent Connection Observation Configuration Source: https://www.v2fly.org/config/service/burstObservatory This section details how to configure the concurrent connection observation service within V2Fly. It includes settings for selecting subjects, ping configurations, and interval timings. ```APIDOC ## Concurrent Connection Observation Configuration ### Description Configure the concurrent connection observation service. This service allows for monitoring active connections based on specified criteria. ### Method UPDATE ### Endpoint /config/observation/concurrent ### Parameters #### Request Body - **subjectSelector** (string array) - Required - A list of strings used to match prefixes of outbound protocol identifiers. - **pingConfig** (PingConfigObject) - Optional - Configuration for ping checks. ### PingConfigObject #### Description Defines the parameters for ping and connectivity checks. #### Fields - **destination** (string) - Required - The URL for ping destination. Should return 204 on success. - **connectivity** (string) - Required - The URL for connectivity check. - **interval** (string) - Optional - The interval for initiating health checks (e.g., "10s", "2h45m"). Supports ns, us, ms, s, m, h units. - **samplingCount** (number) - Optional - The number of recent Ping results to retain. - **timeout** (string) - Optional - Ping timeout duration (e.g., "10s", "2h45m"). Supports ns, us, ms, s, m, h units. ### Request Example ```json { "subjectSelector": [ "a", "b" ], "pingConfig": { "destination": "http://example.com/ping", "connectivity": "http://example.com/connectivity", "interval": "30s", "samplingCount": 10, "timeout": "5s" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success status of the configuration update. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### ApiObject Configuration Source: https://www.v2fly.org/config/api Configuration for the ApiObject, which defines the tag for the outbound proxy and the list of enabled API services. ```APIDOC ## ApiObject Configuration ### Description This section describes the configuration structure for the `ApiObject`, which specifies the tag for the outbound proxy used for API communication and the list of services to be exposed. ### Method N/A (Configuration Object) ### Endpoint N/A (Configuration Object) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **tag** (string) - Required - The identifier tag for the outbound proxy that V2Ray will create for API communication. - **services** (array of strings) - Required - A list of API services to enable. Possible values include `HandlerService`, `LoggerService`, `StatsService`, and `ObservatoryService`. ### Request Example ```json { "tag": "api", "services": [ "HandlerService", "LoggerService", "StatsService" ] } ``` ### Response N/A (Configuration Object) ``` -------------------------------- ### Observatory Object - subjectSelector Example (JSON) Source: https://www.v2fly.org/config/observatory Illustrates the usage of `subjectSelector` within the Observatory configuration. This array of strings is used to match prefixes of outbound protocol identifiers, determining which connections will be probed. ```json { "subjectSelector": [ "a" ] } ``` -------------------------------- ### DNS Outbound Server Port (V2Ray 4.16+) Source: https://www.v2fly.org/config/protocols/dns Allows modification of the DNS server port for DNS queries starting from V2Ray version 4.16. If not specified, the port from the source is preserved. This setting is part of the OutboundConfigurationObject. ```json { "port": 5353 } ``` -------------------------------- ### DNS Outbound Server Address (V2Ray 4.16+) Source: https://www.v2fly.org/config/protocols/dns Enables modification of the DNS server address for DNS queries starting from V2Ray version 4.16. If not specified, the address from the source is maintained. This is a parameter within the OutboundConfigurationObject. ```json { "address": "8.8.8.8" } ``` -------------------------------- ### HandlerService API Source: https://www.v2fly.org/config/api The HandlerService allows for dynamic management of inbound and outbound proxies, including adding, deleting, and managing user accounts for specific protocols. ```APIDOC ## HandlerService API ### Description Provides capabilities to modify inbound and outbound proxies of the V2Ray instance. This includes adding or removing proxies and managing user accounts for supported protocols. ### Method N/A (gRPC Service) ### Endpoint N/A (gRPC Service) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Details depend on specific gRPC calls for: - Adding/Deleting Inbound/Outbound Proxies - Adding/Deleting Users (VMess, VLESS, Trojan)) ### Request Example (Specific gRPC request examples would be detailed in gRPC documentation) ### Response #### Success Response (Details depend on specific gRPC calls) #### Response Example (Specific gRPC response examples would be detailed in gRPC documentation) ``` -------------------------------- ### VLESS Inbound Configuration Object Source: https://www.v2fly.org/config/protocols/vless Specifies the inbound settings for VLESS, including a list of clients, decryption method, and fallback configurations. Decryption must currently be set to 'none'. ```json { "clients": [ { "id": "27848739-7e62-4138-9fd3-098a63964b6b", "level": 0, "email": "love@v2fly.org" } ], "decryption": "none", "fallbacks": [ { "dest": 80 } ] } ``` -------------------------------- ### DNS Outbound Network Protocol (V2Ray 4.16+) Source: https://www.v2fly.org/config/protocols/dns Allows modification of the transport layer protocol for DNS traffic (TCP or UDP) starting from V2Ray version 4.16. If not specified, the original transport method is retained. This option is part of the OutboundConfigurationObject. ```json { "network": "udp" } ``` -------------------------------- ### Dokodemo-door Inbound Configuration Object Source: https://www.v2fly.org/config/protocols/dokodemo Defines the configuration parameters for the Dokodemo-door inbound protocol. It specifies the target address and port, network protocol, timeout, and whether to follow redirects. The 'address' can be an IP or domain, 'port' is the destination port, 'network' can be 'tcp', 'udp', or 'tcp,udp', 'timeout' sets the data inactivity limit, and 'followRedirect' enables handling of redirected traffic. ```json { "address": "8.8.8.8", "port": 53, "network": "tcp", "timeout": 0, "followRedirect": false, "userLevel": 0 } ``` -------------------------------- ### ObservatoryService API Source: https://www.v2fly.org/config/api Available from v4.38.0+, this service provides API access to the connection observation component. ```APIDOC ## ObservatoryService API (v4.38.0+) ### Description This API service, introduced in version 4.38.0, provides functionalities related to the connection observation component within V2Ray. ### Method N/A (gRPC Service) ### Endpoint N/A (gRPC Service) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Details would depend on specific gRPC calls related to connection observation) ### Request Example (Specific gRPC request examples would be detailed in gRPC documentation) ### Response #### Success Response (Details depend on specific gRPC calls) #### Response Example (Specific gRPC response examples would be detailed in gRPC documentation) ``` -------------------------------- ### Shadowsocks Inbound Configuration Source: https://www.v2fly.org/config/protocols/shadowsocks Configure the inbound settings for the Shadowsocks protocol. This defines how V2Ray accepts incoming connections using Shadowsocks. ```APIDOC ## InboundConfigurationObject ### Description Configuration for the inbound part of the Shadowsocks protocol. ### Method N/A (This is a configuration object, not an API endpoint) ### Endpoint N/A ### Parameters #### Request Body - **email** (string) - Optional - Email address to identify the user. - **method** (string) - Required - Encryption method. See Encryption Methods List. - **password** (string) - Required - Any string. Recommended to be 16 characters or longer. - **level** (number) - Optional - User level, defaults to 0. See Local Policy. - **network** (string) - Optional - Accepted network connection types: "tcp", "udp", "tcp,udp". Defaults to "tcp". - **ivCheck** (boolean) - Optional - Enable IV check feature (4.37.0+). Defaults to false. - **udp** (boolean) - Optional - Enable UDP protocol support. Defaults to false. - **packetEncoding** (string) - Optional - UDP packet encoding method: "None" or "Packet". Defaults to "None". ### Request Example ```json { "email": "love@v2ray.com", "method": "aes-256-gcm", "password": "your_strong_password", "level": 0, "network": "tcp,udp", "ivCheck": false, "udp": true, "packetEncoding": "Packet" } ``` ### Response #### Success Response (200) N/A (This is a configuration object, not a response) #### Response Example N/A ``` -------------------------------- ### Dokodemo-door Transparent Proxy Configuration Source: https://www.v2fly.org/config/protocols/dokodemo This snippet shows the V2Fly configuration for enabling Dokodemo-door to handle transparent proxying. It specifies the network protocols ('tcp,udp'), a timeout of 30 seconds, and importantly, enables 'followRedirect' to true, which is crucial for processing redirected traffic from iptables. ```json { "network": "tcp,udp", "timeout": 30, "followRedirect": true } ``` -------------------------------- ### V2Ray Policy Configuration (JSON) Source: https://www.v2fly.org/config/policy Defines the overall policy structure for V2Ray, including user levels and system-wide settings. It allows for customization of connection timeouts, traffic statistics, and buffer sizes based on user levels. ```json { "levels": { "0": { "handshake": 4, "connIdle": 300, "uplinkOnly": 2, "downlinkOnly": 5, "statsUserUplink": false, "statsUserDownlink": false, "bufferSize": 10240 } }, "system": { "statsInboundUplink": false, "statsInboundDownlink": false, "statsOutboundUplink": false, "statsOutboundDownlink": false } } ``` -------------------------------- ### V2Fly Routing Object Configuration Source: https://www.v2fly.org/config/routing Defines the structure for the routing configuration in V2Fly. It specifies domain resolution strategies, matching algorithms, and arrays for rules and load balancers. The 'domainStrategy' determines how domains are resolved for matching, while 'domainMatcher' selects the matching algorithm. 'rules' and 'balancers' define the traffic routing logic. ```json { "domainStrategy": "AsIs", "domainMatcher": "mph", "rules": [], "balancers": [] } ``` -------------------------------- ### DomainSocketObject Configuration (JSON) Source: https://www.v2fly.org/config/transport/domainsocket This JSON object configures the DomainSocket settings for V2Fly. The 'path' parameter specifies the location for the domain socket file, which must not exist before V2Ray runs. 'abstract' and 'padding' are boolean flags controlling abstract domain socket behavior and padding, respectively. ```json { "path": "/path/to/ds/file", "abstract": false, "padding": false } ``` -------------------------------- ### V2Ray Configuration Merging Rules (Arrays - Inbounds) Source: https://www.v2fly.org/config/multiple_config Explains the specific merging rules for array-based configurations like `inbounds` and `outbounds`. For `inbounds`, if multiple configurations exist, elements with the same `tag` are overwritten, and new elements are appended. If an array has only one element, it's appended if no matching `tag` is found. ```json { "inbounds": [ { "protocol": "socks", "tag":"socks", "port": 1234 } ] } ``` ```json { "inbounds": [ { "protocol": "http", "tag":"http" } ] } ``` ```json { "inbounds": [ { "protocol": "socks", "tag":"socks", "port": 4321 } ] } ``` -------------------------------- ### VMess Client Object Configuration Source: https://www.v2fly.org/config/protocols/vmess Details a client that is authorized to connect via VMess. It includes the client's ID, level, alterId for security, and an email address for identification. ```json { "id": "27848739-7e62-4138-9fd3-098a63964b6b", "level": 0, "alterId": 4, "email": "love@v2ray.com" } ``` -------------------------------- ### VMess Inbound Configuration Source: https://www.v2fly.org/config/protocols/vmess Configuration for the VMess inbound protocol, specifying client details and routing options. ```APIDOC ## VMess Inbound Configuration ### Description Configuration for the VMess inbound protocol, specifying client details and routing options. ### Method N/A (Configuration Structure) ### Endpoint N/A (Configuration Structure) ### Parameters #### Request Body (InboundConfigurationObject) - **clients** (array of ClientObject) - Optional - A group of users recognized by the server. Can be empty. V2Ray automatically creates users when this configuration is used for dynamic ports. - **default** (DefaultObject) - Optional - Default configuration for clients. Only effective when used with `detour`. - **detour** (DetourObject) - Optional - Indicates that the corresponding outbound protocol uses another server. - **disableInsecureEncryption** (boolean) - Optional - Whether to prohibit clients from using insecure encryption methods. When a client specifies the following encryption methods, the server will actively disconnect. Default is `false`. * `"none"` * `"aes-128-cfb"` ### Request Example ```json { "clients": [ { "id": "27848739-7e62-4138-9fd3-098a63964b6b", "level": 0, "alterId": 0, "email": "love@v2ray.com" } ], "default": { "level": 0, "alterId": 0 }, "detour": { "to": "tag_to_detour" }, "disableInsecureEncryption": false } ``` ### Response #### Success Response (200) N/A (Configuration Structure) #### Response Example N/A (Configuration Structure) ## ClientObject ### Description Defines a client user for the VMess inbound protocol. ### Method N/A (Configuration Structure) ### Endpoint N/A (Configuration Structure) ### Parameters #### Request Body (ClientObject) - **id** (string) - Required - The user ID for VMess. Must be a valid UUID. - **level** (number) - Optional - User level, refer to local policies. - **alterId** (number) - Optional - Same meaning as in the outbound protocol above. - **email** (string) - Optional - User email address, used to distinguish traffic from different users. ### Request Example ```json { "id": "27848739-7e62-4138-9fd3-098a63964b6b", "level": 0, "alterId": 4, "email": "love@v2ray.com" } ``` ### Response #### Success Response (200) N/A (Configuration Structure) #### Response Example N/A (Configuration Structure) ## DetourObject ### Description Specifies a detour for inbound traffic. ### Method N/A (Configuration Structure) ### Endpoint N/A (Configuration Structure) ### Parameters #### Request Body (DetourObject) - **to** (string) - Required - An inbound protocol `tag`. The specified inbound protocol must be VMess. ### Request Example ```json { "to": "tag_to_detour" } ``` ### Response #### Success Response (200) N/A (Configuration Structure) #### Response Example N/A (Configuration Structure) ## DefaultObject ### Description Default configuration for clients when used with detour. ### Method N/A (Configuration Structure) ### Endpoint N/A (Configuration Structure) ### Parameters #### Request Body (DefaultObject) - **level** (number) - Optional - User level, same meaning as above. Default is `0`. - **alterId** (number) - Optional - Default `alterId` for dynamic ports. Default is `0`. ### Request Example ```json { "level": 0, "alterId": 0 } ``` ### Response #### Success Response (200) N/A (Configuration Structure) #### Response Example N/A (Configuration Structure) ```