NidukaAkalanka / x-ui-english

English Version of X-UI, A Multi-protocol & Multi-user Xray Panel with a Web UI and a TG Bot
GNU General Public License v3.0
725 stars 238 forks source link

I cannot set up DNS in the X-UI configuration #101

Open Nightmarest opened 1 year ago

Nightmarest commented 1 year ago

Welcome

Description of the problem,screencshot would be good

I cannot set up this configuration. I check the official V2RAY documentation, but the config.json installed from your panel, after any "dns: null" changes and further panel restart, just resets the configuration file back

config:


  "dns": {
    "hosts": {
      "baidu.com": "127.0.0.1"
    },
    "servers": [
      {
        "address": "127.0.0.1",
        "port": 53,
        "domains": [
          "geosite:cn"
        ]
      },
      "8.8.8.8",
      "8.8.4.4",
      "localhost"
    ],
    "clientIp": "0.0.0.0",
    "tag": "dns_inbound"
  },

Version of x-ui

```console $ x-ui version # Paste output here x-ui[1407474]: 2023/01/10 16:05:54 x-ui-english 0.2.1.2 ```

x-ui log or xray log

```console Jan 10 16:05:54 pinguin2.co systemd[1]: x-ui.service: Consumed 4.858s CPU time. Jan 10 16:05:54 pinguin2.co systemd[1]: Started x-ui Service. Jan 10 16:05:54 pinguin2.co x-ui[1407474]: 2023/01/10 16:05:54 x-ui-english 0.2.1.2 Jan 10 16:05:54 pinguin2.co x-ui[1407474]: 2023/01/10 16:05:54 INFO - web server run http on [::]:18770 ```
NidukaAkalanka commented 1 year ago

Hi there @Nightmarest !

Please refer the following code snippet and customize it according to your dns severs.

"dns": {
    "hosts": {
      "dns.google": [
        "8.8.8.8",
        "8.8.4.4"
      ],
      "dns.pub": "119.29.29.29",
      "dns.alidns.com": "223.5.5.5"
    },"

Use it after the api segment

Nightmarest commented 1 year ago

Okay. I am try this later

Nightmarest commented 1 year ago

it does not work

It prevents you from making absolutely NO changes to the file. Even if I want to change the connection settings somewhere, it will roll back everything again

P.S. - Check file json.go

MrAliSalehi commented 1 year ago

I'm facing the same issue trying to use pi-hole and x-ui together

SayidHosseini commented 8 months ago

@NidukaAkalanka @Nightmarest @MrAliSalehi Apparently the config.json file is overridden with the contents of the sqlite database at /etc/x-ui/x-ui.db.

I tried modifying the database directly by installing (apt install sqlite3 on debian based distros) and editing the db:

sqlite3 /etc/x-ui/x-ui.db

UPDATE settings SET value = '
{
HERE PASTE CONTENTS OF CONFIG.JSON
}'
WHERE key = 'xrayTemplateConfig';

I've seen the file change after restarting the x-ui; however the clients don't seem to be using the DNS servers.