mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-20 05:52:24 +00:00
[xray outbound] add mux
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
parent
5b87b12535
commit
f8be7a7649
2 changed files with 52 additions and 2 deletions
|
@ -466,18 +466,49 @@ class StreamSettings extends CommonClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Mux extends CommonClass {
|
||||||
|
constructor(enabled = false, concurrency = 8, xudpConcurrency = 16, xudpProxyUDP443 = "reject") {
|
||||||
|
super();
|
||||||
|
this.enabled = enabled;
|
||||||
|
this.concurrency = concurrency;
|
||||||
|
this.xudpConcurrency = xudpConcurrency;
|
||||||
|
this.xudpProxyUDP443 = xudpProxyUDP443;
|
||||||
|
}
|
||||||
|
|
||||||
|
static fromJson(json = {}) {
|
||||||
|
if (Object.keys(json).length === 0) return undefined;
|
||||||
|
return new SockoptStreamSettings(
|
||||||
|
json.enabled,
|
||||||
|
json.concurrency,
|
||||||
|
json.xudpConcurrency,
|
||||||
|
json.xudpProxyUDP443,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
toJson() {
|
||||||
|
return {
|
||||||
|
enabled: this.enabled,
|
||||||
|
concurrency: this.concurrency,
|
||||||
|
xudpConcurrency: this.xudpConcurrency,
|
||||||
|
xudpProxyUDP443: this.xudpProxyUDP443,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Outbound extends CommonClass {
|
class Outbound extends CommonClass {
|
||||||
constructor(
|
constructor(
|
||||||
tag='',
|
tag='',
|
||||||
protocol=Protocols.VMess,
|
protocol=Protocols.VMess,
|
||||||
settings=null,
|
settings=null,
|
||||||
streamSettings = new StreamSettings(),
|
streamSettings = new StreamSettings(),
|
||||||
|
mux = new Mux(),
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this._protocol = protocol;
|
this._protocol = protocol;
|
||||||
this.settings = settings == null ? Outbound.Settings.getSettings(protocol) : settings;
|
this.settings = settings == null ? Outbound.Settings.getSettings(protocol) : settings;
|
||||||
this.stream = streamSettings;
|
this.stream = streamSettings;
|
||||||
|
this.mux = mux;
|
||||||
}
|
}
|
||||||
|
|
||||||
get protocol() {
|
get protocol() {
|
||||||
|
@ -542,6 +573,7 @@ class Outbound extends CommonClass {
|
||||||
json.protocol,
|
json.protocol,
|
||||||
Outbound.Settings.fromJson(json.protocol, json.settings),
|
Outbound.Settings.fromJson(json.protocol, json.settings),
|
||||||
StreamSettings.fromJson(json.streamSettings),
|
StreamSettings.fromJson(json.streamSettings),
|
||||||
|
Mux.fromJson(json.mux),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,6 +583,7 @@ class Outbound extends CommonClass {
|
||||||
protocol: this.protocol,
|
protocol: this.protocol,
|
||||||
settings: this.settings instanceof CommonClass ? this.settings.toJson() : this.settings,
|
settings: this.settings instanceof CommonClass ? this.settings.toJson() : this.settings,
|
||||||
streamSettings: this.canEnableStream() ? this.stream.toJson() : undefined,
|
streamSettings: this.canEnableStream() ? this.stream.toJson() : undefined,
|
||||||
|
mux: this.mux?.enabled ? this.mux : undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +641,6 @@ class Outbound extends CommonClass {
|
||||||
json.allowInsecure);
|
json.allowInsecure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new Outbound(json.ps, Protocols.VMess, new Outbound.VmessSettings(json.add, json.port, json.id), stream);
|
return new Outbound(json.ps, Protocols.VMess, new Outbound.VmessSettings(json.add, json.port, json.id), stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -421,6 +421,24 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- mux settings -->
|
||||||
|
<a-form-item label="Mux">
|
||||||
|
<a-switch v-model="outbound.mux.enabled"></a-switch>
|
||||||
|
</a-form-item>
|
||||||
|
<template v-if="outbound.mux.enabled">
|
||||||
|
<a-form-item label="Concurrency">
|
||||||
|
<a-input-number v-model="outbound.mux.concurrency" :min="-1" :max="1024"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="xudp Concurrency">
|
||||||
|
<a-input-number v-model="outbound.mux.xudpConcurrency" :min="-1" :max="1024"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="xudp UDP 443">
|
||||||
|
<a-select v-model="outbound.mux.xudpProxyUDP443" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option v-for="c in ['reject', 'allow', 'skip']" :value="c">[[ c ]]</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="2" tab="JSON" force-render="true">
|
<a-tab-pane key="2" tab="JSON" force-render="true">
|
||||||
|
|
Loading…
Reference in a new issue