mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 23:30:26 +08:00
安装时如果数据库地址填写的是公网IP,则提示会影响系统运行性能
This commit is contained in:
@@ -3,6 +3,7 @@ package helpers
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/events"
|
||||
nodes "github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||
"github.com/iwind/TeaGo/lists"
|
||||
@@ -66,7 +67,7 @@ func checkIPWithoutCache(config *systemconfigs.SecurityConfig, ipAddr string) bo
|
||||
return false
|
||||
}
|
||||
}
|
||||
if config.AllowLocal && isLocalIP(ip) {
|
||||
if config.AllowLocal && utils.IsLocalIP(ip) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -105,18 +106,3 @@ func checkIPWithoutCache(config *systemconfigs.SecurityConfig, ipAddr string) bo
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 判断是否为本地IP
|
||||
func isLocalIP(ip net.IP) bool {
|
||||
if ip[0] == 127 ||
|
||||
ip[0] == 10 ||
|
||||
(ip[0] == 172 && ip[1]&0xf0 == 16) ||
|
||||
(ip[0] == 192 && ip[1] == 168) {
|
||||
return true
|
||||
}
|
||||
|
||||
if ip.String() == "::1" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user