Documentation and make ParseKey private (parseKey)

This commit is contained in:
Miek Gieben 2012-01-16 21:44:49 +01:00
parent d7400fd503
commit 9f3a1c1f13
6 changed files with 26 additions and 13 deletions

10
dns.go
View File

@ -67,11 +67,11 @@ import (
)
const (
Year68 = 2 << (32 - 1) // For RFC1982 (Serial Arithmetic) calculations in 32 bits.
DefaultMsgSize = 4096 // Standard default for larger than 512 packets.
UDPReceiveMsgSize = 360 // Default buffer size for servers receiving UDP packets.
MaxMsgSize = 65536 // Largest possible DNS packet.
DefaultTtl = 3600 // Default TTL.
Year68 = 1 << 32 // For RFC1982 (Serial Arithmetic) calculations in 32 bits.
DefaultMsgSize = 4096 // Standard default for larger than 512 packets.
UDPReceiveMsgSize = 360 // Default buffer size for servers receiving UDP packets.
MaxMsgSize = 65536 // Largest possible DNS packet.
DefaultTtl = 3600 // Default TTL.
)
// Error represents a DNS error

View File

@ -1,3 +1,10 @@
// Copyright 2012 Miek Gieben. All rights reserved.
// DNSSEC
//
// DNSSEC (DNS Security Extension) adds a layer of security to the DNS. It
// uses public key cryptography to securely sign resource records. The
// public keys are stored in DNSKEY records and the signatures in RRSIG records.
package dns
import (

View File

@ -11,7 +11,7 @@ import (
// ReadPrivateKey reads a private key from the io.Reader q.
func ReadPrivateKey(q io.Reader) (PrivateKey, error) {
m, e := ParseKey(q)
m, e := parseKey(q)
if m == nil {
return nil, e
}
@ -89,9 +89,9 @@ func readPrivateKeyECDSA(m map[string]string) (PrivateKey, error) {
return p, nil
}
// ParseKey reads a private key from r. It returns a map[string]string,
// parseKey reads a private key from r. It returns a map[string]string,
// with the key-value pairs, or an error when the file is not correct.
func ParseKey(r io.Reader) (map[string]string, error) {
func parseKey(r io.Reader) (map[string]string, error) {
var s scanner.Scanner
m := make(map[string]string)
c := make(chan lex)

5
msg.go
View File

@ -175,6 +175,9 @@ var Rcode_str = map[int]string{
// PackDomainName packs a domain name s into msg[off:].
// Domain names are a sequence of counted strings
// split at the dots. They end with a zero-length string.
// If compression is want compress must be true and the compression
// map, needs to hold a mapping between domain names and offsets
// pointing into msg[].
func PackDomainName(s string, msg []byte, off int, compression map[string]int, compress bool) (off1 int, ok bool) {
// Add trailing dot to canonicalize name.
lenmsg := len(msg)
@ -975,7 +978,9 @@ func reverseInt(m map[int]string) map[string]int {
}
// Convert a MsgHdr to a string, mimic the way Dig displays headers:
//
//;; opcode: QUERY, status: NOERROR, id: 48404
//
//;; flags: qr aa rd ra;
func (h *MsgHdr) String() string {
if h == nil {

View File

@ -14,7 +14,7 @@
// secrets["axfr."] = "so6ZGir4GPAqINNh9U5c3A==" // don't forget the . here
//
// The secrets' map index is set to 'axfr.'. This must match the ownername of the
// TSIG records, which in the above example, is also set to 'axfr.'
// TSIG record, which in the above example, is also set to 'axfr.'
//
// The message requesting an AXFR (almost all TSIG usage is when requesting zone transfers)
// for miek.nl with the TSIG record added is now ready to use.
@ -24,7 +24,7 @@
// c.TsigSecret = secrets
// err := c.XfrReceive(m, "85.223.71.124:53")
//
// You can now read the records from the AXFR as the come in. Each envelope is checked with TSIG.
// You can now read the records from the AXFR as they come in. Each envelope is checked with TSIG.
// If something is not correct an error is returned.
//
// Basic use pattern replying to a message that has TSIG set.

View File

@ -1,6 +1,6 @@
// DYNAMIC UPDATES
//
// Dynamic updates reuses the DNS message format, but renames the three of
// Dynamic updates reuses the DNS message format, but renames three of
// the sections. Question is Zone, Answer is Prerequisite, Authority is
// Update, only the Additional is not renamed. See RFC 2136 for the gory details.
//
@ -20,9 +20,10 @@
// zone rrset rr RRset exists (value dep) RRsetUsedRdata
//
// The prerequisite section can also be left empty.
// If you have decided an the prerequisites you can tell what RRs should
// If you have decided on the prerequisites you can tell what RRs should
// be added or deleted. The next table shows the options you have and
// what function to call.
// what functions to call.
//
// 3.4.2.6 - Table Of Metavalues Used In Update Section
//
// CLASS TYPE RDATA Meaning Function