mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-12 21:20:07 +00:00
dokodemo-door, socks renamed to mixed, tunnel
This commit is contained in:
parent
fe9f0d1d0e
commit
7dc52e9a53
13 changed files with 48 additions and 48 deletions
|
@ -12,11 +12,11 @@ type Protocol string
|
||||||
const (
|
const (
|
||||||
VMESS Protocol = "vmess"
|
VMESS Protocol = "vmess"
|
||||||
VLESS Protocol = "vless"
|
VLESS Protocol = "vless"
|
||||||
DOKODEMO Protocol = "dokodemo-door"
|
Tunnel Protocol = "tunnel"
|
||||||
HTTP Protocol = "http"
|
HTTP Protocol = "http"
|
||||||
Trojan Protocol = "trojan"
|
Trojan Protocol = "trojan"
|
||||||
Shadowsocks Protocol = "shadowsocks"
|
Shadowsocks Protocol = "shadowsocks"
|
||||||
Socks Protocol = "socks"
|
Mixed Protocol = "mixed"
|
||||||
WireGuard Protocol = "wireguard"
|
WireGuard Protocol = "wireguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"port": 10808,
|
"port": 10808,
|
||||||
"protocol": "socks",
|
"protocol": "mixed",
|
||||||
"settings": {
|
"settings": {
|
||||||
"auth": "noauth",
|
"auth": "noauth",
|
||||||
"udp": true,
|
"udp": true,
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
],
|
],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"tag": "socks"
|
"tag": "mixed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"port": 10809,
|
"port": 10809,
|
||||||
|
|
|
@ -49,8 +49,8 @@ class DBInbound {
|
||||||
return this.protocol === Protocols.SHADOWSOCKS;
|
return this.protocol === Protocols.SHADOWSOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isSocks() {
|
get isMixed() {
|
||||||
return this.protocol === Protocols.SOCKS;
|
return this.protocol === Protocols.MIXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isHTTP() {
|
get isHTTP() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ const Protocols = {
|
||||||
VLESS: 'vless',
|
VLESS: 'vless',
|
||||||
TROJAN: 'trojan',
|
TROJAN: 'trojan',
|
||||||
SHADOWSOCKS: 'shadowsocks',
|
SHADOWSOCKS: 'shadowsocks',
|
||||||
DOKODEMO: 'dokodemo-door',
|
TUNNEL: 'tunnel',
|
||||||
SOCKS: 'socks',
|
MIXED: 'mixed',
|
||||||
HTTP: 'http',
|
HTTP: 'http',
|
||||||
WIREGUARD: 'wireguard',
|
WIREGUARD: 'wireguard',
|
||||||
};
|
};
|
||||||
|
@ -1712,8 +1712,8 @@ Inbound.Settings = class extends XrayCommonClass {
|
||||||
case Protocols.VLESS: return new Inbound.VLESSSettings(protocol);
|
case Protocols.VLESS: return new Inbound.VLESSSettings(protocol);
|
||||||
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
|
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
|
||||||
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
|
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
|
||||||
case Protocols.DOKODEMO: return new Inbound.DokodemoSettings(protocol);
|
case Protocols.TUNNEL: return new Inbound.TunnelSettings(protocol);
|
||||||
case Protocols.SOCKS: return new Inbound.SocksSettings(protocol);
|
case Protocols.MIXED: return new Inbound.MixedSettings(protocol);
|
||||||
case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
|
case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
|
||||||
case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol);
|
case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol);
|
||||||
default: return null;
|
default: return null;
|
||||||
|
@ -1726,8 +1726,8 @@ Inbound.Settings = class extends XrayCommonClass {
|
||||||
case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json);
|
case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json);
|
||||||
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
|
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
|
||||||
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
|
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
|
||||||
case Protocols.DOKODEMO: return Inbound.DokodemoSettings.fromJson(json);
|
case Protocols.TUNNEL: return Inbound.TunnelSettings.fromJson(json);
|
||||||
case Protocols.SOCKS: return Inbound.SocksSettings.fromJson(json);
|
case Protocols.MIXED: return Inbound.MixedSettings.fromJson(json);
|
||||||
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
|
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
|
||||||
case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json);
|
case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json);
|
||||||
default: return null;
|
default: return null;
|
||||||
|
@ -2327,7 +2327,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.DokodemoSettings = class extends Inbound.Settings {
|
Inbound.TunnelSettings = class extends Inbound.Settings {
|
||||||
constructor(
|
constructor(
|
||||||
protocol,
|
protocol,
|
||||||
address,
|
address,
|
||||||
|
@ -2345,8 +2345,8 @@ Inbound.DokodemoSettings = class extends Inbound.Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new Inbound.DokodemoSettings(
|
return new Inbound.TunnelSettings(
|
||||||
Protocols.DOKODEMO,
|
Protocols.TUNNEL,
|
||||||
json.address,
|
json.address,
|
||||||
json.port,
|
json.port,
|
||||||
XrayCommonClass.toHeaders(json.portMap),
|
XrayCommonClass.toHeaders(json.portMap),
|
||||||
|
@ -2366,8 +2366,8 @@ Inbound.DokodemoSettings = class extends Inbound.Settings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.SocksSettings = class extends Inbound.Settings {
|
Inbound.MixedSettings = class extends Inbound.Settings {
|
||||||
constructor(protocol, auth = 'password', accounts = [new Inbound.SocksSettings.SocksAccount()], udp = false, ip = '127.0.0.1') {
|
constructor(protocol, auth = 'password', accounts = [new Inbound.MixedSettings.SocksAccount()], udp = false, ip = '127.0.0.1') {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
this.accounts = accounts;
|
this.accounts = accounts;
|
||||||
|
@ -2387,11 +2387,11 @@ Inbound.SocksSettings = class extends Inbound.Settings {
|
||||||
let accounts;
|
let accounts;
|
||||||
if (json.auth === 'password') {
|
if (json.auth === 'password') {
|
||||||
accounts = json.accounts.map(
|
accounts = json.accounts.map(
|
||||||
account => Inbound.SocksSettings.SocksAccount.fromJson(account)
|
account => Inbound.MixedSettings.SocksAccount.fromJson(account)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return new Inbound.SocksSettings(
|
return new Inbound.MixedSettings(
|
||||||
Protocols.SOCKS,
|
Protocols.MIXED,
|
||||||
json.auth,
|
json.auth,
|
||||||
accounts,
|
accounts,
|
||||||
json.udp,
|
json.udp,
|
||||||
|
@ -2408,7 +2408,7 @@ Inbound.SocksSettings = class extends Inbound.Settings {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Inbound.SocksSettings.SocksAccount = class extends XrayCommonClass {
|
Inbound.MixedSettings.SocksAccount = class extends XrayCommonClass {
|
||||||
constructor(user = RandomUtil.randomSeq(10), pass = RandomUtil.randomSeq(10)) {
|
constructor(user = RandomUtil.randomSeq(10), pass = RandomUtil.randomSeq(10)) {
|
||||||
super();
|
super();
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -2416,7 +2416,7 @@ Inbound.SocksSettings.SocksAccount = class extends XrayCommonClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new Inbound.SocksSettings.SocksAccount(json.user, json.pass);
|
return new Inbound.MixedSettings.SocksAccount(json.user, json.pass);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ const Protocols = {
|
||||||
VLESS: "vless",
|
VLESS: "vless",
|
||||||
Trojan: "trojan",
|
Trojan: "trojan",
|
||||||
Shadowsocks: "shadowsocks",
|
Shadowsocks: "shadowsocks",
|
||||||
Socks: "socks",
|
Mixed: "mixed",
|
||||||
HTTP: "http",
|
HTTP: "http",
|
||||||
Wireguard: "wireguard"
|
Wireguard: "wireguard"
|
||||||
};
|
};
|
||||||
|
@ -643,7 +643,7 @@ class Outbound extends CommonClass {
|
||||||
Protocols.Trojan,
|
Protocols.Trojan,
|
||||||
Protocols.Shadowsocks,
|
Protocols.Shadowsocks,
|
||||||
Protocols.HTTP,
|
Protocols.HTTP,
|
||||||
Protocols.Socks
|
Protocols.Mixed
|
||||||
].includes(this.protocol);
|
].includes(this.protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ class Outbound extends CommonClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
hasServers() {
|
hasServers() {
|
||||||
return [Protocols.Trojan, Protocols.Shadowsocks, Protocols.Socks, Protocols.HTTP].includes(this.protocol);
|
return [Protocols.Trojan, Protocols.Shadowsocks, Protocols.Mixed, Protocols.HTTP].includes(this.protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasAddressPort() {
|
hasAddressPort() {
|
||||||
|
@ -662,13 +662,13 @@ class Outbound extends CommonClass {
|
||||||
Protocols.VLESS,
|
Protocols.VLESS,
|
||||||
Protocols.Trojan,
|
Protocols.Trojan,
|
||||||
Protocols.Shadowsocks,
|
Protocols.Shadowsocks,
|
||||||
Protocols.Socks,
|
Protocols.Mixed,
|
||||||
Protocols.HTTP
|
Protocols.HTTP
|
||||||
].includes(this.protocol);
|
].includes(this.protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasUsername() {
|
hasUsername() {
|
||||||
return [Protocols.Socks, Protocols.HTTP].includes(this.protocol);
|
return [Protocols.Mixed, Protocols.HTTP].includes(this.protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
|
@ -847,7 +847,7 @@ Outbound.Settings = class extends CommonClass {
|
||||||
case Protocols.VLESS: return new Outbound.VLESSSettings();
|
case Protocols.VLESS: return new Outbound.VLESSSettings();
|
||||||
case Protocols.Trojan: return new Outbound.TrojanSettings();
|
case Protocols.Trojan: return new Outbound.TrojanSettings();
|
||||||
case Protocols.Shadowsocks: return new Outbound.ShadowsocksSettings();
|
case Protocols.Shadowsocks: return new Outbound.ShadowsocksSettings();
|
||||||
case Protocols.Socks: return new Outbound.SocksSettings();
|
case Protocols.Mixed: return new Outbound.MixedSettings();
|
||||||
case Protocols.HTTP: return new Outbound.HttpSettings();
|
case Protocols.HTTP: return new Outbound.HttpSettings();
|
||||||
case Protocols.Wireguard: return new Outbound.WireguardSettings();
|
case Protocols.Wireguard: return new Outbound.WireguardSettings();
|
||||||
default: return null;
|
default: return null;
|
||||||
|
@ -863,7 +863,7 @@ Outbound.Settings = class extends CommonClass {
|
||||||
case Protocols.VLESS: return Outbound.VLESSSettings.fromJson(json);
|
case Protocols.VLESS: return Outbound.VLESSSettings.fromJson(json);
|
||||||
case Protocols.Trojan: return Outbound.TrojanSettings.fromJson(json);
|
case Protocols.Trojan: return Outbound.TrojanSettings.fromJson(json);
|
||||||
case Protocols.Shadowsocks: return Outbound.ShadowsocksSettings.fromJson(json);
|
case Protocols.Shadowsocks: return Outbound.ShadowsocksSettings.fromJson(json);
|
||||||
case Protocols.Socks: return Outbound.SocksSettings.fromJson(json);
|
case Protocols.Mixed: return Outbound.MixedSettings.fromJson(json);
|
||||||
case Protocols.HTTP: return Outbound.HttpSettings.fromJson(json);
|
case Protocols.HTTP: return Outbound.HttpSettings.fromJson(json);
|
||||||
case Protocols.Wireguard: return Outbound.WireguardSettings.fromJson(json);
|
case Protocols.Wireguard: return Outbound.WireguardSettings.fromJson(json);
|
||||||
default: return null;
|
default: return null;
|
||||||
|
@ -1141,7 +1141,7 @@ Outbound.ShadowsocksSettings = class extends CommonClass {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Outbound.SocksSettings = class extends CommonClass {
|
Outbound.MixedSettings = class extends CommonClass {
|
||||||
constructor(address, port, user, pass) {
|
constructor(address, port, user, pass) {
|
||||||
super();
|
super();
|
||||||
this.address = address;
|
this.address = address;
|
||||||
|
@ -1153,7 +1153,7 @@ Outbound.SocksSettings = class extends CommonClass {
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
let servers = json.servers;
|
let servers = json.servers;
|
||||||
if (ObjectUtil.isArrEmpty(servers)) servers = [{ users: [{}] }];
|
if (ObjectUtil.isArrEmpty(servers)) servers = [{ users: [{}] }];
|
||||||
return new Outbound.SocksSettings(
|
return new Outbound.MixedSettings(
|
||||||
servers[0].address,
|
servers[0].address,
|
||||||
servers[0].port,
|
servers[0].port,
|
||||||
ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user,
|
ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user,
|
||||||
|
|
|
@ -83,14 +83,14 @@
|
||||||
{{template "form/shadowsocks"}}
|
{{template "form/shadowsocks"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- dokodemo-door -->
|
<!-- tunnel -->
|
||||||
<template v-if="inbound.protocol === Protocols.DOKODEMO">
|
<template v-if="inbound.protocol === Protocols.TUNNEL">
|
||||||
{{template "form/dokodemo"}}
|
{{template "form/tunnel"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- socks -->
|
<!-- mixed -->
|
||||||
<template v-if="inbound.protocol === Protocols.SOCKS">
|
<template v-if="inbound.protocol === Protocols.MIXED">
|
||||||
{{template "form/socks"}}
|
{{template "form/mixed"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- http -->
|
<!-- http -->
|
||||||
|
|
|
@ -241,9 +241,9 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Servers (trojan/shadowsocks/socks/http) settings -->
|
<!-- Servers (trojan/shadowsocks/mixed/http) settings -->
|
||||||
<template v-if="outbound.hasServers()">
|
<template v-if="outbound.hasServers()">
|
||||||
<!-- http / socks -->
|
<!-- http / mixed -->
|
||||||
<template v-if="outbound.hasUsername()">
|
<template v-if="outbound.hasUsername()">
|
||||||
<a-form-item label='{{ i18n "username" }}'>
|
<a-form-item label='{{ i18n "username" }}'>
|
||||||
<a-input v-model.trim="outbound.settings.user"></a-input>
|
<a-input v-model.trim="outbound.settings.user"></a-input>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{define "form/dokodemo"}}
|
{{define "form/tunnel"}}
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.targetAddress"}}'>
|
<a-form-item label='{{ i18n "pages.inbounds.targetAddress"}}'>
|
||||||
<a-input v-model.trim="inbound.settings.address"></a-input>
|
<a-input v-model.trim="inbound.settings.address"></a-input>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{define "form/socks"}}
|
{{define "form/mixed"}}
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.enable" }} UDP'>
|
<a-form-item label='{{ i18n "pages.inbounds.enable" }} UDP'>
|
||||||
<a-switch v-model="inbound.settings.udp"></a-switch>
|
<a-switch v-model="inbound.settings.udp"></a-switch>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<td width="45%">{{ i18n "username" }}</td>
|
<td width="45%">{{ i18n "username" }}</td>
|
||||||
<td width="45%">{{ i18n "password" }}</td>
|
<td width="45%">{{ i18n "password" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a-button icon="plus" size="small" @click="inbound.settings.addAccount(new Inbound.SocksSettings.SocksAccount())"></a-button>
|
<a-button icon="plus" size="small" @click="inbound.settings.addAccount(new Inbound.MixedSettings.SocksAccount())"></a-button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -354,7 +354,7 @@
|
||||||
<code>[[ link.link ]]</code>
|
<code>[[ link.link ]]</code>
|
||||||
</tr-info-row>
|
</tr-info-row>
|
||||||
</template>
|
</template>
|
||||||
<table v-if="inbound.protocol == Protocols.DOKODEMO" class="tr-info-table">
|
<table v-if="inbound.protocol == Protocols.TUNNEL" class="tr-info-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ i18n "pages.inbounds.targetAddress" }}</th>
|
<th>{{ i18n "pages.inbounds.targetAddress" }}</th>
|
||||||
<th>{{ i18n "pages.inbounds.destinationPort" }}</th>
|
<th>{{ i18n "pages.inbounds.destinationPort" }}</th>
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table v-if="dbInbound.isSocks" class="tr-info-table">
|
<table v-if="dbInbound.isMixed" class="tr-info-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ i18n "password" }} Auth</th>
|
<th>{{ i18n "password" }} Auth</th>
|
||||||
<th>{{ i18n "pages.inbounds.enable" }} udp</th>
|
<th>{{ i18n "pages.inbounds.enable" }} udp</th>
|
||||||
|
|
|
@ -572,7 +572,7 @@
|
||||||
serverObj = o.settings.vnext;
|
serverObj = o.settings.vnext;
|
||||||
break;
|
break;
|
||||||
case Protocols.HTTP:
|
case Protocols.HTTP:
|
||||||
case Protocols.Socks:
|
case Protocols.Mixed:
|
||||||
case Protocols.Shadowsocks:
|
case Protocols.Shadowsocks:
|
||||||
case Protocols.Trojan:
|
case Protocols.Trojan:
|
||||||
serverObj = o.settings.servers;
|
serverObj = o.settings.servers;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"tag": "api",
|
"tag": "api",
|
||||||
"listen": "127.0.0.1",
|
"listen": "127.0.0.1",
|
||||||
"port": 62789,
|
"port": 62789,
|
||||||
"protocol": "dokodemo-door",
|
"protocol": "tunnel",
|
||||||
"settings": {
|
"settings": {
|
||||||
"address": "127.0.0.1"
|
"address": "127.0.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2129,8 +2129,8 @@ func (t *Tgbot) getInboundsAddClient() (*telego.InlineKeyboardMarkup, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
excludedProtocols := map[model.Protocol]bool{
|
excludedProtocols := map[model.Protocol]bool{
|
||||||
model.DOKODEMO: true,
|
model.Tunnel: true,
|
||||||
model.Socks: true,
|
model.Mixed: true,
|
||||||
model.WireGuard: true,
|
model.WireGuard: true,
|
||||||
model.HTTP: true,
|
model.HTTP: true,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue