commit
19a768ab4c
|
@ -56,12 +56,16 @@ file example.com.db
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ go get github.com/coredns/coredns
|
$ go get github.com/coredns/coredns
|
||||||
$ go get github.com/serverwentdown/dns64
|
$ go get github.com/serverwentdown/dns64
|
||||||
$ cd $GOPATH/src/github.com/coredns/coredns
|
$ cd $GOPATH/src/github.com/coredns/coredns
|
||||||
$ vim plugin.cfg
|
$ vim plugin.cfg
|
||||||
# Add the line dns64:github.com/serverwentdown/dns64 before the hosts middleware
|
|
||||||
|
Add to end of file:
|
||||||
|
proxy:github.com/coredns/proxy
|
||||||
|
dns64:github.com/serverwentdown/dns64
|
||||||
|
|
||||||
$ go generate
|
$ go generate
|
||||||
$ go build
|
$ go build
|
||||||
$ ./coredns -plugins | grep dns64
|
$ ./coredns -plugins | grep dns64
|
||||||
|
|
12
dns64.go
12
dns64.go
|
@ -2,24 +2,24 @@
|
||||||
package dns64
|
package dns64
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coredns/coredns/plugin"
|
"github.com/coredns/coredns/plugin"
|
||||||
"github.com/coredns/coredns/plugin/pkg/response"
|
"github.com/coredns/coredns/plugin/pkg/response"
|
||||||
"github.com/coredns/coredns/plugin/proxy"
|
|
||||||
"github.com/coredns/coredns/request"
|
"github.com/coredns/coredns/request"
|
||||||
|
"github.com/coredns/proxy"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
"context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// DNS64 performs DNS64.
|
// DNS64 performs DNS64.
|
||||||
type DNS64 struct {
|
type DNS64 struct {
|
||||||
Next plugin.Handler
|
Next plugin.Handler
|
||||||
Proxy proxy.Proxy
|
Proxy proxy.Proxy
|
||||||
Prefix *net.IPNet
|
Prefix *net.IPNet
|
||||||
translateAll bool
|
translateAll bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ func (r *ResponseWriter) WriteMsg(res *dns.Msg) error {
|
||||||
// do not modify if there are AAAA records or NameError. continue if NoData or any other error.
|
// do not modify if there are AAAA records or NameError. continue if NoData or any other error.
|
||||||
ty, _ := response.Typify(res, time.Now().UTC())
|
ty, _ := response.Typify(res, time.Now().UTC())
|
||||||
if ty == response.NoError || ty == response.NameError {
|
if ty == response.NoError || ty == response.NameError {
|
||||||
if hasAAAA(res) && ! r.translateAll {
|
if hasAAAA(res) && !r.translateAll {
|
||||||
return r.ResponseWriter.WriteMsg(res)
|
return r.ResponseWriter.WriteMsg(res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
setup.go
5
setup.go
|
@ -3,11 +3,12 @@ package dns64
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/coredns/coredns/core/dnsserver"
|
"github.com/coredns/coredns/core/dnsserver"
|
||||||
"github.com/coredns/coredns/plugin"
|
"github.com/coredns/coredns/plugin"
|
||||||
"github.com/coredns/coredns/plugin/pkg/parse"
|
|
||||||
clog "github.com/coredns/coredns/plugin/pkg/log"
|
clog "github.com/coredns/coredns/plugin/pkg/log"
|
||||||
"github.com/coredns/coredns/plugin/proxy"
|
"github.com/coredns/coredns/plugin/pkg/parse"
|
||||||
|
"github.com/coredns/proxy"
|
||||||
|
|
||||||
"github.com/mholt/caddy"
|
"github.com/mholt/caddy"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue