Watch
1
0
Fork
You've already forked cloudflare-gateway-pihole-scripts
0
mirror of https://github.com/mrrfv/cloudflare-gateway-pihole-scripts.git synced 2026-11-16 19:37:01 +00:00
cloudflare-gateway-pihole-s.../cf_gateway_rule_create.js
Ben Sykes c5c1d7b4a1 Add script 'cloudflare-defragment'
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.
2025-11-11 07:58:00 -08:00

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");