mirror of
https://github.com/mrrfv/cloudflare-gateway-pihole-scripts.git
synced 2026-11-16 19:37:01 +00:00
Which consolidates domains into fewer lists, deleting any empty lists. Domains are sorted by the time they were first added to one of our lists. This is done so that more stable entries end up in the earlier lists and domains that come and go are in the later lists. This enables the patching to be more efficient, touching only the later lists.
17 lines
694 B
JavaScript
17 lines
694 B
JavaScript
import { getZeroTrustLists, upsertZeroTrustDNSRule, upsertZeroTrustSNIRule } from "./lib/api.js";
|
|
import { BLOCK_BASED_ON_SNI } from "./lib/constants.js";
|
|
import { notifyWebhook } from "./lib/utils.js";
|
|
|
|
const { result: lists } = await getZeroTrustLists();
|
|
|
|
// Upsert DNS rules for all lists
|
|
await upsertZeroTrustDNSRule(lists, "CGPS Filter Lists");
|
|
|
|
// Optionally create a rule that matches the SNI.
|
|
// This only works for users who proxy their traffic through Cloudflare.
|
|
if (BLOCK_BASED_ON_SNI) {
|
|
await upsertZeroTrustSNIRule(lists, "CGPS Filter Lists - SNI Based Filtering");
|
|
}
|
|
|
|
// Send a notification to the webhook
|
|
await notifyWebhook("CF Gateway Rule Create script finished running");
|