diff options
| author | Amin <83173090+amintn@users.noreply.github.com> | 2024-01-17 15:51:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-17 15:51:28 +0300 |
| commit | 62f08e877d564dd6b7d4d90bcb1bb0cef36f3cb7 (patch) | |
| tree | a62d8a0e8baca6c6a0c4dff34b0976bee9877091 /web/controller | |
| parent | 3ed6fc40361d52df477060b28198ced083bf3987 (diff) | |
Fix inbounds with the same port and different IPs (#1595)
Diffstat (limited to 'web/controller')
| -rw-r--r-- | web/controller/inbound.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 123c486f..86da9813 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -85,7 +85,11 @@ func (a *InboundController) addInbound(c *gin.Context) { } user := session.GetLoginUser(c) inbound.UserId = user.Id - inbound.Tag = fmt.Sprintf("inbound-%v", inbound.Port) + if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" { + inbound.Tag = fmt.Sprintf("inbound-0.0.0.0:%v", inbound.Port) + } else { + inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port) + } needRestart := false inbound, needRestart, err = a.inboundService.AddInbound(inbound) @@ -278,7 +282,11 @@ func (a *InboundController) importInbound(c *gin.Context) { user := session.GetLoginUser(c) inbound.Id = 0 inbound.UserId = user.Id - inbound.Tag = fmt.Sprintf("inbound-%v", inbound.Port) + if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" { + inbound.Tag = fmt.Sprintf("inbound-0.0.0.0:%v", inbound.Port) + } else { + inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port) + } for index := range inbound.ClientStats { inbound.ClientStats[index].Id = 0 |
