Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-02-28 22:54:29 +0300
committerMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-02-28 22:54:29 +0300
commit5317df21f3923bfa771ed6008d5b0f5f8911e498 (patch)
tree3109ee9abe5bf8cf24eef806f033c6d0e5dd160f /web/service
parent1a4ba4afd64531c466e5e4a0af7b45bcb3247339 (diff)
ip limit + export links
Diffstat (limited to 'web/service')
-rw-r--r--web/service/inbound.go22
-rw-r--r--web/service/server.go4
2 files changed, 24 insertions, 2 deletions
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 5c1cfedc..450c77f0 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -369,7 +369,29 @@ func (s *InboundService) UpdateClientStat(inboundId int, inboundSettings string)
func (s *InboundService) DelClientStat(tx *gorm.DB, email string) error {
return tx.Where("email = ?", email).Delete(xray.ClientTraffic{}).Error
}
+func (s *InboundService) GetInboundClientIps(clientEmail string) (string, error) {
+ db := database.GetDB()
+ InboundClientIps := &model.InboundClientIps{}
+ err := db.Model(model.InboundClientIps{}).Where("client_email = ?", clientEmail).First(InboundClientIps).Error
+ if err != nil {
+ return "", err
+ }
+ return InboundClientIps.Ips, nil
+}
+func (s *InboundService) ClearClientIps(clientEmail string) (error) {
+ db := database.GetDB()
+
+ result := db.Model(model.InboundClientIps{}).
+ Where("client_email = ?", clientEmail).
+ Update("ips", "")
+ err := result.Error
+
+ if err != nil {
+ return err
+ }
+ return nil
+}
func (s *InboundService) ResetClientTraffic(clientEmail string) error {
db := database.GetDB()
diff --git a/web/service/server.go b/web/service/server.go
index c0a8e9d2..d12c8e27 100644
--- a/web/service/server.go
+++ b/web/service/server.go
@@ -172,7 +172,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/mhsanaei/Xray-core/releases"
resp, err := http.Get(url)
if err != nil {
return nil, err
@@ -215,7 +215,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/mhsanaei/Xray-core/releases/download/%s/%s", version, fileName)
resp, err := http.Get(url)
if err != nil {
return "", err