Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coredns/alternate
Plugin Alternate is able to selectively forward the query to another upstream server, depending the error result provided by the initial resolver
https://github.com/coredns/alternate
Last synced: 3 months ago
JSON representation
Plugin Alternate is able to selectively forward the query to another upstream server, depending the error result provided by the initial resolver
- Host: GitHub
- URL: https://github.com/coredns/alternate
- Owner: coredns
- License: apache-2.0
- Created: 2018-08-10T23:47:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T20:00:08.000Z (7 months ago)
- Last Synced: 2024-04-23T21:12:01.514Z (7 months ago)
- Language: Go
- Size: 291 KB
- Stars: 21
- Watchers: 14
- Forks: 18
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-coredns - alternate - Plugin Alternate is able to selectively forward the query to another upstream server, depending the error result provided by the initial resolver (External Plguins)
README
# alternate
## Name
Plugin *Alternate* is able to selectively forward the query to another upstream server, depending the error result provided by the initial resolver
## Description
The *alternate* plugin allows an alternate set of upstreams be specified which will be used
if the plugin chain returns specific error messages. The *alternate* plugin utilizes the *forward* plugin () to query the specified upstreams.> The *alternate* plugin supports only DNS protocol and random policy w/o additional *forward* parameters, so following directives will fail:
```
. {
forward . 8.8.8.8
alternate NXDOMAIN . tls://192.168.1.1:853 {
policy sequential
}
}
```As the name suggests, the purpose of the *alternate* is to allow a alternate when, for example,
the desired upstreams became unavailable.## Syntax
```
{
alternate [original] RCODE_1[,RCODE_2,RCODE_3...] . DNS_RESOLVERS
}
```* **original** is optional flag. If it is set then alternate uses original request instead of potentially changed by other plugins
* **RCODE** is the string representation of the error response code. The complete list of valid rcode strings are defined as `RcodeToString` in , examples of which are `SERVFAIL`, `NXDOMAIN` and `REFUSED`. At least one rcode is required, but multiple rcodes may be specified, delimited by commas.
* **DNS_RESOLVERS** accepts dns resolvers list.## Building CoreDNS with Alternate
When building CoreDNS with this plugin, _alternate_ should be positioned **before** _forward_ in `/plugin.cfg`.
## Examples
### Alternate to local DNS server
The following specifies that all requests are forwarded to 8.8.8.8. If the response is `NXDOMAIN`, *alternate* will forward the request to 192.168.1.1:53, and reply to client accordingly.
```
. {
forward . 8.8.8.8
alternate NXDOMAIN . 192.168.1.1:53
log
}```
### Alternate with original request usedThe following specify that `original` query will be forwarded to 192.168.1.1:53 if 8.8.8.8 response is `NXDOMAIN`. `original` means no changes from next plugins on request. With no `original` flag alternate will forward request with EDNS0 option (set by rewrite).
```
. {
forward . 8.8.8.8
rewrite edns0 local set 0xffee 0x61626364
alternate original NXDOMAIN . 192.168.1.1:53
log
}```
### Multiple alternates
Multiple alternates can be specified, as long as they serve unique error responses.
```
. {
forward . 8.8.8.8
alternate NXDOMAIN . 192.168.1.1:53
alternate original SERVFAIL,REFUSED . 192.168.100.1:53
log
}```