/ddg2dnr

Scripts to generate declarativeNetRequest rulesets for the DuckDuckGo browser extension.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

ddg2dnr

Introduction

This is a library and command line utility to generate the declarativeNetRequest rulesets necessary for the DuckDuckGo Privacy Essentials extension.

Setup

Install the dependencies:

npm install

Usage

Command line

Generate a Smarter Encryption ruleset:

npm run smarter-encryption ../list-of-domains-input.txt ../smarter-encryption-ruleset-output.json

Generate the TDS ruleset:

npm run tds ../tds-input.json ../supported-surrogates-input.json ../tds-ruleset-output.json \
        [../match-details-by-rule-id-output.json]

Note:

  • This includes both Tracker blocking (see tds.json) and "surrogate script" redirection. (see tracker-surrogates).
  • supported-surrogates-input.json must be a JSON encoded array of surrogate script names.

Generate the extension configuration ruleset:

npm run extension-configuration ../extension-config-input.json \
        ../extension-configuration-ruleset-output.json [../match-details-by-rule-id-output.json]

Development

Lint the code:

npm run lint

Run the tests:

npm test