Skip to content

Commit

Permalink
Remove mtproto vmess alterId
Browse files Browse the repository at this point in the history
  • Loading branch information
qist committed Jun 19, 2023
1 parent 6f9b8d2 commit 824c2e8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 53 deletions.
2 changes: 1 addition & 1 deletion config/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.12
1.8.13
48 changes: 1 addition & 47 deletions web/assets/js/model/xray.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const Protocols = {
TROJAN: 'trojan',
SHADOWSOCKS: 'shadowsocks',
DOKODEMO: 'dokodemo-door',
MTPROTO: 'mtproto',
SOCKS: 'socks',
HTTP: 'http',
};
Expand Down Expand Up @@ -967,16 +966,6 @@ class Inbound extends XrayCommonClass {
}
}

// VMess
get alterId() {
switch (this.protocol) {
case Protocols.VMESS:
return this.settings.vmesses[0].alterId;
default:
return "";
}
}

// Socks & HTTP
get username() {
switch (this.protocol) {
Expand Down Expand Up @@ -1207,7 +1196,6 @@ class Inbound extends XrayCommonClass {
add: address,
port: this.port,
id: this.settings.vmesses[0].id,
aid: this.settings.vmesses[0].alterId,
net: network,
type: type,
host: host,
Expand Down Expand Up @@ -1486,7 +1474,6 @@ Inbound.Settings = class extends XrayCommonClass {
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
case Protocols.DOKODEMO: return new Inbound.DokodemoSettings(protocol);
case Protocols.MTPROTO: return new Inbound.MtprotoSettings(protocol);
case Protocols.SOCKS: return new Inbound.SocksSettings(protocol);
case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
default: return null;
Expand All @@ -1500,7 +1487,6 @@ Inbound.Settings = class extends XrayCommonClass {
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
case Protocols.DOKODEMO: return Inbound.DokodemoSettings.fromJson(json);
case Protocols.MTPROTO: return Inbound.MtprotoSettings.fromJson(json);
case Protocols.SOCKS: return Inbound.SocksSettings.fromJson(json);
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
default: return null;
Expand Down Expand Up @@ -1555,16 +1541,14 @@ Inbound.VmessSettings = class extends Inbound.Settings {
}
};
Inbound.VmessSettings.Vmess = class extends XrayCommonClass {
constructor(id = RandomUtil.randomUUID(), alterId = 0) {
constructor(id = RandomUtil.randomUUID()) {
super();
this.id = id;
this.alterId = alterId;
}

static fromJson(json = {}) {
return new Inbound.VmessSettings.Vmess(
json.id,
json.alterId,
);
}
};
Expand Down Expand Up @@ -1813,36 +1797,6 @@ Inbound.DokodemoSettings = class extends Inbound.Settings {
}
};

Inbound.MtprotoSettings = class extends Inbound.Settings {
constructor(protocol, users = [new Inbound.MtprotoSettings.MtUser()]) {
super(protocol);
this.users = users;
}

static fromJson(json = {}) {
return new Inbound.MtprotoSettings(
Protocols.MTPROTO,
json.users.map(user => Inbound.MtprotoSettings.MtUser.fromJson(user)),
);
}

toJson() {
return {
users: XrayCommonClass.toJsonArray(this.users),
};
}
};
Inbound.MtprotoSettings.MtUser = class extends XrayCommonClass {
constructor(secret = RandomUtil.randomMTSecret()) {
super();
this.secret = secret;
}

static fromJson(json = {}) {
return new Inbound.MtprotoSettings.MtUser(json.secret);
}
};

Inbound.SocksSettings = class extends Inbound.Settings {
constructor(protocol, auth = 'password', accounts = [new Inbound.SocksSettings.SocksAccount()], udp = false, ip = '127.0.0.1') {
super(protocol);
Expand Down
1 change: 0 additions & 1 deletion web/html/xui/component/inbound_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

<template v-if="dbInbound.isVMess">
<p>uuid: <a-tag color="green">[[ inbound.uuid ]]</a-tag></p>
<p>alterId: <a-tag color="green">[[ inbound.alterId ]]</a-tag></p>
</template>

<template v-if="dbInbound.isVLess">
Expand Down
3 changes: 0 additions & 3 deletions web/html/xui/form/protocol/vmess.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<a-form-item label="id">
<a-input v-model.trim="inbound.settings.vmesses[0].id"></a-input>
</a-form-item>
<a-form-item label="额外 ID">
<a-input type="number" v-model.number="inbound.settings.vmesses[0].alterId"></a-input>
</a-form-item>
<a-form-item label="禁用不安全加密">
<a-switch v-model.number="inbound.settings.disableInsecure"></a-switch>
</a-form-item>
Expand Down
3 changes: 2 additions & 1 deletion xray/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"regexp"
"syscall"
"runtime"
"strings"
"time"
Expand Down Expand Up @@ -226,7 +227,7 @@ func (p *process) Stop() error {
if !p.IsRunning() {
return errors.New("xray is not running")
}
return p.cmd.Process.Kill()
return p.cmd.Process.Signal(syscall.SIGTERM)
}

func (p *process) GetTraffic(reset bool) ([]*Traffic, error) {
Expand Down

0 comments on commit 824c2e8

Please sign in to comment.