From 771bc7c8ef641bdfb171e84826df7ccc62a0ef1c Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Wed, 13 May 2026 22:44:08 +0200 Subject: [PATCH] feat(inbounds): align tunnel, tun, and hysteria UI with Xray docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tunnel: rename settings to Xray's current schema (address → rewriteAddress, port → rewritePort, network → allowedNetwork) in the model, form modal, info modal, and the bundled API inbound template; expose portMap so per-port forwarding can be configured from the panel. * tun: add the full TUN protocol form and read-only info blocks (name, mtu, gateway, dns, userLevel, autoSystemRoutingTable, autoOutboundsInterface) — previously the protocol was selectable but the form rendered blank. * hysteria: surface the stream-level version, obfs password, and udpIdleTimeout fields that the model already supported. Refs https://xtls.github.io/config/inbounds/tunnel.html Refs https://xtls.github.io/config/inbounds/tun.html Refs https://xtls.github.io/config/transports/hysteria.html --- frontend/src/models/inbound.js | 32 ++-- .../src/pages/inbounds/InboundFormModal.vue | 147 ++++++++++++++++-- .../src/pages/inbounds/InboundInfoModal.vue | 37 ++++- web/service/config.json | 2 +- 4 files changed, 190 insertions(+), 28 deletions(-) diff --git a/frontend/src/models/inbound.js b/frontend/src/models/inbound.js index fdfb4560..b2201d6f 100644 --- a/frontend/src/models/inbound.js +++ b/frontend/src/models/inbound.js @@ -2967,37 +2967,45 @@ Inbound.HysteriaSettings.Hysteria = class extends Inbound.ClientBase { Inbound.TunnelSettings = class extends Inbound.Settings { constructor( protocol, - address, - port, + rewriteAddress, + rewritePort, portMap = [], - network = 'tcp,udp', + allowedNetwork = 'tcp,udp', followRedirect = false ) { super(protocol); - this.address = address; - this.port = port; + this.rewriteAddress = rewriteAddress; + this.rewritePort = rewritePort; this.portMap = portMap; - this.network = network; + this.allowedNetwork = allowedNetwork; this.followRedirect = followRedirect; } + addPortMap(port = '', target = '') { + this.portMap.push({ name: port, value: target }); + } + + removePortMap(index) { + this.portMap.splice(index, 1); + } + static fromJson(json = {}) { return new Inbound.TunnelSettings( Protocols.TUNNEL, - json.address, - json.port, + json.rewriteAddress, + json.rewritePort, XrayCommonClass.toHeaders(json.portMap), - json.network, + json.allowedNetwork, json.followRedirect, ); } toJson() { return { - address: this.address, - port: this.port, + rewriteAddress: this.rewriteAddress, + rewritePort: this.rewritePort, portMap: XrayCommonClass.toV2Headers(this.portMap, false), - network: this.network, + allowedNetwork: this.allowedNetwork, followRedirect: this.followRedirect, }; } diff --git a/frontend/src/pages/inbounds/InboundFormModal.vue b/frontend/src/pages/inbounds/InboundFormModal.vue index 2c814dc2..4d09f63c 100644 --- a/frontend/src/pages/inbounds/InboundFormModal.vue +++ b/frontend/src/pages/inbounds/InboundFormModal.vue @@ -679,10 +679,7 @@ watch( - - + - - + +