初始化访客IP配置时去除首尾可能的空格

This commit is contained in:
刘祥超
2023-07-07 08:31:17 +08:00
parent f3cc573a2c
commit 64bac81b56

View File

@@ -19,6 +19,7 @@ type HTTPRemoteAddrConfig struct {
// Init 初始化
func (this *HTTPRemoteAddrConfig) Init() error {
this.Value = strings.TrimSpace(this.Value)
if len(this.Value) == 0 {
this.isEmpty = true
} else if regexp.MustCompile(`\s+`).ReplaceAllString(this.Value, "") == "${remoteAddr}" {