Browse Source

(docs) CNAMEs and multiple rules

main
Michal Charemza 5 years ago
parent
commit
d2ec1ad4f7
No known key found for this signature in database GPG Key ID: 4BBAF0F6B73C4363
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      README.md

+ 19
- 0
README.md View File

@@ -2,6 +2,8 @@

A DNS proxy server that conditionally rewrites and filters A record requests. Written in Python, all code is in a single module, and there is a single dependency, [aiodnsresolver](https://github.com/michalc/aiodnsresolver).

CNAMEs are followed and resolved by the proxy to IP addresses, and never returned to the client.


## Usage

@@ -27,3 +29,20 @@ The `rules` parameter must be an iterable [e.g. a list or a tuple] of tuples, wh
- and if no rule matches a REFUSED response is returned downstream.

The response of REFUSED is deliberate for clients to be able to help differentiate between a configuration issue on the proxy, the proxy not working or not being contactable, and a domain actually not existing.

So to rewrite all queries for `www.source.com` to `www.target.com`, and to _refuse_ to proxy any others, you can use the following configuration.

```python
start = DnsProxy(rules=(
(r'^www\.source\.com$', r'www.target.com'),
))
```

Alternatively, do the same rewriting, but to _allow_ all other requests, you can use the following.

```python
start = DnsProxy(rules=(
(r'^www\.source\.com$', r'www.target.com'),
(r'(^.*$)', r'\1'),
))
```

Loading…
Cancel
Save