Skip to content

Automatic client-side balancing #517

Open

Description

@dev-kick

Hello developers!

I would really like to implement automatic client-side balancing, since it is extremely convenient for automatically selecting the server with the best latency/ping for the user.

However, currently this is difficult to achieve because:

  1. Generated outbounds always use a fixed tag:

"tag": "proxy"

This makes it impossible to use Xray balancers properly, because each outbound must have a unique tag.

  1. When adding multiple custom outbounds in client templates, the vnext.users section is not populated automatically with user UUID, which makes such configs unusable.

As an example, this is the type of balancing configuration I would like to build:

{
  "outbounds": [
    {
      "tag": "node-1",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "1.1.1.1",
            "port": 443,
            "users": [
              {
                "id": "UUID",
                "encryption": "none",
                "flow": "xtls-rprx-vision"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "serverName": "example.com",
          "publicKey": "PUBLIC_KEY",
          "shortId": "SHORT_ID",
          "fingerprint": "chrome"
        }
      }
    },
    {
      "tag": "node-2",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "2.2.2.2",
            "port": 443,
            "users": [
              {
                "id": "UUID",
                "encryption": "none",
                "flow": "xtls-rprx-vision"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "serverName": "example.com",
          "publicKey": "PUBLIC_KEY",
          "shortId": "SHORT_ID",
          "fingerprint": "chrome"
        }
      }
    }
  ],
  "routing": {
    "balancers": [
      {
        "tag": "proxy-balance",
        "selector": [
          "node-1",
          "node-2"
        ],
        "strategy": {
          "type": "roundRobin"
        }
      }
    ],
    "rules": [
      {
        "type": "field",
        "network": "tcp,udp",
        "balancerTag": "proxy-balance"
      }
    ]
  }
}

Would it be possible to implement automatic generation of unique outbound tags for balancing purposes?

Or alternatively, allow vnext.users to be used in custom templates, for example:

"users": [
  {
    "id": "{{uuid}}",
    "encryption": "none",
    "flow": "xtls-rprx-vision"
  }
]

This would make it possible to build advanced client-side balancing configurations using Xray balancers, observatory, and leastPing.

Thank you!

Activity

  1. added
    enhancement
    on May 22, 2026
  2. x1cked commented on Sep 3, 2026

    @x1cked

    +1 I need

  3. fleizin007 commented on Nov 6, 2026

    @fleizin007

    +++

  4. petunia1381 commented on Nov 17, 2026

    @petunia1381

    +++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions