v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
29.28k stars 4.63k forks source link

outboundSelector and geoDomain works abnormally in V5 configuration file #2459

Closed luciferliu1 closed 1 year ago

luciferliu1 commented 1 year ago

What version of V2Ray are you using?

V2ray 5.3.0

What's your scenario of using V2Ray?

searching with google in browsers via ShadowSocks/VMESS/Trojan proxy

What problems have you encountered?

When I was trying to set up the V5 configuration file, I found two abnormal phenomena as follows.

  1. The name of outboundSelector attribute in the balancingRule should be referred as outbound_selector. Otherwise the balancingRule doesn't work, and the default outbound (the first one) will be selected.
  2. Code and domain can not be inside one GeoDomain object. I have to separate them into two GeoDomain objects, otherwise the routing rule doesn't work as expected, and only one rule (code or domain) will work.

What's your expectation?

outboundSelector should be right. Code and domain can be inside one GeoDomain object simultaneously.

Please attach your configuration here

Client configuration:

// Please attach your client configuration here.
//V5 configuration that not works
{
  "log": {
    "access": {
      "level": "Warning"
    },
    "error": {
      "level": "Warning"
    }
  },
  "inbounds": [{
    "port": "1080",
    "listen": "127.0.0.1",
    "tag": "socks-inbound",
    "protocol": "socks",
    "settings": {
      "udpEnabled": true
    },
    "sniffing": {
      "enabled": true, 
      "destOverride": ["http", "tls"]
    }
  },
  {
    "port": "1081",
    "listen": "127.0.0.1",
    "tag": "socks-in-tor",
    "protocol": "socks",
    "settings": {
        "udpEnabled": true
      }, 
    "sniffing": {
      "enabled": false, 
      "destOverride": ["http", "tls"]
      }
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {
    },
    "tag": "direct"
  },
  {
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  },
  {
    "tag": "proxy-vps-amd1",
    "protocol": "shadowsocks",
    "settings": {
      "address": "xxxxx",
      "port": 443,
      "method": "AES_256_GCM",
      "password": "xxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
        "path": "/xxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  },
  {
    "tag": "proxy-vps-amd2",
    "protocol": "vmess",
    "settings": {
      "address": "xxxxxxx",
      "port": 443,
      "uuid": "xxxxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
      "path": "/xxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  },
  {
    "tag": "proxy-vps-arm1",
    "protocol": "trojan",
    "settings": {
      "address": "xxxxxxxx",
      "port": 443,
      "password": "xxxxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
      "path": "/xxxxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  }],
  "router": {
    "domainStrategy": "AsIs", 
    "rule":[
        {
          "protocol": [
            "bittorrent"
          ],
          "tag": "direct"
        },
        {
          "inboundTag": [
            "socks-in-tor"
          ],
          "balancingTag": "balancer"
        },
        {
          "domainMatcher": "mph",
          "geoDomain": [
            {
              "domain":[
                {
                  "type": "RootDomain",
                  "value": "openai.com" 
                }
              ]
            }
          ],
          "tag": "proxy-vps-amd2"
        },
        {
          "domainMatcher": "mph",
          "geoDomain": [
            {
              "code": "geolocation-!cn",
              "domain":[
                { "type": "RootDomain", "value": "pastedownload.com"},
                { "type": "RootDomain", "value": "yiyeting.com"},
                { "type": "RootDomain", "value": "olevod.com"},
                {
                  "type": "RootDomain",
                  "value": "olelive.com" 
                }
              ]
            }
          ],
          "balancingTag": "balancer"
        }
    ],
    "balancingRule":[
      {
        "tag": "balancer",
        "outboundSelector":["proxy"], 
        "strategy": "random"
      }
    ]
  }
}

//V5 configuration that does work
{
  "log": {
    "access": {
      "level": "Warning"
    },
    "error": {
      "level": "Warning"
    }
  },
  "inbounds": [{
    "port": "1080",
    "listen": "127.0.0.1",
    "tag": "socks-inbound",
    "protocol": "socks",
    "settings": {
      "udpEnabled": true
    },
    "sniffing": {
      "enabled": true, 
      "destOverride": ["http", "tls"]
    }
  },
  {
    "port": "1081",
    "listen": "127.0.0.1",
    "tag": "socks-in-tor",
    "protocol": "socks",
    "settings": {
        "udpEnabled": true
      }, 
    "sniffing": {
      "enabled": false, 
      "destOverride": ["http", "tls"]
      }
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {
    },
    "tag": "direct"
  },
  {
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  },
  {
    "tag": "proxy-vps-amd1",
    "protocol": "shadowsocks",
    "settings": {
      "address": "xxxxx",
      "port": 443,
      "method": "AES_256_GCM",
      "password": "xxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
        "path": "/xxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  },
  {
    "tag": "proxy-vps-amd2",
    "protocol": "vmess",
    "settings": {
      "address": "xxxxxxx",
      "port": 443,
      "uuid": "xxxxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
      "path": "/xxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  },
  {
    "tag": "proxy-vps-arm1",
    "protocol": "trojan",
    "settings": {
      "address": "xxxxxxxx",
      "port": 443,
      "password": "xxxxxxxx"
    },
    "streamSettings": {
      "transport": "ws",
      "transportSettings":{
      "path": "/xxxxxxxx"
      },
      "security":"utls",
      "securitySettings":{
        "imitate": "safari_16_0",
        "tlsConfig": {
        }
      }
    }
  }],
  "router": {
    "domainStrategy": "AsIs", 
    "rule":[
        {
          "protocol": [
            "bittorrent"
          ],
          "tag": "direct"
        },
        {
          "inboundTag": [
            "socks-in-tor"
          ],
          "balancingTag": "balancer"
        },
        {
          "domainMatcher": "mph",
          "geoDomain": [
            {
              "domain":[
                {
                  "type": "RootDomain",
                  "value": "openai.com" 
                }
              ]
            }
          ],
          "tag": "proxy-vps-amd2"
        },
        {
          "domainMatcher": "mph",
          "geoDomain": [
            {
              "code": "geolocation-!cn" 
            },
            {
              "domain":[
                { "type": "RootDomain", "value": "pastedownload.com"},
                { "type": "RootDomain", "value": "yiyeting.com"},
                { "type": "RootDomain", "value": "olevod.com"},
                {
                  "type": "RootDomain",
                  "value": "olelive.com" 
                }
              ]
            }
          ],
          "balancingTag": "balancer"
        }
    ],
    "balancingRule":[
      {
        "tag": "balancer",
        "outbound_selector":["proxy"], 
        "strategy": "random"
      }
    ]
  }
}
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days