Support IPv4 HTTP public gateway entries

This commit is contained in:
Codex committed 2026-10-26 14:53:52 +08:00
1 parent 6f01d31f97
commit 6d5973bea3
11 files changed
+146 -32

No files matched your search

+3 -3
View File
@@ -58,7 +58,7 @@ func parseManagedEntry(body string) (nginxconfig.RenderOptions, error) {
}
domains := managedDomain.FindAllStringSubmatch(body, -1)
ports := portPattern.FindStringSubmatch(body)
if len(domains) == 0 || len(ports) != 2 || !tlsservice.ValidDomain(domains[0][1]) {
if len(domains) == 0 || len(ports) != 2 || !tlsservice.ValidPublicHost(scheme, domains[0][1]) {
return nginxconfig.RenderOptions{}, errors.New("无法识别托管站点的公网地址")
}
for _, match := range domains[1:] {
@@ -363,8 +363,8 @@ func RunEntryWithAuth(opts nginxconfig.RenderOptions, routes gin.RoutesInfo, aut
scheme = "https"
}
opts.Domain, opts.Scheme = domain, scheme
if !tlsservice.ValidDomain(domain) {
return errors.New("请先保存有效域名")
if !tlsservice.ValidPublicHost(scheme, domain) {
return errors.New("请先保存有效域名;HTTP 也支持 IPv4 地址")
}
if !tlsservice.ValidScheme(scheme) {
return errors.New("协议仅支持 http 或 https")