The panel binds its web and subscription sockets before Xray starts, so
a local inbound on either leaves Xray unable to listen at all. Nothing
compared an inbound with those two sockets. Restoring a backup with this
machine's settings kept could therefore import a tunnel on the panel's
own port: the database was swapped first, and the failure only showed
when Xray would not start.
The rule is now stated once and every writer goes through it:
- A restore reads the backup's inbounds and the settings that will be in
force afterwards (this machine's for kept keys, the backup's for the
rest, XUI_PORT over both) and is refused before Xray is stopped or the
database touched. All three paths do this: a SQLite file, a SQLite
file imported into PostgreSQL, and a pg_dump archive, whose two tables
pg_restore prints as a data script without a connection. Only enabled
rows refuse a restore, so a backup holding a disabled leftover stays
usable; enabling that row later is refused by the port check.
- Adding, editing and enabling an inbound run the same check.
- Saving panel settings, and x-ui setting -port / -listenIP, refuse to
move a panel socket onto an inbound. A collision that already exists
does not block later saves. The x-ui menu no longer reports a refused
port or listen address as set.
One existing test put its inbound on 2053, the default panel port, for
no reason of its own; it now uses 2083.
Not covered: x-ui setting -reset and a changed XUI_PORT can still put
the panel on an inbound's port.
The PostgreSQL paths were run against PostgreSQL 18 with its pg_dump and
pg_restore; CI skips those tests. make node-e2e passes.
Closes#7115
Subscriptions build an inbound's links from its Host rows, and those rows are
imported from streamSettings.externalProxy only when the inbound is added. An
update that moved the external proxy returned 200, but every subscription kept
handing out the old address, port and security.
An update now re-syncs only the externalProxy entries it changed onto hosts that
are still exactly as imported. Unchanged entries are set aside first, so a host
the admin edited, disabled, deleted or shared is never re-imported next to the
admin's version, and a stream without the externalProxy key leaves hosts alone.