diff --git a/.gitignore b/.gitignore
index 1b5f0069..419da08b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ x-ui-*.tar.gz
/release.sh
.sync*
main
+release/
+access.log
diff --git a/web/controller/inbound.go b/web/controller/inbound.go
index 3cb3b6b6..c9922b3f 100644
--- a/web/controller/inbound.go
+++ b/web/controller/inbound.go
@@ -30,6 +30,11 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) {
g.POST("/add", a.addInbound)
g.POST("/del/:id", a.delInbound)
g.POST("/update/:id", a.updateInbound)
+
+ g.POST("/clientIps/:email", a.getClientIps)
+ g.POST("/clearClientIps/:email", a.clearClientIps)
+
+
}
func (a *InboundController) startTask() {
@@ -106,3 +111,23 @@ func (a *InboundController) updateInbound(c *gin.Context) {
a.xrayService.SetToNeedRestart()
}
}
+func (a *InboundController) getClientIps(c *gin.Context) {
+ email := c.Param("email")
+
+ ips , err := a.inboundService.GetInboundClientIps(email)
+ if err != nil {
+ jsonMsg(c, "修改", err)
+ return
+ }
+ jsonObj(c, ips, nil)
+}
+func (a *InboundController) clearClientIps(c *gin.Context) {
+ email := c.Param("email")
+
+ err := a.inboundService.ClearClientIps(email)
+ if err != nil {
+ jsonMsg(c, "修改", err)
+ return
+ }
+ jsonMsg(c, "Log Cleared", nil)
+}
\ No newline at end of file
diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html
index ce23d4a3..c161563f 100644
--- a/web/html/xui/form/protocol/vmess.html
+++ b/web/html/xui/form/protocol/vmess.html
@@ -17,6 +17,23 @@
+
+
+ client ip log
+
+
+ disable inbound if more than entered count (0 for disable limit ip)
+
+
+
+
+
+
+
+
+ clear log
+
+
diff --git a/web/html/xui/inbound_modal.html b/web/html/xui/inbound_modal.html
index 050b4a00..1bf06a7c 100644
--- a/web/html/xui/inbound_modal.html
+++ b/web/html/xui/inbound_modal.html
@@ -14,6 +14,7 @@
confirm: null,
inbound: new Inbound(),
dbInbound: new DBInbound(),
+ clientIps: "",
ok() {
ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
},
@@ -64,6 +65,9 @@
},
get dbInbound() {
return inModal.dbInbound;
+ },
+ get clientIps() {
+ return inModal.clientIps;
}
},
methods: {
@@ -71,8 +75,27 @@
if (oldValue === 'kcp') {
this.inModal.inbound.tls = false;
}
- }
- }
+ },
+ async getDBClientIps(email) {
+
+ const msg = await HttpUtil.post('/xui/inbound/clientIps/'+ email);
+ if (!msg.success) {
+ return;
+ }
+ ips = JSON.parse(msg.obj)
+ ips = ips.join(",")
+ this.inModal.clientIps = ips
+ },
+ async clearDBClientIps(email) {
+ const msg = await HttpUtil.post('/xui/inbound/clearClientIps/'+ email);
+ if (!msg.success) {
+ return;
+ }
+ this.inModal.clientIps = ""
+ },
+
+ },
+
});
diff --git a/web/service/inbound.go b/web/service/inbound.go
index 726b7ba0..d440cbce 100644
--- a/web/service/inbound.go
+++ b/web/service/inbound.go
@@ -176,3 +176,27 @@ func (s *InboundService) DisableInvalidInbounds() (int64, error) {
count := result.RowsAffected
return count, err
}
+
+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
+}