From ca10623e40fc5528cc7e674f7552e1e1c38678b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Jun 2023 14:03:09 +0330 Subject: [PATCH 1/5] Bump gorm.io/driver/sqlite from 1.5.1 to 1.5.2 (#579) Bumps [gorm.io/driver/sqlite](https://github.com/go-gorm/sqlite) from 1.5.1 to 1.5.2. - [Commits](https://github.com/go-gorm/sqlite/compare/v1.5.1...v1.5.2) --- updated-dependencies: - dependency-name: gorm.io/driver/sqlite dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2b74b7af..ae6ea7d7 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( go.uber.org/atomic v1.11.0 golang.org/x/text v0.9.0 google.golang.org/grpc v1.55.0 - gorm.io/driver/sqlite v1.5.1 - gorm.io/gorm v1.25.1 + gorm.io/driver/sqlite v1.5.2 + gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 ) require ( diff --git a/go.sum b/go.sum index 8af92e75..9adea1cb 100644 --- a/go.sum +++ b/go.sum @@ -272,10 +272,10 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/sqlite v1.5.1 h1:hYyrLkAWE71bcarJDPdZNTLWtr8XrSjOWyjUYI6xdL4= -gorm.io/driver/sqlite v1.5.1/go.mod h1:7MZZ2Z8bqyfSQA1gYEV6MagQWj3cpUkJj9Z+d1HEMEQ= -gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64= -gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc= +gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 h1:sC1Xj4TYrLqg1n3AN10w871An7wJM0gzgcm8jkIkECQ= +gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gvisor.dev/gvisor v0.0.0-20220901235040-6ca97ef2ce1c h1:m5lcgWnL3OElQNVyp3qcncItJ2c0sQlSGjYK2+nJTA4= lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= From 81aa3ed10e521d5c65b43d5f336a285abc89a553 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 9 Jun 2023 15:58:47 +0330 Subject: [PATCH 2/5] mtproto removed --- web/assets/js/model/xray.js | 33 --------------------------------- web/assets/js/util/utils.js | 13 ------------- 2 files changed, 46 deletions(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 33cd10d5..748ce526 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -4,7 +4,6 @@ const Protocols = { TROJAN: 'trojan', SHADOWSOCKS: 'shadowsocks', DOKODEMO: 'dokodemo-door', - MTPROTO: 'mtproto', SOCKS: 'socks', HTTP: 'http', }; @@ -1586,7 +1585,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; @@ -1600,7 +1598,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; @@ -2106,36 +2103,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); diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 5644df2e..612d4b5b 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -110,19 +110,6 @@ class RandomUtil { return str; } - static randomMTSecret() { - let str = ''; - for (let i = 0; i < 32; ++i) { - let index = this.randomInt(16); - if (index <= 9) { - str += index; - } else { - str += seq[index - 10]; - } - } - return str; - } - static randomUUID() { let d = new Date().getTime(); return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { From 7fc3d3785160faddfd8745da063265ab50ee1753 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 9 Jun 2023 16:04:57 +0330 Subject: [PATCH 3/5] random password button for SS & more crypto.getRandomValues for uuid change name randomText to randomLowerAndNum --- web/assets/js/model/xray.js | 10 +++++----- web/assets/js/util/utils.js | 22 +++++++++++---------- web/html/xui/form/client.html | 4 ++-- web/html/xui/form/protocol/shadowsocks.html | 5 +++-- web/html/xui/form/protocol/trojan.html | 4 ++-- web/html/xui/form/protocol/vless.html | 4 ++-- web/html/xui/form/protocol/vmess.html | 4 ++-- web/html/xui/form/tls_settings.html | 2 +- 8 files changed, 29 insertions(+), 26 deletions(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 748ce526..b627570f 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -707,7 +707,7 @@ class RealityStreamSettings extends XrayCommonClass { minClient = '', maxClient = '', maxTimediff = 0, - shortIds = RandomUtil.randomShortId(8), + shortIds = RandomUtil.randomShortId(), settings= new RealityStreamSettings.Settings() ){ super(); @@ -1652,7 +1652,7 @@ Inbound.VmessSettings = class extends Inbound.Settings { } }; Inbound.VmessSettings.Vmess = class extends XrayCommonClass { - constructor(id=RandomUtil.randomUUID(), alterId=0, email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) { + constructor(id=RandomUtil.randomUUID(), alterId=0, email=RandomUtil.randomLowerAndNum(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomLowerAndNum(16)) { super(); this.id = id; this.alterId = alterId; @@ -1744,7 +1744,7 @@ Inbound.VLESSSettings = class extends Inbound.Settings { }; Inbound.VLESSSettings.VLESS = class extends XrayCommonClass { - constructor(id=RandomUtil.randomUUID(), flow='', email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) { + constructor(id=RandomUtil.randomUUID(), flow='', email=RandomUtil.randomLowerAndNum(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomLowerAndNum(16)) { super(); this.id = id; this.flow = flow; @@ -1867,7 +1867,7 @@ Inbound.TrojanSettings = class extends Inbound.Settings { } }; Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { - constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) { + constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomLowerAndNum(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomLowerAndNum(16)) { super(); this.password = password; this.flow = flow; @@ -2009,7 +2009,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings { }; Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass { - constructor(password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomText(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16)) { + constructor(password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomLowerAndNum(8),limitIp=0, totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomLowerAndNum(16)) { super(); this.password = password; this.email = email; diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 612d4b5b..781e13a8 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -94,30 +94,32 @@ class RandomUtil { return str; } - static randomShortId(count) { + static randomShortId() { let str = ''; - for (let i = 0; i < count; ++i) { + for (let i = 0; i < 8; ++i) { str += seq[this.randomInt(16)]; } return str; } - static randomText(len) { + static randomLowerAndNum(len) { let str = ''; - for (let i = 0; i < len; i++) { + for (let i = 0; i < len; ++i) { str += seq[this.randomInt(36)]; } return str; } static randomUUID() { - let d = new Date().getTime(); - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - let r = (d + Math.random() * 16) % 16 | 0; - d = Math.floor(d / 16); - return (c === 'x' ? r : (r & 0x7 | 0x8)).toString(16); + const template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; + return template.replace(/[xy]/g, function (c) { + const randomValues = new Uint8Array(1); + crypto.getRandomValues(randomValues); + let randomValue = randomValues[0] % 16; + let calculatedValue = (c === 'x') ? randomValue : (randomValue & 0x3 | 0x8); + return calculatedValue.toString(16); }); - } + } static randomShadowsocksPassword() { let array = new Uint8Array(32); diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index cfac5cff..bd6b08af 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -18,7 +18,7 @@ - + @@ -44,7 +44,7 @@ - + diff --git a/web/html/xui/form/protocol/shadowsocks.html b/web/html/xui/form/protocol/shadowsocks.html index e4eaf155..e9b01ea5 100644 --- a/web/html/xui/form/protocol/shadowsocks.html +++ b/web/html/xui/form/protocol/shadowsocks.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -112,6 +112,7 @@ + diff --git a/web/html/xui/form/protocol/trojan.html b/web/html/xui/form/protocol/trojan.html index cf56f438..f494adb9 100644 --- a/web/html/xui/form/protocol/trojan.html +++ b/web/html/xui/form/protocol/trojan.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html index 59ba7672..f661a839 100644 --- a/web/html/xui/form/protocol/vless.html +++ b/web/html/xui/form/protocol/vless.html @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index de6e5250..6dd31307 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -11,7 +11,7 @@ - +
@@ -33,7 +33,7 @@ - + diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index d0692e13..58edf992 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -187,7 +187,7 @@ - +
From 90633367788163b295fdf548de3533a160bf3128 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 9 Jun 2023 16:48:50 +0330 Subject: [PATCH 4/5] new - Reject Unknown SNI - thanks to @sudospaes --- web/assets/js/model/xray.js | 4 ++++ web/html/xui/form/tls_settings.html | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index b627570f..255577df 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -468,6 +468,7 @@ class TlsStreamSettings extends XrayCommonClass { minVersion = TLS_VERSION_OPTION.TLS12, maxVersion = TLS_VERSION_OPTION.TLS13, cipherSuites = '', + rejectUnknownSni = false, certificates=[new TlsStreamSettings.Cert()], alpn=[ALPN_OPTION.H2,ALPN_OPTION.HTTP1], settings=new TlsStreamSettings.Settings()) { @@ -476,6 +477,7 @@ class TlsStreamSettings extends XrayCommonClass { this.minVersion = minVersion; this.maxVersion = maxVersion; this.cipherSuites = cipherSuites; + this.rejectUnknownSni = rejectUnknownSni; this.certs = certificates; this.alpn = alpn; this.settings = settings; @@ -503,6 +505,7 @@ class TlsStreamSettings extends XrayCommonClass { json.minVersion, json.maxVersion, json.cipherSuites, + json.rejectUnknownSni, certs, json.alpn, settings, @@ -515,6 +518,7 @@ class TlsStreamSettings extends XrayCommonClass { minVersion: this.minVersion, maxVersion: this.maxVersion, cipherSuites: this.cipherSuites, + rejectUnknownSni: this.rejectUnknownSni, certificates: TlsStreamSettings.toJsonArray(this.certs), alpn: this.alpn, settings: this.settings, diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index 58edf992..227c5466 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -35,7 +35,6 @@ - @@ -85,9 +84,14 @@ [[ value ]] +
+
+ + +