Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 config balancer not working #3079

Open
mkmark opened this issue Jul 16, 2024 · 1 comment
Open

v5 config balancer not working #3079

mkmark opened this issue Jul 16, 2024 · 1 comment

Comments

@mkmark
Copy link
Contributor

mkmark commented Jul 16, 2024

v 5.16.1

v5 config balancer not working

See below for client configuration for minimum reproduction. Since it's using only freedom, there's no server config.

// client configuration
{
  "log": {
    "error": {
      "level": "Debug",
      "type": "Console"
    }
  },
  "router": {
    "rule": [
      {
        "balancingTag": "balancer",
        "networks": "tcp,udp"
      }
    ],
    "balancingRule": [
      {
        "tag": "balancer",
        "outboundSelector": [
          "a",
          "b"
        ]
      }
    ]
  },
  "inbounds": [
    {
      "protocol": "socks",
      "port": 1080,
      "listen": "127.0.0.1",
      "tag": "1080"
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "a"
    },
    {
      "protocol": "freedom",
      "tag": "b"
    }
  ],
  "stats": {}
}

debug log, the default route warning lines are marked red.

$ .\v2ray.exe run -c .\test_v51.json -format=jsonv5
V2Ray 5.16.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.22.2 windows/amd64)
A unified platform for anti-censorship.
2024/07/17 07:50:43 [Debug] app/log: Logger started
2024/07/17 07:50:43 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:1080
2024/07/17 07:50:43 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:1080
2024/07/17 07:50:43 [Warning] V2Ray 5.16.1 started
2024/07/17 07:50:47 [Info] [725577340] proxy/socks: TCP Connect request to tcp:www.example.com:443
- 2024/07/17 07:50:47 [Warning] [725577340] app/dispatcher: default route for tcp:www.example.com:443
2024/07/17 07:50:47 [Info] [725577340] proxy/freedom: opening connection to tcp:www.example.com:443
2024/07/17 07:50:47 [Info] [725577340] transport/internet/tcp: dialing TCP to tcp:www.example.com:443
2024/07/17 07:50:48 [Info] [3003456230] proxy/socks: TCP Connect request to tcp:www.example.com:443
- 2024/07/17 07:50:48 [Warning] [3003456230] app/dispatcher: default route for tcp:www.example.com:443
2024/07/17 07:50:48 [Info] [3003456230] proxy/freedom: opening connection to tcp:www.example.com:443
2024/07/17 07:50:48 [Info] [3003456230] transport/internet/tcp: dialing TCP to tcp:www.example.com:443
2024/07/17 07:50:51 [Debug] app/log: Logger closing

in comparison, v4 config works.

{
  "log": {
    "loglevel": "debug"
  },
  "routing": {
    "rules": [
      {
        "balancerTag": "balancer",
        "network": "tcp,udp",
        "type": "field"
      }
    ],
    "balancers": [
      {
        "tag": "balancer",
        "selector": [
          "a",
          "b"
        ]
      }
    ]
  },
  "inbounds": [
    {
      "protocol": "socks",
      "port": 1080,
      "listen": "127.0.0.1",
      "tag": "1080"
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "a"
    },
    {
      "protocol": "freedom",
      "tag": "b"
    }
  ],
  "stats": {}
}
$ .\v2ray.exe run -c .\test_v4.json
V2Ray 5.16.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.22.2 windows/amd64)
A unified platform for anti-censorship.
2024/07/17 07:46:48 [Debug] app/log: Logger started
2024/07/17 07:46:48 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:1080
2024/07/17 07:46:48 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:1080
2024/07/17 07:46:48 [Warning] V2Ray 5.16.1 started
2024/07/17 07:46:51 [Info] [1892315910] proxy/socks: TCP Connect request to tcp:www.example.com:443
2024/07/17 07:46:51 tcp:127.0.0.1:5285 accepted tcp:www.example.com:443 [a]
2024/07/17 07:46:51 [Info] [1892315910] app/dispatcher: taking detour [a] for [tcp:www.example.com:443]
2024/07/17 07:46:51 [Info] [1892315910] proxy/freedom: opening connection to tcp:www.example.com:443
2024/07/17 07:46:51 [Info] [1892315910] transport/internet/tcp: dialing TCP to tcp:www.example.com:443
2024/07/17 07:46:51 [Info] [1224250282] proxy/socks: TCP Connect request to tcp:www.example.com:443
2024/07/17 07:46:51 tcp:127.0.0.1:5287 accepted tcp:www.example.com:443 [a]
2024/07/17 07:46:51 [Info] [1224250282] app/dispatcher: taking detour [a] for [tcp:www.example.com:443]
2024/07/17 07:46:51 [Info] [1224250282] proxy/freedom: opening connection to tcp:www.example.com:443
2024/07/17 07:46:51 [Info] [1224250282] transport/internet/tcp: dialing TCP to tcp:www.example.com:443
2024/07/17 07:46:58 [Debug] app/log: Logger closing
@mkmark
Copy link
Contributor Author

mkmark commented Jul 17, 2024

The reason is here

OutboundSelector []string `protobuf:"bytes,2,rep,name=outbound_selector,json=outboundSelector,proto3" json:"outbound_selector,omitempty"`

but the docs are using camel style

https://github.com/v2fly/v2fly-github-io/blob/0d21b77f062a92c4f5fd1cdede9d88a3368712b2/docs/v5/config/router.md?plain=1#L112

it's snake and camel problem, again...

The project is using both snake and camel style variable randomly. Some of the keys seem immune to underscore and upper/lower case while some are not. How come?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant