Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben 2018-11-28 18:45:19 +00:00
parent 74dbfccc11
commit db37038897
1 changed files with 4 additions and 5 deletions

View File

@ -1,8 +1,7 @@
package dns package dns
// MsgAcceptFunc is used early in the server code to accept or reject a message with RcodeFormatError. // MsgAcceptFunc is used early in the server code to accept or reject a message with RcodeFormatError.
// There are to booleans to be returned, once signaling the rejection and another to signal if // It returns a MsgAcceptAction to indicate what should happen with the message.
// a reply is to be send back (you want to prevent DNS ping-pong and not reply to a response for instance).
type MsgAcceptFunc func(dh Header) MsgAcceptAction type MsgAcceptFunc func(dh Header) MsgAcceptAction
// DefaultMsgAcceptFunc checks the request and will reject if: // DefaultMsgAcceptFunc checks the request and will reject if:
@ -20,9 +19,9 @@ var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc
type MsgAcceptAction int type MsgAcceptAction int
const ( const (
MsgAccept MsgAcceptAction = iota MsgAccept MsgAcceptAction = iota // Accept the message
MsgReject MsgReject // Reject the message with a RcodeFormatError
MsgIgnore MsgIgnore // Ignore the error and send nothing back.
) )
var defaultMsgAcceptFunc = func(dh Header) MsgAcceptAction { var defaultMsgAcceptFunc = func(dh Header) MsgAcceptAction {