dns64

package module
v0.0.0-...-51e22ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

README

dns64

DEPRECATED: This plugin has been merged upstream. Credit goes to @SuperQ.

The dns64 plugin implements the DNS64 IPv6 transition mechanism. From Wikipedia:

DNS64 describes a DNS server that when asked for a domain's AAAA records, but only finds A records, synthesizes the AAAA records from the A records.

The synthesis in only performed if the query came in via IPv6.

TODO

Not all features required by DNS64 are implemented, only basic AAAA synthesis.

  • Support other proxy protocols in the configuration file
    • Requires writing a custom parser for the proxy plugin
  • Support "mapping of separate IPv4 ranges to separate IPv6 prefixes"
  • Resolve PTR records
  • Follow CNAME records
  • Make resolver DNSSEC aware
  • Improve test coverage
  • Improve the hooking method
    • At the moment, the plugin hijacks WriteMsg and does the modifications on the message being written. This very likely can break other plugins especially plugins like DNSSEC.
    • What position should the plugin be?

Usage

The syntax has changed since 20 September 2019. "upstream" has been renamed to proxy

Translate with the well known prefix. Applies to all queries

dns64

Use a custom prefix

dns64 64:1337::/96
# Or 
dns64 {
    prefix 64:1337::/96
}

Use a reverse proxy, with a custom prefix

dns64 {
    proxy . 1.1.1.1 1.0.0.1
    prefix 64:1337::/96
}

Enable translation even if an existing AAAA record is present

dns64 {
    translateAll
}
  • prefix specifies any local IPv6 prefix to use, instead of the well known prefix (64:ff9b::/96)
  • proxy optionally specifies upstream DNS protocol addresses like the proxy plugin

See Also

RFC 6147

Installation

See CoreDNS Documentation for more information on how to include this plugin. A DNS64 example is available too.

Here's the summary:

package main

import (
	_ "github.com/coredns/coredns/core/plugin"
	_ "github.com/coredns/proxy"
	_ "github.com/serverwentdown/dns64"

	"github.com/coredns/coredns/core/dnsserver"
	"github.com/coredns/coredns/coremain"
)

var additionalDirectives = []string{
	"dns64",
	"proxy",
}

func init() {
	dnsserver.Directives = append(dnsserver.Directives, additionalDirectives...)
}

func main() {
	coremain.Run()
}

Documentation

Overview

Package dns64 implements a plugin that performs DNS64.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNS64

type DNS64 struct {
	*proxy.Proxy
	NativeUpstream *upstream.Upstream
	Next           plugin.Handler
	Prefix         *net.IPNet
	TranslateAll   bool // Not comply with 5.1.1
}

DNS64 performs DNS64.

func (DNS64) AnswerRewrite

func (dns64 DNS64) AnswerRewrite(r *dns.Msg, replacement *dns.Msg)

AnswerRewrite turns A responses into AAAA responses

func (DNS64) Name

func (d DNS64) Name() string

Name implements the Handler interface.

func (DNS64) ServeDNS

func (d DNS64) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type ResponseWriter

type ResponseWriter struct {
	dns.ResponseWriter
	DNS64
	// contains filtered or unexported fields
}

ResponseWriter is a response writer that implements DNS64, when an AAAA question returns NODATA, it will try and fetch any A records and synthesize the AAAA records on the fly.

func (*ResponseWriter) Hijack

func (r *ResponseWriter) Hijack()

Hijack implements the dns.ResponseWriter interface.

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(buf []byte) (int, error)

Write implements the dns.ResponseWriter interface.

func (*ResponseWriter) WriteMsg

func (r *ResponseWriter) WriteMsg(res *dns.Msg) error

WriteMsg implements the dns.ResponseWriter interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL