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 ¶
ErrHandler is the type of a xfer error handler.
type RxMsgHandler ¶
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.