documentation
This commit is contained in:
parent
9b1e7b4b3d
commit
a0b011799e
|
@ -125,7 +125,7 @@ type Client struct {
|
|||
// LocalAddr string // Local address to use
|
||||
}
|
||||
|
||||
// Create a new client, with some default values filled in.
|
||||
// Create a new client, with some defaults.
|
||||
func NewClient() *Client {
|
||||
c := new(Client)
|
||||
c.Net = "udp"
|
||||
|
|
|
@ -94,7 +94,7 @@ func (dns *Msg) IsIxfr() (ok bool) {
|
|||
return
|
||||
}
|
||||
|
||||
// Has a message a TSIG record as the last record?
|
||||
// Has the message a TSIG record as the last record?
|
||||
func (dns *Msg) IsTsig() (ok bool) {
|
||||
if len(dns.Extra) > 0 {
|
||||
return dns.Extra[0].Header().Rrtype == TypeTSIG
|
||||
|
@ -102,6 +102,7 @@ func (dns *Msg) IsTsig() (ok bool) {
|
|||
return
|
||||
}
|
||||
|
||||
// SetTsig Calculates and appends a TSIG RR on the message.
|
||||
func (dns *Msg) SetTsig(z, algo string, fudge uint16, timesigned uint64) {
|
||||
t := new(RR_TSIG)
|
||||
t.Hdr = RR_Header{z, TypeTSIG, ClassANY, 0, 0}
|
||||
|
|
|
@ -13,8 +13,9 @@ import (
|
|||
}%%
|
||||
|
||||
// PrivateKey parses a private key file as defined in XXX.
|
||||
// A map[string]string is returned with the values. All the keys
|
||||
// are in lowercase. The algorithm is returned as m[algorithm] = "RSASHA1"
|
||||
// A map[string]string is returned with the values. All the keys are
|
||||
// converted to lowercase. All values are returned as-is, except
|
||||
// the algorithm [e.g. 5 (RSASHA1)] is returned as: m[algorithm] = "RSASHA1"
|
||||
func (kp *Parser) PrivateKey() (m map[string]string, err os.Error) {
|
||||
m = make(map[string]string)
|
||||
var (
|
||||
|
|
|
@ -66,7 +66,8 @@ func (f HandlerFunc) ServeDNS(w ResponseWriter, r *Msg) {
|
|||
f(w, r)
|
||||
}
|
||||
|
||||
// Helper handlers
|
||||
// Helper handler that returns an answer with
|
||||
// RCODE = refused for every request.
|
||||
func Refused(w ResponseWriter, r *Msg) {
|
||||
m := new(Msg)
|
||||
m.SetReply(r)
|
||||
|
@ -76,9 +77,10 @@ func Refused(w ResponseWriter, r *Msg) {
|
|||
w.Write(buf)
|
||||
}
|
||||
|
||||
// RefusedHandler return a REFUSED answer
|
||||
// RefusedHandler returns HandlerFunc with Refused.
|
||||
func RefusedHandler() Handler { return HandlerFunc(Refused) }
|
||||
|
||||
// ...
|
||||
func ListenAndServe(addr string, network string, handler Handler) os.Error {
|
||||
server := &Server{Addr: addr, Net: network, Handler: handler}
|
||||
return server.ListenAndServe()
|
||||
|
|
4
tsig.go
4
tsig.go
|
@ -88,9 +88,9 @@ func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) (*Msg, os.
|
|||
return m, nil
|
||||
}
|
||||
|
||||
// Verify a TSIG on a message.
|
||||
// Verify the TSIG on a message.
|
||||
// If the signature does not validate err contains the
|
||||
// error. If the it validates err is nil
|
||||
// error. If it validates err is nil.
|
||||
func TsigVerify(msg []byte, secret, requestMAC string, timersOnly bool) (bool, os.Error) {
|
||||
rawsecret, err := packBase64([]byte(secret))
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue