gofmt
This commit is contained in:
parent
2e0a4a5e34
commit
131f6962d1
|
@ -8,11 +8,11 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"os"
|
||||
"bufio"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"net"
|
||||
)
|
||||
|
||||
// Wraps the contents of the /etc/resolv.conf.
|
||||
|
|
14
dnssec.go
14
dnssec.go
|
@ -33,8 +33,8 @@ const (
|
|||
ECCGOST = 12
|
||||
ECDSAP256SHA256 = 13
|
||||
ECDSAP384SHA384 = 14
|
||||
PRIVATEDNS = 253 // Private (experimental keys)
|
||||
PRIVATEOID = 254
|
||||
PRIVATEDNS = 253 // Private (experimental keys)
|
||||
PRIVATEOID = 254
|
||||
)
|
||||
|
||||
// DNSSEC hashing algorithm codes.
|
||||
|
@ -307,9 +307,9 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset RRset) error {
|
|||
signeddata = append(signeddata, wire...)
|
||||
|
||||
sigbuf := s.sigBuf() // Get the binary signature data
|
||||
if s.Algorithm == PRIVATEDNS {
|
||||
// remove the domain name and assume its our
|
||||
}
|
||||
if s.Algorithm == PRIVATEDNS {
|
||||
// remove the domain name and assume its our
|
||||
}
|
||||
|
||||
switch s.Algorithm {
|
||||
case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512, RSAMD5:
|
||||
|
@ -515,6 +515,6 @@ var alg_str = map[uint8]string{
|
|||
ECCGOST: "ECC-GOST",
|
||||
ECDSAP256SHA256: "ECDSAP256SHA256",
|
||||
ECDSAP384SHA384: "ECDSAP384SHA384",
|
||||
PRIVATEDNS: "PRIVATEDNS",
|
||||
PRIVATEOID: "PRIVATEOID",
|
||||
PRIVATEDNS: "PRIVATEDNS",
|
||||
PRIVATEOID: "PRIVATEOID",
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSecure(t *testing.T) {
|
||||
|
|
|
@ -47,12 +47,12 @@ func TestUpdateDelete(t *testing.T) {
|
|||
if e != nil {
|
||||
t.Log("Failed: " + e.Error())
|
||||
t.Fail()
|
||||
return
|
||||
return
|
||||
}
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Log("Failed: " + r.String())
|
||||
t.Fail()
|
||||
return
|
||||
return
|
||||
}
|
||||
t.Log(r.String())
|
||||
}
|
||||
|
|
2
edns.go
2
edns.go
|
@ -1,8 +1,8 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"encoding/hex"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// EDNS0 Option codes.
|
||||
|
|
10
keygen.go
10
keygen.go
|
@ -1,13 +1,13 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"io"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"crypto/rsa"
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"io"
|
||||
"math/big"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Empty interface that is used as a wrapper around all possible
|
||||
|
@ -22,7 +22,7 @@ type PrivateKey interface{}
|
|||
// bits should be set to the size of the algorithm.
|
||||
func (r *RR_DNSKEY) Generate(bits int) (PrivateKey, error) {
|
||||
switch r.Algorithm {
|
||||
case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1:
|
||||
case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1:
|
||||
if bits < 512 || bits > 4096 {
|
||||
return nil, ErrKeySize
|
||||
}
|
||||
|
|
4
msg.go
4
msg.go
|
@ -347,13 +347,13 @@ func packStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok bool)
|
|||
msg[off+1] = byte(fv.Index(13).Uint())
|
||||
msg[off+2] = byte(fv.Index(14).Uint())
|
||||
msg[off+3] = byte(fv.Index(15).Uint())
|
||||
off += net.IPv4len
|
||||
off += net.IPv4len
|
||||
case net.IPv4len:
|
||||
msg[off] = byte(fv.Index(0).Uint())
|
||||
msg[off+1] = byte(fv.Index(1).Uint())
|
||||
msg[off+2] = byte(fv.Index(2).Uint())
|
||||
msg[off+3] = byte(fv.Index(3).Uint())
|
||||
off += net.IPv4len
|
||||
off += net.IPv4len
|
||||
default:
|
||||
}
|
||||
case "AAAA":
|
||||
|
|
2
nsec3.go
2
nsec3.go
|
@ -1,9 +1,9 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"hash"
|
||||
"strings"
|
||||
"crypto/sha1"
|
||||
)
|
||||
|
||||
type saltWireFmt struct {
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
// "os"
|
||||
// "time"
|
||||
// "bufio"
|
||||
"crypto/rsa"
|
||||
"strings"
|
||||
"testing"
|
||||
"crypto/rsa"
|
||||
)
|
||||
|
||||
func TestSign(t *testing.T) {
|
||||
|
|
26
types.go
26
types.go
|
@ -684,10 +684,10 @@ func (rr *RR_NSEC3PARAM) String() string {
|
|||
// saltString converts a NSECX salt to uppercase and
|
||||
// returns "-" when it is empty
|
||||
func saltString(s string) string {
|
||||
if len(s) == 0 {
|
||||
return "-"
|
||||
}
|
||||
return strings.ToUpper(s)
|
||||
if len(s) == 0 {
|
||||
return "-"
|
||||
}
|
||||
return strings.ToUpper(s)
|
||||
}
|
||||
|
||||
// See RFC 4408.
|
||||
|
@ -807,26 +807,26 @@ func (rr *RR_TSIG) String() string {
|
|||
// Translate the RRSIG's incep. and expir. time to the correct date.
|
||||
// Taking into account serial arithmetic (RFC 1982)
|
||||
func timeToDate(t uint32) string {
|
||||
//utc := time.Now().Unix()
|
||||
//utc := time.Now().Unix()
|
||||
//mod := (int64(t) - utc) / Year68
|
||||
|
||||
// If needed assume wrap around(s)
|
||||
return ""
|
||||
/* TODO: new time api
|
||||
return ""
|
||||
/* TODO: new time api
|
||||
ti := time.Unix(int64(t),0).Unix() + (mod * Year68) // abs()? TODO
|
||||
return ti.Format("20060102150405")
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
// Translate the TSIG time signed into a date. There is no
|
||||
// need for RFC1982 calculations as this date is 48 bits
|
||||
func tsigTimeToDate(t uint64) string {
|
||||
// only use the lower 48 bits, TODO(mg), check for 48 bit size
|
||||
return ""
|
||||
/*
|
||||
ti := time.Unix(int64(t), 0).Unix()
|
||||
return ti.Format("20060102150405")
|
||||
*/
|
||||
return ""
|
||||
/*
|
||||
ti := time.Unix(int64(t), 0).Unix()
|
||||
return ti.Format("20060102150405")
|
||||
*/
|
||||
}
|
||||
|
||||
// Map of constructors for each RR wire type.
|
||||
|
|
|
@ -53,7 +53,7 @@ func (u *Msg) Additional() []RR {
|
|||
// NewUpdate creates a new DNS update packet, which is a normal DNS message.
|
||||
func NewUpdate(zone string, class uint16) *Msg {
|
||||
u := new(Msg)
|
||||
u.MsgHdr.Response = false
|
||||
u.MsgHdr.Response = false
|
||||
u.MsgHdr.Opcode = OpcodeUpdate
|
||||
u.Question = make([]Question, 1)
|
||||
u.Question[0] = Question{zone, TypeSOA, class}
|
||||
|
|
16
zparse.go
16
zparse.go
|
@ -7,9 +7,9 @@ package dns
|
|||
import (
|
||||
"io"
|
||||
// "net"
|
||||
"time"
|
||||
"strings"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const _IOBUF = MaxMsgSize
|
||||
|
@ -63,12 +63,12 @@ func dateToTime(s string) (uint32, error) {
|
|||
if e != nil {
|
||||
return 0, e
|
||||
}
|
||||
return 0, nil
|
||||
/*
|
||||
mod := t.Seconds() / Year68
|
||||
ti := uint32(t.Seconds() - (mod * Year68))
|
||||
return ti, nil
|
||||
*/
|
||||
return 0, nil
|
||||
/*
|
||||
mod := t.Seconds() / Year68
|
||||
ti := uint32(t.Seconds() - (mod * Year68))
|
||||
return ti, nil
|
||||
*/
|
||||
}
|
||||
|
||||
// Return the rdata fields as a string slice.
|
||||
|
|
Loading…
Reference in New Issue