docs
This commit is contained in:
parent
cef7dc4a31
commit
39e65855b4
|
@ -92,10 +92,16 @@ func (res *Resolver) QueryTsig(q *Msg, tsig *Tsig) (d *Msg, err os.Error) {
|
|||
return in, nil
|
||||
}
|
||||
|
||||
// Perform an incoming Ixfr or Axfr. If the message q's question
|
||||
// section contains an AXFR type an Axfr is performed. If q's question
|
||||
// section contains an IXFR type an Ixfr is performed.
|
||||
func (res *Resolver) Xfr(q *Msg, m chan Xfr) {
|
||||
res.XfrTsig(q, nil, m)
|
||||
}
|
||||
|
||||
// Perform an incoming Ixfr or Axfr with Tsig validation. If the message
|
||||
// q's question section contains an AXFR type an Axfr is performed. If q's question
|
||||
// section contains an IXFR type an Ixfr is performed.
|
||||
func (res *Resolver) XfrTsig(q *Msg, t *Tsig, m chan Xfr) {
|
||||
port, err := check(res, q)
|
||||
if err != nil {
|
||||
|
@ -127,7 +133,6 @@ Server:
|
|||
return
|
||||
}
|
||||
|
||||
// Some assorted checks on the resolver
|
||||
func check(res *Resolver, q *Msg) (port string, err os.Error) {
|
||||
if res.Port == "" {
|
||||
port = "53"
|
||||
|
|
18
tsig.go
18
tsig.go
|
@ -9,9 +9,18 @@ import (
|
|||
"encoding/hex"
|
||||
)
|
||||
|
||||
// Structure used in Read/Write functions to
|
||||
// The structure Tsig is used in Read/Write functions to
|
||||
// add or remove a TSIG on a dns message. See RFC 2845
|
||||
// and RFC 4635.
|
||||
// Basic use pattern of Tsig:
|
||||
//
|
||||
// tsig := new(dns.Tsig)
|
||||
// tsig.Name = "axfr." // The name of the key.
|
||||
// tsig.Algorithm = dns.HmacMD5 // The HMAC to use.
|
||||
// tsig.Fudge = 300 // RFC recommends 300 here.
|
||||
// tsig.TimeSigned = uint64(time.Seconds())
|
||||
// tsig.Secret = "so6ZGir4GPAqINNh9U5c3A==" // Secret encoded in base64.
|
||||
|
||||
type Tsig struct {
|
||||
// The name of the key.
|
||||
Name string
|
||||
|
@ -68,7 +77,7 @@ type timerWireFmt struct {
|
|||
Fudge uint16
|
||||
}
|
||||
|
||||
// In a message and out a new message with the tsig added
|
||||
// Add a Tsig to add message.
|
||||
func (t *Tsig) Generate(msg []byte) ([]byte, os.Error) {
|
||||
rawsecret, err := packBase64([]byte(t.Secret))
|
||||
if err != nil {
|
||||
|
@ -112,10 +121,9 @@ func (t *Tsig) Generate(msg []byte) ([]byte, os.Error) {
|
|||
return send, nil
|
||||
}
|
||||
|
||||
// Verify a TSIG on a message. All relevant data should
|
||||
// be set in the Tsig structure.
|
||||
// Verify a TSIG on a message.
|
||||
// If the signature does not validate err contains the
|
||||
// error. If the it validates...
|
||||
// error. If the it validates err is nil
|
||||
func (t *Tsig) Verify(msg []byte) (bool, os.Error) {
|
||||
rawsecret, err := packBase64([]byte(t.Secret))
|
||||
if err != nil {
|
||||
|
|
7
xfr.go
7
xfr.go
|
@ -8,9 +8,12 @@ import (
|
|||
// error handling??
|
||||
|
||||
// Xfr is used in communicating with *xfr functions.
|
||||
// This structure is returned on the channel.
|
||||
// If Add is true the resource record in RR must be added to
|
||||
// the zone. If Add is false the resource record must be removed.
|
||||
// If err in non nil some error occurred and the transfer must
|
||||
// be considered to have failed.
|
||||
type Xfr struct {
|
||||
Add bool // true is to be added, otherwise false
|
||||
Add bool
|
||||
RR
|
||||
Err os.Error
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue