Add guarded IP certificate flow and renewal history

This commit is contained in:
Codex committed 2026-10-26 15:32:27 +08:00
1 parent dd94a4cc84
commit d3699abb18
14 files changed
+343 -56

No files matched your search

@@ -55,12 +55,15 @@ func TestHTTPIPv4PublicEntry(t *testing.T) {
t.Fatalf("invalid HTTP host accepted: %s", host)
}
}
if ValidPublicHost("https", "121.4.111.208") {
t.Fatal("HTTPS IPv4 must require a domain")
if !ValidPublicHost("https", "121.4.111.208") || ValidPublicHost("https", "127.0.0.1") || ValidPublicHost("https", "192.168.1.2") {
t.Fatal("HTTPS IP certificates require a public IPv4 address")
}
if got := PublicBaseURL("http", "121.4.111.208", 28080); got != "http://121.4.111.208:28080" {
t.Fatalf("unexpected public URL: %s", got)
}
if got := PublicBaseURL("https", "121.4.111.208", 443); got != "https://121.4.111.208" {
t.Fatalf("unexpected IP HTTPS URL: %s", got)
}
t.Setenv("VPN_TLS_DOMAIN", "")
t.Setenv("VPN_TLS_SCHEME", "")
t.Setenv("VPN_TLS_PORT", "")
@@ -68,8 +71,8 @@ func TestHTTPIPv4PublicEntry(t *testing.T) {
if err := ConfigurePublicEntry(dir, "http", "121.4.111.208", 28080); err != nil {
t.Fatal(err)
}
if err := ConfigurePublicEntry(dir, "https", "121.4.111.208", 443); err == nil {
t.Fatal("HTTPS IPv4 was persisted")
if err := ConfigurePublicEntry(dir, "https", "121.4.111.208", 443); err != nil {
t.Fatalf("HTTPS public IPv4 was rejected: %v", err)
}
}