alireza0 / x-ui

xray panel supporting multi-protocol multi-user expire day & traffic (Vmess & Vless & Trojan & Shadowsocks)
https://t.me/XrayUI
GNU General Public License v3.0
2.93k stars 467 forks source link

[FR] Advance Inbounds #1264

Open X-Oracle opened 3 months ago

X-Oracle commented 3 months ago

Hi @alireza0,

As you know Xray-core has a lot of options and a lot of them are not too handy for normal users, but for power users who want to use Custom configs it is a challenge to add new custom configurations, right now we can already add custom inbound in Xray advanced settings, but we will sacrifice X-UI user management,

I have been thinking of what ways we can configure this ...

1) we can add custom configs in Xray Advanced settings and in X-UI inbound settings we can have an option to add and manage users of selected inbound tag.

2) I recently got an idea from adding some outbounds through the panel new outbound manager. we can have both form and json system in inbounds too.

Anyway, I hope you got the point.

Good Luck.

pulsarice commented 3 months ago

I think you want something like this https://github.com/alireza0/x-ui/issues/1206

X-Oracle commented 3 months ago

I think you want something like this https://github.com/alireza0/x-ui/issues/1206

This is not a big deal as we can set x-ui to overwrite those specific parameters like inbound tags.

I already made a python script to do that. It is possible at api level.

We can make a new api which only gets outbound configs.

OR

We can make controls at front-end. I made a python script and it already overwrote x-ui parameters before sending.

It works great but any new inbound settings under x-ui front will undo the changes.

X-Oracle commented 3 months ago

We are talking about outbound obj not api payload .

X-ui front will make payload so it can already change x-ui parameters before sending.

It is different from json section in Outbound manager. Outbound manager sends the exact json we put.

alireza0 commented 3 months ago

Hello @X-Oracle ,

As you mentioned, in outbounds we have no databse related records per outbound and they are stored in a static json text in one database record ( as a part of xray's config template ). For each inbound, we have a record in inbounds table and will be used in many processes. Plus: they will be changed by xray-core's api by x-ui backend. Each failure or miss-configuration could be harmful and may cause several problems.

X-Oracle commented 3 months ago

HI, @alireza0,

Thanks for the reply.

As you mentioned, in outbounds we have no database related records per outbound and they are stored in a static Json text in one database record (as a part of xray's config template).

I already know. what I meant is not related to database at all cause all of the important parameters are already in database table.

the part which is important is streamSettings, settings and sniffing which has a lot of options and putting it to gui is going to be overwhelming, that's why I suggested Json tab is great. we can put the important parts in form tab for easy setup but if an option is not available, we can go to Json tab and add it manually.

Xray inbound is like bellow:

{
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1080,
      "protocol": "协议名称",
      "settings": {},
      "streamSettings": {},
      "tag": "标识",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "allocate": {
        "strategy": "always",
        "refresh": 5,
        "concurrency": 3
      }
    }
  ]
}

X-UI already covers most of inbound keys except allocate which is not an important key for penetrating wall.

1- we get xray part through "/get/:id" Api. 2- then we parse it to be like x-ui outbound and put it in Json tab. 3- the after editing and hitting save button we get the main key parameters and send them to api with "/update/:id".

Plus: they will be changed by xray-core's Api by x-ui backend.

this is not a problem as all of above changes is related to front and backend doesn't need to be changed so

Each failure or miss-configuration could be harmful and may cause several problems.

As I didn't see other x-ui backend code. I don't know what configs are being used by X-ui. but we can configure x-ui to post fill the keys which are important and may cause x-ui to fail to run (not the core).

For example, you told me before that inbound tag cannot be custom because some x-ui functions is based on that, so after user hit the save button, we can overwrite it before sending; in that case no matter what user fill or even not fill.

As for misconfiguration in x-ray part. it is users' responsibility to use Json tab (we are not enforcing Json tab just like outbound manager).

Think about it in your free time

I look forward for your reply about this,

Good Luck,

alireza0 commented 3 months ago

Please take a look at outbound's modal. When you change sth which is not supported by modal, after pushing save button it will be converted by javascript to only supported paramethers. As a solution for this problem, I thought about covering all the paramethers in JS code and implement only a part of them in GUI. It is the only way. I have to work on feasibility of this implementation. According to lack of documentation for new paramethers in xray-core, it wouldn't be easy.

X-Oracle commented 3 months ago

As a solution for this problem, I thought about covering all the paramethers in JS code and implement only a part of them in GUI. It is the only way.

In my opinion this mechanism is better and that's just what I did in my python script.

According to lack of documentation for new paramethers in xray-core, it wouldn't be easy.

The problem with official documentation is that only a few x-ray contributors and not the ones implanting the futures are writing it (seriously, why they would take their time to implant a feature and not going to write any guide on how to use it.) so it is not fully covered.