aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: b06b0c22503e1a074b05015ee8a7dd66f1f7aebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Unbound Ads Generator

A tool to generate Unbound DNS server configuration for blocking advertising domains.

## Overview

This program fetches lists of advertising domains from multiple sources and generates a configuration file for the Unbound DNS server to block these domains. It supports multiple input formats and automatically deduplicates domains.

## Usage

```bash
unbound-ads-generator <url-list> <output-file>
```

Where:
- `url-list` is a URL pointing to a text file containing a list of URLs (one per line) that provide domain lists
- `output-file` is the path where the Unbound configuration will be written

### Input Format

The URL list file should contain URLs (one per line) pointing to domain lists. Lines starting with # are treated as comments.

Example URL list file:
```
# Ad blocking lists
https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts
```

The domain lists can be in either of these formats:
```
# IP and domain format
0.0.0.0 advertising.example.com

# Plain domain format
advertising.example.com
```

### Output Format

The program generates Unbound configuration in this format:
```
local-zone: "advertising.example.com" refuse
local-zone: "another-ad.example.com" refuse
```

## Features

- Supports multiple domain list formats
- Automatically deduplicates domains
- Case-insensitive domain matching
- Progress logging
- Comment handling
- Basic domain validation

## Building

```bash
go build
```

## Testing

```bash
go test -v
```