Ver Fonte

feat(api): 增加对 IP 地址作为域名的支持- 在 WebForwarding 结构体中,将 Domain 字段的验证规则从 "hostname_rfc1123" 修改为 "omitempty,hostname_rfc1123|ip"
- 这个修改允许用户输入 IP 地址作为域名,提高了系统的灵活性和可用性

fusu há 1 mês atrás
pai
commit
e4f18a966f
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      api/v1/webForwarding.go

+ 1 - 1
api/v1/webForwarding.go

@@ -5,7 +5,7 @@ type WebForwardingDataRequest struct {
 	Id                 int    `form:"id" json:"id"`
 	CdnWebId          int    `form:"cdnWebId" json:"cdnWebId"`
 	Port               string    `form:"port" json:"port" validate:"required,numeric,min=1,max=65535"`
-	Domain             string `form:"domain" json:"domain" validate:"hostname_rfc1123"`
+	Domain             string `form:"domain" json:"domain" validate:"omitempty,hostname_rfc1123|ip"`
 	BackendList        []BackendList `form:"backendList" json:"backendList" validate:"required,dive"`
 	AllowIpList        []string `form:"allowIpList" json:"allowIpList" validate:"dive,ip"`
 	DenyIpList         []string `form:"denyIpList" json:"denyIpList" validate:"dive,ip"`