mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-04 13:47:39 +03:00
Update deps
This commit is contained in:
parent
29c2b76edd
commit
45b915882a
32 changed files with 329 additions and 273 deletions
1
vendor/github.com/miekg/dns/README.md
generated
vendored
1
vendor/github.com/miekg/dns/README.md
generated
vendored
|
@ -28,6 +28,7 @@ A not-so-up-to-date-list-that-may-be-actually-current:
|
|||
* https://github.com/coredns/coredns
|
||||
* https://cloudflare.com
|
||||
* https://github.com/abh/geodns
|
||||
* https://github.com/baidu/bfe
|
||||
* http://www.statdns.com/
|
||||
* http://www.dnsinspect.com/
|
||||
* https://github.com/chuangbo/jianbing-dictionary-dns
|
||||
|
|
37
vendor/github.com/miekg/dns/client.go
generated
vendored
37
vendor/github.com/miekg/dns/client.go
generated
vendored
|
@ -124,15 +124,38 @@ func (c *Client) Dial(address string) (conn *Conn, err error) {
|
|||
// of 512 bytes
|
||||
// To specify a local address or a timeout, the caller has to set the `Client.Dialer`
|
||||
// attribute appropriately
|
||||
|
||||
func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, err error) {
|
||||
co, err := c.Dial(address)
|
||||
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
defer co.Close()
|
||||
return c.ExchangeWithConn(m, co)
|
||||
}
|
||||
|
||||
// ExchangeWithConn has the same behavior as Exchange, just with a predetermined connection
|
||||
// that will be used instead of creating a new one.
|
||||
// Usage pattern with a *dns.Client:
|
||||
// c := new(dns.Client)
|
||||
// // connection management logic goes here
|
||||
//
|
||||
// conn := c.Dial(address)
|
||||
// in, rtt, err := c.ExchangeWithConn(message, conn)
|
||||
//
|
||||
// This allows users of the library to implement their own connection management,
|
||||
// as opposed to Exchange, which will always use new connections and incur the added overhead
|
||||
// that entails when using "tcp" and especially "tcp-tls" clients.
|
||||
func (c *Client) ExchangeWithConn(m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) {
|
||||
if !c.SingleInflight {
|
||||
return c.exchange(m, address)
|
||||
return c.exchange(m, conn)
|
||||
}
|
||||
|
||||
q := m.Question[0]
|
||||
key := fmt.Sprintf("%s:%d:%d", q.Name, q.Qtype, q.Qclass)
|
||||
r, rtt, err, shared := c.group.Do(key, func() (*Msg, time.Duration, error) {
|
||||
return c.exchange(m, address)
|
||||
return c.exchange(m, conn)
|
||||
})
|
||||
if r != nil && shared {
|
||||
r = r.Copy()
|
||||
|
@ -141,15 +164,7 @@ func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, er
|
|||
return r, rtt, err
|
||||
}
|
||||
|
||||
func (c *Client) exchange(m *Msg, a string) (r *Msg, rtt time.Duration, err error) {
|
||||
var co *Conn
|
||||
|
||||
co, err = c.Dial(a)
|
||||
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
defer co.Close()
|
||||
func (c *Client) exchange(m *Msg, co *Conn) (r *Msg, rtt time.Duration, err error) {
|
||||
|
||||
opt := m.IsEdns0()
|
||||
// If EDNS0 is used use that for size.
|
||||
|
|
26
vendor/github.com/miekg/dns/generate.go
generated
vendored
26
vendor/github.com/miekg/dns/generate.go
generated
vendored
|
@ -20,13 +20,13 @@ import (
|
|||
// of $ after that are interpreted.
|
||||
func (zp *ZoneParser) generate(l lex) (RR, bool) {
|
||||
token := l.token
|
||||
step := 1
|
||||
step := int64(1)
|
||||
if i := strings.IndexByte(token, '/'); i >= 0 {
|
||||
if i+1 == len(token) {
|
||||
return zp.setParseError("bad step in $GENERATE range", l)
|
||||
}
|
||||
|
||||
s, err := strconv.Atoi(token[i+1:])
|
||||
s, err := strconv.ParseInt(token[i+1:], 10, 64)
|
||||
if err != nil || s <= 0 {
|
||||
return zp.setParseError("bad step in $GENERATE range", l)
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ func (zp *ZoneParser) generate(l lex) (RR, bool) {
|
|||
return zp.setParseError("bad start-stop in $GENERATE range", l)
|
||||
}
|
||||
|
||||
start, err := strconv.Atoi(sx[0])
|
||||
start, err := strconv.ParseInt(sx[0], 10, 64)
|
||||
if err != nil {
|
||||
return zp.setParseError("bad start in $GENERATE range", l)
|
||||
}
|
||||
|
||||
end, err := strconv.Atoi(sx[1])
|
||||
end, err := strconv.ParseInt(sx[1], 10, 64)
|
||||
if err != nil {
|
||||
return zp.setParseError("bad stop in $GENERATE range", l)
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ func (zp *ZoneParser) generate(l lex) (RR, bool) {
|
|||
r := &generateReader{
|
||||
s: s,
|
||||
|
||||
cur: start,
|
||||
start: start,
|
||||
end: end,
|
||||
step: step,
|
||||
cur: int(start),
|
||||
start: int(start),
|
||||
end: int(end),
|
||||
step: int(step),
|
||||
|
||||
file: zp.file,
|
||||
lex: &l,
|
||||
|
@ -188,7 +188,7 @@ func (r *generateReader) ReadByte() (byte, error) {
|
|||
if errMsg != "" {
|
||||
return 0, r.parseError(errMsg, si+3+sep)
|
||||
}
|
||||
if r.start+offset < 0 || r.end+offset > 1<<31-1 {
|
||||
if r.start+offset < 0 || int64(r.end) + int64(offset) > 1<<31-1 {
|
||||
return 0, r.parseError("bad offset in $GENERATE", si+3+sep)
|
||||
}
|
||||
|
||||
|
@ -229,19 +229,19 @@ func modToPrintf(s string) (string, int, string) {
|
|||
return "", 0, "bad base in $GENERATE"
|
||||
}
|
||||
|
||||
offset, err := strconv.Atoi(offStr)
|
||||
offset, err := strconv.ParseInt(offStr, 10, 64)
|
||||
if err != nil {
|
||||
return "", 0, "bad offset in $GENERATE"
|
||||
}
|
||||
|
||||
width, err := strconv.Atoi(widthStr)
|
||||
width, err := strconv.ParseInt(widthStr, 10, 64)
|
||||
if err != nil || width < 0 || width > 255 {
|
||||
return "", 0, "bad width in $GENERATE"
|
||||
}
|
||||
|
||||
if width == 0 {
|
||||
return "%" + base, offset, ""
|
||||
return "%" + base, int(offset), ""
|
||||
}
|
||||
|
||||
return "%0" + widthStr + base, offset, ""
|
||||
return "%0" + widthStr + base, int(offset), ""
|
||||
}
|
||||
|
|
15
vendor/github.com/miekg/dns/msg.go
generated
vendored
15
vendor/github.com/miekg/dns/msg.go
generated
vendored
|
@ -398,17 +398,12 @@ Loop:
|
|||
return "", lenmsg, ErrLongDomain
|
||||
}
|
||||
for _, b := range msg[off : off+c] {
|
||||
switch b {
|
||||
case '.', '(', ')', ';', ' ', '@':
|
||||
fallthrough
|
||||
case '"', '\\':
|
||||
if isDomainNameLabelSpecial(b) {
|
||||
s = append(s, '\\', b)
|
||||
default:
|
||||
if b < ' ' || b > '~' { // unprintable, use \DDD
|
||||
s = append(s, escapeByte(b)...)
|
||||
} else {
|
||||
s = append(s, b)
|
||||
}
|
||||
} else if b < ' ' || b > '~' {
|
||||
s = append(s, escapeByte(b)...)
|
||||
} else {
|
||||
s = append(s, b)
|
||||
}
|
||||
}
|
||||
s = append(s, '.')
|
||||
|
|
140
vendor/github.com/miekg/dns/msg_helpers.go
generated
vendored
140
vendor/github.com/miekg/dns/msg_helpers.go
generated
vendored
|
@ -423,86 +423,12 @@ Option:
|
|||
if off+int(optlen) > len(msg) {
|
||||
return nil, len(msg), &Error{err: "overflow unpacking opt"}
|
||||
}
|
||||
switch code {
|
||||
case EDNS0NSID:
|
||||
e := new(EDNS0_NSID)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0SUBNET:
|
||||
e := new(EDNS0_SUBNET)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0COOKIE:
|
||||
e := new(EDNS0_COOKIE)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0EXPIRE:
|
||||
e := new(EDNS0_EXPIRE)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0UL:
|
||||
e := new(EDNS0_UL)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0LLQ:
|
||||
e := new(EDNS0_LLQ)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0DAU:
|
||||
e := new(EDNS0_DAU)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0DHU:
|
||||
e := new(EDNS0_DHU)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0N3U:
|
||||
e := new(EDNS0_N3U)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
case EDNS0PADDING:
|
||||
e := new(EDNS0_PADDING)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
default:
|
||||
e := new(EDNS0_LOCAL)
|
||||
e.Code = code
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
e := makeDataOpt(code)
|
||||
if err := e.unpack(msg[off : off+int(optlen)]); err != nil {
|
||||
return nil, len(msg), err
|
||||
}
|
||||
edns = append(edns, e)
|
||||
off += int(optlen)
|
||||
|
||||
if off < len(msg) {
|
||||
goto Option
|
||||
|
@ -511,6 +437,35 @@ Option:
|
|||
return edns, off, nil
|
||||
}
|
||||
|
||||
func makeDataOpt(code uint16) EDNS0 {
|
||||
switch code {
|
||||
case EDNS0NSID:
|
||||
return new(EDNS0_NSID)
|
||||
case EDNS0SUBNET:
|
||||
return new(EDNS0_SUBNET)
|
||||
case EDNS0COOKIE:
|
||||
return new(EDNS0_COOKIE)
|
||||
case EDNS0EXPIRE:
|
||||
return new(EDNS0_EXPIRE)
|
||||
case EDNS0UL:
|
||||
return new(EDNS0_UL)
|
||||
case EDNS0LLQ:
|
||||
return new(EDNS0_LLQ)
|
||||
case EDNS0DAU:
|
||||
return new(EDNS0_DAU)
|
||||
case EDNS0DHU:
|
||||
return new(EDNS0_DHU)
|
||||
case EDNS0N3U:
|
||||
return new(EDNS0_N3U)
|
||||
case EDNS0PADDING:
|
||||
return new(EDNS0_PADDING)
|
||||
default:
|
||||
e := new(EDNS0_LOCAL)
|
||||
e.Code = code
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) {
|
||||
for _, el := range options {
|
||||
b, err := el.pack()
|
||||
|
@ -521,9 +476,7 @@ func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) {
|
|||
binary.BigEndian.PutUint16(msg[off+2:], uint16(len(b))) // Length
|
||||
off += 4
|
||||
if off+len(b) > len(msg) {
|
||||
copy(msg[off:], b)
|
||||
off = len(msg)
|
||||
continue
|
||||
return len(msg), &Error{err: "overflow packing opt"}
|
||||
}
|
||||
// Actual data
|
||||
copy(msg[off:off+len(b)], b)
|
||||
|
@ -783,28 +736,31 @@ func unpackDataAplPrefix(msg []byte, off int) (APLPrefix, int, error) {
|
|||
if int(prefix) > 8*len(ip) {
|
||||
return APLPrefix{}, len(msg), &Error{err: "APL prefix too long"}
|
||||
}
|
||||
|
||||
afdlen := int(nlen & 0x7f)
|
||||
if (int(prefix)+7)/8 != afdlen {
|
||||
return APLPrefix{}, len(msg), &Error{err: "invalid APL address length"}
|
||||
if afdlen > len(ip) {
|
||||
return APLPrefix{}, len(msg), &Error{err: "APL length too long"}
|
||||
}
|
||||
if off+afdlen > len(msg) {
|
||||
return APLPrefix{}, len(msg), &Error{err: "overflow unpacking APL address"}
|
||||
}
|
||||
off += copy(ip, msg[off:off+afdlen])
|
||||
if prefix%8 > 0 {
|
||||
if afdlen > 0 {
|
||||
last := ip[afdlen-1]
|
||||
zero := uint8(0xff) >> (prefix % 8)
|
||||
if last&zero > 0 {
|
||||
if last == 0 {
|
||||
return APLPrefix{}, len(msg), &Error{err: "extra APL address bits"}
|
||||
}
|
||||
}
|
||||
ipnet := net.IPNet{
|
||||
IP: ip,
|
||||
Mask: net.CIDRMask(int(prefix), 8*len(ip)),
|
||||
}
|
||||
network := ipnet.IP.Mask(ipnet.Mask)
|
||||
if !network.Equal(ipnet.IP) {
|
||||
return APLPrefix{}, len(msg), &Error{err: "invalid APL address length"}
|
||||
}
|
||||
|
||||
return APLPrefix{
|
||||
Negation: (nlen & 0x80) != 0,
|
||||
Network: net.IPNet{
|
||||
IP: ip,
|
||||
Mask: net.CIDRMask(int(prefix), 8*len(ip)),
|
||||
},
|
||||
Network: ipnet,
|
||||
}, off, nil
|
||||
}
|
||||
|
|
74
vendor/github.com/miekg/dns/scan.go
generated
vendored
74
vendor/github.com/miekg/dns/scan.go
generated
vendored
|
@ -87,16 +87,6 @@ type lex struct {
|
|||
column int // column in the file
|
||||
}
|
||||
|
||||
// Token holds the token that are returned when a zone file is parsed.
|
||||
type Token struct {
|
||||
// The scanned resource record when error is not nil.
|
||||
RR
|
||||
// When an error occurred, this has the error specifics.
|
||||
Error *ParseError
|
||||
// A potential comment positioned after the RR and on the same line.
|
||||
Comment string
|
||||
}
|
||||
|
||||
// ttlState describes the state necessary to fill in an omitted RR TTL
|
||||
type ttlState struct {
|
||||
ttl uint32 // ttl is the current default TTL
|
||||
|
@ -130,70 +120,6 @@ func ReadRR(r io.Reader, file string) (RR, error) {
|
|||
return rr, zp.Err()
|
||||
}
|
||||
|
||||
// ParseZone reads a RFC 1035 style zonefile from r. It returns
|
||||
// Tokens on the returned channel, each consisting of either a
|
||||
// parsed RR and optional comment or a nil RR and an error. The
|
||||
// channel is closed by ParseZone when the end of r is reached.
|
||||
//
|
||||
// The string file is used in error reporting and to resolve relative
|
||||
// $INCLUDE directives. The string origin is used as the initial
|
||||
// origin, as if the file would start with an $ORIGIN directive.
|
||||
//
|
||||
// The directives $INCLUDE, $ORIGIN, $TTL and $GENERATE are all
|
||||
// supported. Note that $GENERATE's range support up to a maximum of
|
||||
// of 65535 steps.
|
||||
//
|
||||
// Basic usage pattern when reading from a string (z) containing the
|
||||
// zone data:
|
||||
//
|
||||
// for x := range dns.ParseZone(strings.NewReader(z), "", "") {
|
||||
// if x.Error != nil {
|
||||
// // log.Println(x.Error)
|
||||
// } else {
|
||||
// // Do something with x.RR
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Comments specified after an RR (and on the same line!) are
|
||||
// returned too:
|
||||
//
|
||||
// foo. IN A 10.0.0.1 ; this is a comment
|
||||
//
|
||||
// The text "; this is comment" is returned in Token.Comment.
|
||||
// Comments inside the RR are returned concatenated along with the
|
||||
// RR. Comments on a line by themselves are discarded.
|
||||
//
|
||||
// To prevent memory leaks it is important to always fully drain the
|
||||
// returned channel. If an error occurs, it will always be the last
|
||||
// Token sent on the channel.
|
||||
//
|
||||
// Deprecated: New users should prefer the ZoneParser API.
|
||||
func ParseZone(r io.Reader, origin, file string) chan *Token {
|
||||
t := make(chan *Token, 10000)
|
||||
go parseZone(r, origin, file, t)
|
||||
return t
|
||||
}
|
||||
|
||||
func parseZone(r io.Reader, origin, file string, t chan *Token) {
|
||||
defer close(t)
|
||||
|
||||
zp := NewZoneParser(r, origin, file)
|
||||
zp.SetIncludeAllowed(true)
|
||||
|
||||
for rr, ok := zp.Next(); ok; rr, ok = zp.Next() {
|
||||
t <- &Token{RR: rr, Comment: zp.Comment()}
|
||||
}
|
||||
|
||||
if err := zp.Err(); err != nil {
|
||||
pe, ok := err.(*ParseError)
|
||||
if !ok {
|
||||
pe = &ParseError{file: file, err: err.Error()}
|
||||
}
|
||||
|
||||
t <- &Token{Error: pe}
|
||||
}
|
||||
}
|
||||
|
||||
// ZoneParser is a parser for an RFC 1035 style zonefile.
|
||||
//
|
||||
// Each parsed RR in the zone is returned sequentially from Next. An
|
||||
|
|
9
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
9
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
|
@ -1,6 +1,7 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"net"
|
||||
"strconv"
|
||||
|
@ -10,15 +11,15 @@ import (
|
|||
// A remainder of the rdata with embedded spaces, return the parsed string (sans the spaces)
|
||||
// or an error
|
||||
func endingToString(c *zlexer, errstr string) (string, *ParseError) {
|
||||
var s string
|
||||
var buffer bytes.Buffer
|
||||
l, _ := c.Next() // zString
|
||||
for l.value != zNewline && l.value != zEOF {
|
||||
if l.err {
|
||||
return s, &ParseError{"", errstr, l}
|
||||
return buffer.String(), &ParseError{"", errstr, l}
|
||||
}
|
||||
switch l.value {
|
||||
case zString:
|
||||
s += l.token
|
||||
buffer.WriteString(l.token)
|
||||
case zBlank: // Ok
|
||||
default:
|
||||
return "", &ParseError{"", errstr, l}
|
||||
|
@ -26,7 +27,7 @@ func endingToString(c *zlexer, errstr string) (string, *ParseError) {
|
|||
l, _ = c.Next()
|
||||
}
|
||||
|
||||
return s, nil
|
||||
return buffer.String(), nil
|
||||
}
|
||||
|
||||
// A remainder of the rdata with embedded spaces, split on unquoted whitespace
|
||||
|
|
72
vendor/github.com/miekg/dns/types.go
generated
vendored
72
vendor/github.com/miekg/dns/types.go
generated
vendored
|
@ -209,8 +209,11 @@ var CertTypeToString = map[uint16]string{
|
|||
|
||||
//go:generate go run types_generate.go
|
||||
|
||||
// Question holds a DNS question. There can be multiple questions in the
|
||||
// question section of a message. Usually there is just one.
|
||||
// Question holds a DNS question. Usually there is just one. While the
|
||||
// original DNS RFCs allow multiple questions in the question section of a
|
||||
// message, in practice it never works. Because most DNS servers see multiple
|
||||
// questions as an error, it is recommended to only have one question per
|
||||
// message.
|
||||
type Question struct {
|
||||
Name string `dns:"cdomain-name"` // "cdomain-name" specifies encoding (and may be compressed)
|
||||
Qtype uint16
|
||||
|
@ -442,45 +445,38 @@ func sprintName(s string) string {
|
|||
var dst strings.Builder
|
||||
|
||||
for i := 0; i < len(s); {
|
||||
if i+1 < len(s) && s[i] == '\\' && s[i+1] == '.' {
|
||||
if s[i] == '.' {
|
||||
if dst.Len() != 0 {
|
||||
dst.WriteString(s[i : i+2])
|
||||
dst.WriteByte('.')
|
||||
}
|
||||
i += 2
|
||||
i++
|
||||
continue
|
||||
}
|
||||
|
||||
b, n := nextByte(s, i)
|
||||
if n == 0 {
|
||||
i++
|
||||
continue
|
||||
}
|
||||
if b == '.' {
|
||||
if dst.Len() != 0 {
|
||||
dst.WriteByte('.')
|
||||
// Drop "dangling" incomplete escapes.
|
||||
if dst.Len() == 0 {
|
||||
return s[:i]
|
||||
}
|
||||
i += n
|
||||
continue
|
||||
break
|
||||
}
|
||||
switch b {
|
||||
case ' ', '\'', '@', ';', '(', ')', '"', '\\': // additional chars to escape
|
||||
if isDomainNameLabelSpecial(b) {
|
||||
if dst.Len() == 0 {
|
||||
dst.Grow(len(s) * 2)
|
||||
dst.WriteString(s[:i])
|
||||
}
|
||||
dst.WriteByte('\\')
|
||||
dst.WriteByte(b)
|
||||
default:
|
||||
if ' ' <= b && b <= '~' {
|
||||
if dst.Len() != 0 {
|
||||
dst.WriteByte(b)
|
||||
}
|
||||
} else {
|
||||
if dst.Len() == 0 {
|
||||
dst.Grow(len(s) * 2)
|
||||
dst.WriteString(s[:i])
|
||||
}
|
||||
dst.WriteString(escapeByte(b))
|
||||
} else if b < ' ' || b > '~' { // unprintable, use \DDD
|
||||
if dst.Len() == 0 {
|
||||
dst.Grow(len(s) * 2)
|
||||
dst.WriteString(s[:i])
|
||||
}
|
||||
dst.WriteString(escapeByte(b))
|
||||
} else {
|
||||
if dst.Len() != 0 {
|
||||
dst.WriteByte(b)
|
||||
}
|
||||
}
|
||||
i += n
|
||||
|
@ -503,15 +499,10 @@ func sprintTxtOctet(s string) string {
|
|||
}
|
||||
|
||||
b, n := nextByte(s, i)
|
||||
switch {
|
||||
case n == 0:
|
||||
if n == 0 {
|
||||
i++ // dangling back slash
|
||||
case b == '.':
|
||||
dst.WriteByte('.')
|
||||
case b < ' ' || b > '~':
|
||||
dst.WriteString(escapeByte(b))
|
||||
default:
|
||||
dst.WriteByte(b)
|
||||
} else {
|
||||
writeTXTStringByte(&dst, b)
|
||||
}
|
||||
i += n
|
||||
}
|
||||
|
@ -587,6 +578,17 @@ func escapeByte(b byte) string {
|
|||
return escapedByteLarge[int(b)*4 : int(b)*4+4]
|
||||
}
|
||||
|
||||
// isDomainNameLabelSpecial returns true if
|
||||
// a domain name label byte should be prefixed
|
||||
// with an escaping backslash.
|
||||
func isDomainNameLabelSpecial(b byte) bool {
|
||||
switch b {
|
||||
case '.', ' ', '\'', '@', ';', '(', ')', '"', '\\':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func nextByte(s string, offset int) (byte, int) {
|
||||
if offset >= len(s) {
|
||||
return 0, 0
|
||||
|
@ -1118,6 +1120,7 @@ type URI struct {
|
|||
Target string `dns:"octet"`
|
||||
}
|
||||
|
||||
// rr.Target to be parsed as a sequence of character encoded octets according to RFC 3986
|
||||
func (rr *URI) String() string {
|
||||
return rr.Hdr.String() + strconv.Itoa(int(rr.Priority)) +
|
||||
" " + strconv.Itoa(int(rr.Weight)) + " " + sprintTxtOctet(rr.Target)
|
||||
|
@ -1279,6 +1282,7 @@ type CAA struct {
|
|||
Value string `dns:"octet"`
|
||||
}
|
||||
|
||||
// rr.Value Is the character-string encoding of the value field as specified in RFC 1035, Section 5.1.
|
||||
func (rr *CAA) String() string {
|
||||
return rr.Hdr.String() + strconv.Itoa(int(rr.Flag)) + " " + rr.Tag + " " + sprintTxtOctet(rr.Value)
|
||||
}
|
||||
|
|
2
vendor/github.com/miekg/dns/version.go
generated
vendored
2
vendor/github.com/miekg/dns/version.go
generated
vendored
|
@ -3,7 +3,7 @@ package dns
|
|||
import "fmt"
|
||||
|
||||
// Version is current version of this library.
|
||||
var Version = v{1, 1, 29}
|
||||
var Version = v{1, 1, 30}
|
||||
|
||||
// v holds the version of this library.
|
||||
type v struct {
|
||||
|
|
120
vendor/github.com/miekg/dns/zduplicate.go
generated
vendored
120
vendor/github.com/miekg/dns/zduplicate.go
generated
vendored
|
@ -104,6 +104,48 @@ func (r1 *CAA) isDuplicate(_r2 RR) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (r1 *CDNSKEY) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*CDNSKEY)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if r1.Flags != r2.Flags {
|
||||
return false
|
||||
}
|
||||
if r1.Protocol != r2.Protocol {
|
||||
return false
|
||||
}
|
||||
if r1.Algorithm != r2.Algorithm {
|
||||
return false
|
||||
}
|
||||
if r1.PublicKey != r2.PublicKey {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *CDS) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*CDS)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if r1.KeyTag != r2.KeyTag {
|
||||
return false
|
||||
}
|
||||
if r1.Algorithm != r2.Algorithm {
|
||||
return false
|
||||
}
|
||||
if r1.DigestType != r2.DigestType {
|
||||
return false
|
||||
}
|
||||
if r1.Digest != r2.Digest {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *CERT) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*CERT)
|
||||
if !ok {
|
||||
|
@ -172,6 +214,27 @@ func (r1 *DHCID) isDuplicate(_r2 RR) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (r1 *DLV) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*DLV)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if r1.KeyTag != r2.KeyTag {
|
||||
return false
|
||||
}
|
||||
if r1.Algorithm != r2.Algorithm {
|
||||
return false
|
||||
}
|
||||
if r1.DigestType != r2.DigestType {
|
||||
return false
|
||||
}
|
||||
if r1.Digest != r2.Digest {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *DNAME) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*DNAME)
|
||||
if !ok {
|
||||
|
@ -339,6 +402,27 @@ func (r1 *HIP) isDuplicate(_r2 RR) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (r1 *KEY) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*KEY)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if r1.Flags != r2.Flags {
|
||||
return false
|
||||
}
|
||||
if r1.Protocol != r2.Protocol {
|
||||
return false
|
||||
}
|
||||
if r1.Algorithm != r2.Algorithm {
|
||||
return false
|
||||
}
|
||||
if r1.PublicKey != r2.PublicKey {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *KX) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*KX)
|
||||
if !ok {
|
||||
|
@ -849,6 +933,42 @@ func (r1 *RT) isDuplicate(_r2 RR) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (r1 *SIG) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*SIG)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if r1.TypeCovered != r2.TypeCovered {
|
||||
return false
|
||||
}
|
||||
if r1.Algorithm != r2.Algorithm {
|
||||
return false
|
||||
}
|
||||
if r1.Labels != r2.Labels {
|
||||
return false
|
||||
}
|
||||
if r1.OrigTtl != r2.OrigTtl {
|
||||
return false
|
||||
}
|
||||
if r1.Expiration != r2.Expiration {
|
||||
return false
|
||||
}
|
||||
if r1.Inception != r2.Inception {
|
||||
return false
|
||||
}
|
||||
if r1.KeyTag != r2.KeyTag {
|
||||
return false
|
||||
}
|
||||
if !isDuplicateName(r1.SignerName, r2.SignerName) {
|
||||
return false
|
||||
}
|
||||
if r1.Signature != r2.Signature {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *SMIMEA) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*SMIMEA)
|
||||
if !ok {
|
||||
|
|
19
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
19
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
|
@ -685,8 +685,8 @@ func (rr *ANY) copy() RR {
|
|||
}
|
||||
func (rr *APL) copy() RR {
|
||||
Prefixes := make([]APLPrefix, len(rr.Prefixes))
|
||||
for i := range rr.Prefixes {
|
||||
Prefixes[i] = rr.Prefixes[i].copy()
|
||||
for i, e := range rr.Prefixes {
|
||||
Prefixes[i] = e.copy()
|
||||
}
|
||||
return &APL{rr.Hdr, Prefixes}
|
||||
}
|
||||
|
@ -698,6 +698,12 @@ func (rr *AVC) copy() RR {
|
|||
func (rr *CAA) copy() RR {
|
||||
return &CAA{rr.Hdr, rr.Flag, rr.Tag, rr.Value}
|
||||
}
|
||||
func (rr *CDNSKEY) copy() RR {
|
||||
return &CDNSKEY{*rr.DNSKEY.copy().(*DNSKEY)}
|
||||
}
|
||||
func (rr *CDS) copy() RR {
|
||||
return &CDS{*rr.DS.copy().(*DS)}
|
||||
}
|
||||
func (rr *CERT) copy() RR {
|
||||
return &CERT{rr.Hdr, rr.Type, rr.KeyTag, rr.Algorithm, rr.Certificate}
|
||||
}
|
||||
|
@ -712,6 +718,9 @@ func (rr *CSYNC) copy() RR {
|
|||
func (rr *DHCID) copy() RR {
|
||||
return &DHCID{rr.Hdr, rr.Digest}
|
||||
}
|
||||
func (rr *DLV) copy() RR {
|
||||
return &DLV{*rr.DS.copy().(*DS)}
|
||||
}
|
||||
func (rr *DNAME) copy() RR {
|
||||
return &DNAME{rr.Hdr, rr.Target}
|
||||
}
|
||||
|
@ -744,6 +753,9 @@ func (rr *HIP) copy() RR {
|
|||
copy(RendezvousServers, rr.RendezvousServers)
|
||||
return &HIP{rr.Hdr, rr.HitLength, rr.PublicKeyAlgorithm, rr.PublicKeyLength, rr.Hit, rr.PublicKey, RendezvousServers}
|
||||
}
|
||||
func (rr *KEY) copy() RR {
|
||||
return &KEY{*rr.DNSKEY.copy().(*DNSKEY)}
|
||||
}
|
||||
func (rr *KX) copy() RR {
|
||||
return &KX{rr.Hdr, rr.Preference, rr.Exchanger}
|
||||
}
|
||||
|
@ -847,6 +859,9 @@ func (rr *RRSIG) copy() RR {
|
|||
func (rr *RT) copy() RR {
|
||||
return &RT{rr.Hdr, rr.Preference, rr.Host}
|
||||
}
|
||||
func (rr *SIG) copy() RR {
|
||||
return &SIG{*rr.RRSIG.copy().(*RRSIG)}
|
||||
}
|
||||
func (rr *SMIMEA) copy() RR {
|
||||
return &SMIMEA{rr.Hdr, rr.Usage, rr.Selector, rr.MatchingType, rr.Certificate}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue