xfr

package
v0.0.0-...-8a2913d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 4 Imported by: 0

README

This is a goinstall-able mirror of modified code already published at:
http://git.nic.cz/redmine/projects/godns/repository/show/xfr

Online godoc documentation for this package (should be) available at:
http://gopkgdoc.appspot.com/pkg/github.com/cznic/dns/xfr

Documentation

Overview

Package xfr supports DNS zone transfers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RxAll

func RxAll(conn *net.TCPConn, zone string, msgHandler RxMsgHandler, errHandler ErrHandler) (err error)

RxAll attemtps to perform an AXFR zone 'zone' transfer through conn.

On every msg received the msgHandler is invoked. If this handler returns false then the transfer is aborted and a nil Error is returned. The msgHandler should return false on seeing a message with the 'closing' SOA RR, otherwise the behavior of RxAll us undefined.

If the errHandler is nil then any error in the xfer causes the transfer to be aborted and the error is returned.

If the errHandler is non nil then any error in the xfer is handled over to the errHandler. If the errHandler returns false, the transfer is aborted and the same err is returned. If the error is from sending the initial query then the serial parameter is < 0.

This function *never* closes the conn.

Types

type ErrHandler

type ErrHandler func(serial int, err error) bool

ErrHandler is the type of a xfer error handler.

type Error

type Error struct {
	Reason string
	Msg    *msg.Message
}

Error is the type returned for some xfer errors.

func (*Error) Error

func (e *Error) Error() string

type RxMsgHandler

type RxMsgHandler func(serial int, m *msg.Message) bool

RxMsgHandler is the type of a xfer received message handler.

func HandleRxMsg

func HandleRxMsg(h RxRRHandler) RxMsgHandler

HandleMsg returns a pre-built MsgHandler for RxAll which invokes the provided RRHandler for every DNS RR found in the answer section of 'm'. Usage example:

err := xfr.RxAll(myConn, myZone, HandleMsg(myRRHandler), myErrHandler)

The record handler 'h' sees the first SOA record, and all subsequent RRs including the final, "closing" SOA RR.

type RxRRHandler

type RxRRHandler func(serial int, r *rr.RR) bool

RxRRHandler is the DNS RR handler type of HandleRxMsg. If the handler returns false then the xfer is aborted.

Jump to

Keyboard shortcuts

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