[GH-ISSUE #1826] Observatory object can't be added (to use leastPing strategy for balancer) #1243

Closed
opened 2026-10-31 20:17:30 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @pulsarice on GitHub (Feb 16, 2024).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/1826

Welcome

  • Yes, I'm using the latest major release. Only such installations are supported.
  • Yes, I'm using the supported system. Only such systems are supported.
  • Yes, I have read all WIKI document,nothing can help me in my problem.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, log, etc).

Description of the problem,screencshot would be good

Xray has a feature (borrowed from v2ray project) to ping outbounds in a set interval and use the best one via balancer routing rules.
I have tested it locally and it works. (by manually editing config.json and running xray)
It needs ObservatoryObject to be added to config.json. but when I add this to xray config in 3x-ui, it's not added to "/usr/local/x-ui/bin/config.json", therefore this feature does not work.
Please fix this

observatory settings in config.json:

{
    "log": {},
    "api": {},
    "dns": {},
    "routing": {},
    "policy": {},
    "inbounds": [],
    "outbounds": [],
    "transport": {},
    "stats": {},
    "reverse": {},
    "fakedns": [],
    "observatory": {}
}

The format of observatory is like this:

  "observatory": {
    "subjectSelector": [
          "server1",
          "server2"
    ],
    "probeURL": "https://www.google.com/generate_204",
    "probeInterval": "1m"
  }

and the balancer will be like this:

  "routing": {
    "balancers": [
      {
        "tag": "balancer",
        "selector": [
          "server1",
          "server2"
        ],
        "strategy": {
          "type": "leastPing"
        }
      }
    ],
    "rules": []
  }

@MHSanaei @alireza0

Version of 3x-ui

# Paste here

x-ui log reports or xray log

# paste log here
Originally created by @pulsarice on GitHub (Feb 16, 2024). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/1826 ### Welcome - [X] Yes, I'm using the latest major release. Only such installations are supported. - [X] Yes, I'm using the supported system. Only such systems are supported. - [X] Yes, I have read all WIKI document,nothing can help me in my problem. - [X] Yes, I've searched similar issues on GitHub and didn't find any. - [X] Yes, I've included all information below (version, config, log, etc). ### Description of the problem,screencshot would be good Xray has a feature (borrowed from v2ray project) to ping outbounds in a set interval and use the best one via balancer routing rules. I have tested it locally and it works. (by manually editing config.json and running xray) It needs ObservatoryObject to be added to config.json. but when I add this to xray config in 3x-ui, it's not added to "/usr/local/x-ui/bin/config.json", therefore this feature does not work. Please fix this observatory settings in config.json: ``` { "log": {}, "api": {}, "dns": {}, "routing": {}, "policy": {}, "inbounds": [], "outbounds": [], "transport": {}, "stats": {}, "reverse": {}, "fakedns": [], "observatory": {} } ``` The format of observatory is like this: ``` "observatory": { "subjectSelector": [ "server1", "server2" ], "probeURL": "https://www.google.com/generate_204", "probeInterval": "1m" } ``` and the balancer will be like this: ``` "routing": { "balancers": [ { "tag": "balancer", "selector": [ "server1", "server2" ], "strategy": { "type": "leastPing" } } ], "rules": [] } ``` @MHSanaei @alireza0 ### Version of 3x-ui <details> ```console # Paste here ``` </details> ### x-ui log reports or xray log <details> ```console # paste log here ``` </details>
Author
Owner

@ErfanTech commented on GitHub (Feb 20, 2024):

Which version of xray-core are you using?
Please also consider the new update that is merged to xray recently.
github.com/XTLS/Xray-core@fa5d7a255b

<!-- gh-comment-id:1953374829 --> @ErfanTech commented on GitHub (Feb 20, 2024): Which version of xray-core are you using? Please also consider the new update that is merged to xray recently. https://github.com/XTLS/Xray-core/commit/fa5d7a255b95215916d93bf371aaea55ea758381
Author
Owner

@ErfanTech commented on GitHub (Feb 20, 2024):

are you using it for a simple outbound tunnel or reverse tunnel?

<!-- gh-comment-id:1953386602 --> @ErfanTech commented on GitHub (Feb 20, 2024): are you using it for a simple outbound tunnel or reverse tunnel?
Author
Owner

@pulsarice commented on GitHub (Feb 20, 2024):

Which version of xray-core are you using?

v1.8.7

Please also consider the new update that is merged to xray recently. XTLS/Xray-core@fa5d7a2

That's interesting. So other balancer strategies are being added. Like leastLoad!

are you using it for a simple outbound tunnel or reverse tunnel?

It worked for both. But for reverse portal, I had to manually add an outbound per portal connection for the Selector to work.
Currently because of Observatory, I can't use leastPing, but Roundrobin and Random are working.

  {
    "tag": "server-1",
    "protocol": "freedom",
    "proxySettings": {
      "tag": "portal-1"
    }
  },
  {
    "tag": "server-2",
    "protocol": "freedom",
    "proxySettings": {
      "tag": "portal-2"
    }
  },
  {
    "tag": "server-3",
    "protocol": "freedom",
    "proxySettings": {
      "tag": "portal-3"
    }
  },
<!-- gh-comment-id:1953576341 --> @pulsarice commented on GitHub (Feb 20, 2024): > Which version of xray-core are you using? v1.8.7 >Please also consider the new update that is merged to xray recently. [XTLS/Xray-core@fa5d7a2](https://github.com/XTLS/Xray-core/commit/fa5d7a255b95215916d93bf371aaea55ea758381) That's interesting. So other balancer strategies are being added. Like leastLoad! > are you using it for a simple outbound tunnel or reverse tunnel? It worked for both. But for reverse portal, I had to manually add an outbound per portal connection for the Selector to work. Currently because of Observatory, I can't use leastPing, but Roundrobin and Random are working. ``` { "tag": "server-1", "protocol": "freedom", "proxySettings": { "tag": "portal-1" } }, { "tag": "server-2", "protocol": "freedom", "proxySettings": { "tag": "portal-2" } }, { "tag": "server-3", "protocol": "freedom", "proxySettings": { "tag": "portal-3" } }, ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#1243
No description provided.