dont export - minimize api

This commit is contained in:
Miek Gieben 2012-08-24 12:42:41 +02:00
parent b96e6ac78d
commit 845f4a6992
9 changed files with 20 additions and 20 deletions

View File

@ -1,7 +1,7 @@
package main
import (
"dns"
"github.com/miekg/dns"
"flag"
"fmt"
"strings"

View File

@ -4,8 +4,8 @@ package main
// address of NAMESERVER
// (c) Miek Gieben - 2011
import (
"dns"
"fmt"
"github.com/miekg/dns"
"os"
)

View File

@ -5,8 +5,8 @@ package main
// this directly from the internet.
// (c) Miek Gieben - 2011
import (
"dns"
"fmt"
"github.com/miekg/dns"
"os"
)

View File

@ -3,8 +3,8 @@ package main
// Print the MX records of a domain
// (c) Miek Gieben - 2011
import (
"dns"
"fmt"
"github.com/miekg/dns"
"os"
)

View File

@ -1,9 +1,9 @@
package main
import (
"dns"
"flag"
"fmt"
"github.com/miekg/dns"
"net"
"os"
"strconv"
@ -202,7 +202,7 @@ Flags:
os.Exit(0)
}
}()
Redo:
Redo:
if r == nil {
return
}

View File

@ -18,9 +18,9 @@
package main
import (
"dns"
"flag"
"fmt"
"github.com/miekg/dns"
"log"
"net"
"os"
@ -107,7 +107,7 @@ func serve(net, name, secret string) {
fmt.Printf("Failed to setup the "+net+" server: %s\n", err.Error())
}
default:
server := &dns.Server{Addr: ":8053", Net: "net", TsigSecret: map[string]string{name: secret} }
server := &dns.Server{Addr: ":8053", Net: "net", TsigSecret: map[string]string{name: secret}}
err := server.ListenAndServe()
if err != nil {
fmt.Printf("Failed to setup the "+net+" server: %s\n", err.Error())

2
msg.go
View File

@ -1066,7 +1066,7 @@ func PackRR(rr RR, msg []byte, off int, compression map[string]int, compress boo
if !ok {
return len(msg), false
}
RawSetRdlength(msg, off, off1)
rawSetRdlength(msg, off, off1)
return off1, true
}

View File

@ -12,31 +12,31 @@ func RawSetId(msg []byte, i uint16) {
msg[0], msg[1] = packUint16(i)
}
// RawSetQuestionLen sets the lenght of the question section.
func RawSetQuestionLen(msg []byte, i uint16) {
// rawSetQuestionLen sets the lenght of the question section.
func rawSetQuestionLen(msg []byte, i uint16) {
msg[4], msg[5] = packUint16(i)
}
// RawSetAnswerLen sets the lenght of the answer section.
func RawSetAnswerLen(msg []byte, i uint16) {
// rawSetAnswerLen sets the lenght of the answer section.
func rawSetAnswerLen(msg []byte, i uint16) {
msg[6], msg[7] = packUint16(i)
}
// RawSetsNsLen sets the lenght of the authority section.
func RawSetNsLen(msg []byte, i uint16) {
// rawSetsNsLen sets the lenght of the authority section.
func rawSetNsLen(msg []byte, i uint16) {
msg[8], msg[9] = packUint16(i)
}
// RawSetExtraLen sets the lenght of the additional section.
func RawSetExtraLen(msg []byte, i uint16) {
// rawSetExtraLen sets the lenght of the additional section.
func rawSetExtraLen(msg []byte, i uint16) {
msg[10], msg[11] = packUint16(i)
}
// RawSetRdlength sets the rdlength in the header of
// rawSetRdlength sets the rdlength in the header of
// the RR. The offset 'off' must be positioned at the
// start of the header of the RR, 'end' must be the
// end of the RR. There is no check if we overrun the buffer.
func RawSetRdlength(msg []byte, off, end int) {
func rawSetRdlength(msg []byte, off, end int) {
Loop:
for {
c := int(msg[off])

View File

@ -200,7 +200,7 @@ func TsigGenerate(m *Msg, secret, requestMAC string, timersOnly bool) ([]byte, s
return nil, "", ErrPack
}
mbuf = append(mbuf, tbuf...)
RawSetExtraLen(mbuf, uint16(len(m.Extra)+1))
rawSetExtraLen(mbuf, uint16(len(m.Extra)+1))
return mbuf, t.MAC, nil
}