diff --git a/database/model/model.go b/database/model/model.go
index b7142157..987083a8 100644
--- a/database/model/model.go
+++ b/database/model/model.go
@@ -69,3 +69,10 @@ type Setting struct {
Key string `json:"key" form:"key"`
Value string `json:"value" form:"value"`
}
+type Client struct {
+ ID string `json:"id"`
+ AlterIds uint16 `json:"alterId"`
+ Email string `json:"email"`
+ LimitIP int `json:"limitIp"`
+ Security string `json:"security"`
+}
diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js
index 4526ef1a..cb15842b 100644
--- a/web/assets/js/model/xray.js
+++ b/web/assets/js/model/xray.js
@@ -881,7 +881,7 @@ class Inbound extends XrayCommonClass {
this.sniffing = new Sniffing();
}
- genVmessLink(address='', remark='') {
+ genVmessLink(address='', remark='', clientIndex=0) {
if (this.protocol !== Protocols.VMESS) {
return '';
}
@@ -934,8 +934,8 @@ class Inbound extends XrayCommonClass {
ps: remark,
add: address,
port: this.port,
- id: this.settings.vmesses[0].id,
- aid: this.settings.vmesses[0].alterId,
+ id: this.settings.vmesses[clientIndex].id,
+ aid: this.settings.vmesses[clientIndex].alterId,
net: network,
type: type,
host: host,
@@ -945,9 +945,9 @@ class Inbound extends XrayCommonClass {
return 'vmess://' + base64(JSON.stringify(obj, null, 2));
}
- genVLESSLink(address = '', remark='') {
+ genVLESSLink(address = '', remark='', clientIndex=0) {
const settings = this.settings;
- const uuid = settings.vlesses[0].id;
+ const uuid = settings.vlesses[clientIndex].id;
const port = this.port;
const type = this.stream.network;
const params = new Map();
@@ -1009,7 +1009,7 @@ class Inbound extends XrayCommonClass {
}
if (this.xtls) {
- params.set("flow", this.settings.vlesses[0].flow);
+ params.set("flow", this.settings.vlesses[clientIndex].flow);
}
const link = `vless://${uuid}@${address}:${port}`;
@@ -1036,10 +1036,10 @@ class Inbound extends XrayCommonClass {
return `trojan://${settings.clients[0].password}@${address}:${this.port}#${encodeURIComponent(remark)}`;
}
- genLink(address='', remark='') {
+ genLink(address='', remark='', clientIndex=0) {
switch (this.protocol) {
- case Protocols.VMESS: return this.genVmessLink(address, remark);
- case Protocols.VLESS: return this.genVLESSLink(address, remark);
+ case Protocols.VMESS: return this.genVmessLink(address, remark, clientIndex);
+ case Protocols.VLESS: return this.genVLESSLink(address, remark, clientIndex);
case Protocols.SHADOWSOCKS: return this.genSSLink(address, remark);
case Protocols.TROJAN: return this.genTrojanLink(address, remark);
default: return '';
diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html
index 9a3359d5..c80f8a0e 100644
--- a/web/html/common/qrcode_modal.html
+++ b/web/html/common/qrcode_modal.html
@@ -2,7 +2,20 @@
-
+ click on QR Code to Copy
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/html/xui/component/inbound_info.html b/web/html/xui/component/inbound_info.html
index b3eca115..cbf156d1 100644
--- a/web/html/xui/component/inbound_info.html
+++ b/web/html/xui/component/inbound_info.html
@@ -32,10 +32,10 @@
tls: {{ i18n "closure" }}
- tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '{{ i18n "none" }}' ]]
+ tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]]
- xtls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '{{ i18n "none" }}' ]]
+ xtls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]]
{{end}}
@@ -46,14 +46,16 @@
{{ i18n "pages.inbounds.address"}}: [[ dbInbound.address ]]
{{ i18n "pages.inbounds.port"}}: [[ dbInbound.port ]]
-
- uuid: [[ inbound.uuid ]]
- alterId: [[ inbound.alterId ]]
+
+ uuid: [[ vmess.id ]]
+ alterId: [[ vmess.alterId ]]
+
-
- uuid: [[ inbound.uuid ]]
- flow: [[ inbound.flow ]]
+
+ uuid: [[ vless.id ]]
+ flow: [[ vless.flow ]]
+
diff --git a/web/html/xui/form/protocol/trojan.html b/web/html/xui/form/protocol/trojan.html
index 2fcf1bb1..ae38ceb1 100644
--- a/web/html/xui/form/protocol/trojan.html
+++ b/web/html/xui/form/protocol/trojan.html
@@ -5,7 +5,7 @@
-
+ {{ i18n "none" }}
[[ key ]]
diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html
index deba14b0..0b6e6a5f 100644
--- a/web/html/xui/form/protocol/vless.html
+++ b/web/html/xui/form/protocol/vless.html
@@ -1,8 +1,9 @@
{{define "form/vless"}}
-
+
-
+
@@ -15,11 +16,11 @@
-
+
-
+
- client IP log
+ IP log
IPs history Log (before enabling inbound after it has been disabled by IP limit, you should clear the log)
@@ -27,22 +28,59 @@
+
-
-
+
+
- clear log
+ clear log
+
-
+
-
-
+
+ {{ i18n "none" }}
[[ key ]]
+
+
+
+
+
+
+
diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html
index ea0c62a9..4d7fa4f4 100644
--- a/web/html/xui/form/protocol/vmess.html
+++ b/web/html/xui/form/protocol/vmess.html
@@ -1,8 +1,9 @@
{{define "form/vmess"}}
-
+
-
+
@@ -15,11 +16,11 @@
-
+
-
+
- Client IP Log
+ IP Log
IPs history Log (before enabling inbound after it has been disabled by IP limit, you should clear the log)
@@ -28,21 +29,60 @@
-
+
- clear log
+ clear log
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
{{end}}
\ No newline at end of file
diff --git a/web/html/xui/inbound_modal.html b/web/html/xui/inbound_modal.html
index dfe86923..fc40883a 100644
--- a/web/html/xui/inbound_modal.html
+++ b/web/html/xui/inbound_modal.html
@@ -15,7 +15,6 @@
confirm: null,
inbound: new Inbound(),
dbInbound: new DBInbound(),
- clientIps: "",
ok() {
ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
},
@@ -68,9 +67,6 @@
get dbInbound() {
return inModal.dbInbound;
},
- get clientIps() {
- return inModal.clientIps;
- },
get isEdit() {
return inModal.isEdit;
}
@@ -81,7 +77,18 @@
this.inModal.inbound.tls = false;
}
},
- async getDBClientIps(email) {
+ addClient(protocol,value, clients) {
+ switch (protocol) {
+ case Protocols.VMESS: return clients.push(new Inbound.VmessSettings.Vmess());
+ case Protocols.VLESS: return clients.push(new Inbound.VLESSSettings.VLESS());
+ default: return null;
+ }
+ },
+ removeClient(index, clients) {
+ clients.splice(index, 1);
+ },
+
+ async getDBClientIps(email,event) {
const msg = await HttpUtil.post('/xui/inbound/clientIps/'+ email);
if (!msg.success) {
@@ -90,24 +97,23 @@
try {
ips = JSON.parse(msg.obj)
ips = ips.join(",")
- this.inModal.clientIps = ips
+ event.target.value = ips
} catch (error) {
// text
- this.inModal.clientIps = msg.obj
+ event.target.value = msg.obj
}
},
- async clearDBClientIps(email) {
+ async clearDBClientIps(email,event) {
const msg = await HttpUtil.post('/xui/inbound/clearClientIps/'+ email);
if (!msg.success) {
return;
}
- this.inModal.clientIps = ""
+ event.target.value = ""
},
},
-
});
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html
index 3c5aafb5..3844d49c 100644
--- a/web/html/xui/inbounds.html
+++ b/web/html/xui/inbounds.html
@@ -324,7 +324,7 @@
},
showQrcode(dbInbound) {
const link = dbInbound.genLink();
- qrModal.show('{{ i18n "qrCode"}}', link);
+ qrModal.show('{{ i18n "qrCode"}}', link, dbInbound);
},
showInfo(dbInbound) {
infoModal.show(dbInbound);
diff --git a/web/job/check_clinet_ip_job.go b/web/job/check_clinet_ip_job.go
index a7cac64a..bf71116b 100644
--- a/web/job/check_clinet_ip_job.go
+++ b/web/job/check_clinet_ip_job.go
@@ -9,7 +9,7 @@ import (
ss "strings"
"regexp"
"encoding/json"
- "strconv"
+ // "strconv"
"strings"
"time"
"net"
@@ -192,24 +192,25 @@ func updateInboundClientIps(inboundClientIps *model.InboundClientIps,clientEmail
inbound, err := GetInboundByEmail(clientEmail)
checkError(err)
- limitIpRegx, _ := regexp.Compile(`"limitIp": .+`)
if inbound.Settings == "" {
logger.Debug("wrong data ",inbound)
return nil
}
- limitIpMactch := limitIpRegx.FindString(inbound.Settings)
- limitIpMactch = ss.Split(limitIpMactch, `"limitIp": `)[1]
- limitIp, err := strconv.Atoi(limitIpMactch)
+ settings := map[string][]model.Client{}
+ json.Unmarshal([]byte(inbound.Settings), &settings)
+ clients := settings["clients"]
-
- if(limitIp < len(ips) && limitIp != 0 && inbound.Enable) {
-
- if(limitIp == 1){
- limitIp = 2
+ for _, client := range clients {
+ if client.Email == clientEmail {
+
+ limitIp := client.LimitIP
+
+ if(limitIp < len(ips) && limitIp != 0 && inbound.Enable) {
+
+ disAllowedIps = append(disAllowedIps,ips[limitIp:]...)
+ }
}
- disAllowedIps = append(disAllowedIps,ips[limitIp - 1:]...)
-
}
logger.Debug("disAllowedIps ",disAllowedIps)
sort.Sort(sort.StringSlice(disAllowedIps))
diff --git a/web/service/server.go b/web/service/server.go
index 08b0c2c6..f46d247a 100644
--- a/web/service/server.go
+++ b/web/service/server.go
@@ -171,7 +171,7 @@ func (s *ServerService) GetStatus(lastStatus *Status) *Status {
}
func (s *ServerService) GetXrayVersions() ([]string, error) {
- url := "https://api.github.com/repos/XTLS/Xray-core/releases"
+ url := "https://api.github.com/repos/hossinasaadi/Xray-core/releases"
resp, err := http.Get(url)
if err != nil {
return nil, err
@@ -214,7 +214,7 @@ func (s *ServerService) downloadXRay(version string) (string, error) {
}
fileName := fmt.Sprintf("Xray-%s-%s.zip", osName, arch)
- url := fmt.Sprintf("https://github.com/XTLS/Xray-core/releases/download/%s/%s", version, fileName)
+ url := fmt.Sprintf("https://github.com/hossinasaadi/Xray-core/releases/download/%s/%s", version, fileName)
resp, err := http.Get(url)
if err != nil {
return "", err
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index 637a6377..bb441e29 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -34,8 +34,8 @@
"turnOn" = "turn on"
"closure" = "closure"
"domainName" = "domain name"
-"additional" = "additional"
-"monitor" = "monitor"
+"additional" = "alter"
+"monitor" = "Listen IP"
"certificate" = "certificat"
"fail" = "fail"
"success" = "success"