From d2ec1ad4f731708aa5014cba94b7a2d278b11cf5 Mon Sep 17 00:00:00 2001 From: Michal Charemza Date: Fri, 17 Jan 2020 22:22:03 +0000 Subject: [PATCH] (docs) CNAMEs and multiple rules --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index c673b91..fb3e88c 100644 --- a/README.md +++ b/README.md @@ -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'), +)) +```