feat: 自签证书支持 ipv6 (#6627)

Refs https://github.com/1Panel-dev/1Panel/issues/6623
This commit is contained in:
zhengkunwang 2024-09-29 18:25:47 +08:00 committed by GitHub
parent 4c275ba52f
commit e03b728240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -217,17 +217,16 @@ func (w WebsiteCAService) ObtainSSL(req request.WebsiteCAObtain) (*model.Website
if req.Domains != "" {
domainArray := strings.Split(req.Domains, "\n")
for _, domain := range domainArray {
if ipAddress := net.ParseIP(domain); ipAddress == nil {
if !common.IsValidDomain(domain) {
err = buserr.WithName("ErrDomainFormat", domain)
return nil, err
} else {
if ipAddress := net.ParseIP(domain); ipAddress == nil {
}
domains = append(domains, domain)
} else {
ips = append(ips, ipAddress)
}
}
}
if len(domains) > 0 {
websiteSSL.PrimaryDomain = domains[0]
websiteSSL.Domains = strings.Join(domains[1:], ",")