mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-04 19:39:35 +00:00
feat(inbounds): align tunnel, tun, and hysteria UI with Xray docs
* 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
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user