Merge pull request #1438 from lightpanda-io/update_public_suffix_list

Update the public suffix list
This commit is contained in:
Karl Seguin
2026-01-30 06:55:26 +08:00
committed by GitHub
2 changed files with 488 additions and 115 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -27,16 +27,22 @@ func main() {
}
lookup :=
"const std = @import(\"std\");\n\n" +
"const std = @import(\"std\");\n" +
"const builtin = @import(\"builtin\");\n\n" +
"pub fn lookup(value: []const u8) bool {\n" +
" return public_suffix_list.has(value);\n" +
"}\n"
fmt.Println(lookup)
fmt.Println("const public_suffix_list = std.StaticStringMap(void).initComptime([_]struct { []const u8, void }{")
fmt.Println("const public_suffix_list = std.StaticStringMap(void).initComptime(entries);\n")
fmt.Println("const entries: []const struct { []const u8, void } =")
fmt.Println(" if (builtin.is_test) &.{")
fmt.Println(" .{ \"api.gov.uk\", {} },")
fmt.Println(" .{ \"gov.uk\", {} },")
fmt.Println(" } else &.{")
for _, domain := range domains {
fmt.Printf(` .{ "%s", {} },`, domain)
fmt.Println()
}
fmt.Println("});")
fmt.Println(" };")
}