Add TsigTimersOnly function

This commit is contained in:
Miek Gieben 2012-08-27 21:27:49 +02:00
parent c3b9e95d58
commit afd8cbf39d
1 changed files with 8 additions and 3 deletions

View File

@ -22,12 +22,14 @@ type Handler interface {
type ResponseWriter interface { type ResponseWriter interface {
// RemoteAddr returns the net.Addr of the client that sent the current request. // RemoteAddr returns the net.Addr of the client that sent the current request.
RemoteAddr() net.Addr RemoteAddr() net.Addr
// TsigStatus returns the status of the Tsig.
TsigStatus() error
// Write writes a reply back to the client. // Write writes a reply back to the client.
Write(*Msg) error Write(*Msg) error
// WriteBuf writes a raw buffer back to the client. // WriteBuf writes a raw buffer back to the client.
WriteBuf([]byte) error WriteBuf([]byte) error
// TsigStatus returns the status of the Tsig.
TsigStatus() error
// TsigTimersOnly sets the tsig timers only boolean.
TsigTimersOnly(bool)
} }
type conn struct { type conn struct {
@ -336,7 +338,7 @@ func (c *conn) serve() {
w.tsigStatus = ErrKeyAlg w.tsigStatus = ErrKeyAlg
} }
w.tsigStatus = TsigVerify(c.request, w.conn.tsigSecret[secret], "", false) w.tsigStatus = TsigVerify(c.request, w.conn.tsigSecret[secret], "", false)
w.tsigTimersOnly = false // Will this ever be true? w.tsigTimersOnly = false
w.tsigRequestMAC = req.Extra[len(req.Extra)-1].(*RR_TSIG).MAC w.tsigRequestMAC = req.Extra[len(req.Extra)-1].(*RR_TSIG).MAC
} }
w.req = req w.req = req
@ -420,3 +422,6 @@ func (w *response) RemoteAddr() net.Addr { return w.conn.remoteAddr }
// TsigStatus implements the ResponseWriter.TsigStatus method. // TsigStatus implements the ResponseWriter.TsigStatus method.
func (w *response) TsigStatus() error { return w.tsigStatus } func (w *response) TsigStatus() error { return w.tsigStatus }
// TsigTimersOnly implements the ResponseWriter.TsigTimersOnly method.
func (w *response) TsigTimersOnly(b bool) { w.tsigTimersOnly = b }