Updating server dependancies (#5249)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
ca3211bc04
Коммит
701d1ab638
8
vendor/github.com/miekg/dns/.travis.yml
сгенерированный
поставляемый
8
vendor/github.com/miekg/dns/.travis.yml
сгенерированный
поставляемый
@@ -1,7 +1,13 @@
|
||||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.5
|
||||
- 1.6
|
||||
- 1.7
|
||||
|
||||
before_install:
|
||||
# don't use the miekg/dns when testing forks
|
||||
- mkdir -p $GOPATH/src/github.com/miekg
|
||||
- ln -s $TRAVIS_BUILD_DIR $GOPATH/src/github.com/miekg/ || true
|
||||
|
||||
script:
|
||||
- go test -race -v -bench=.
|
||||
|
||||
5
vendor/github.com/miekg/dns/README.md
сгенерированный
поставляемый
5
vendor/github.com/miekg/dns/README.md
сгенерированный
поставляемый
@@ -1,4 +1,5 @@
|
||||
[](https://travis-ci.org/miekg/dns) [](https://godoc.org/github.com/miekg/dns)
|
||||
[](https://travis-ci.org/miekg/dns)
|
||||
[](https://godoc.org/github.com/miekg/dns)
|
||||
|
||||
# Alternative (more granular) approach to a DNS library
|
||||
|
||||
@@ -12,7 +13,7 @@ can build servers and resolvers with it.
|
||||
|
||||
We try to keep the "master" branch as sane as possible and at the bleeding edge
|
||||
of standards, avoiding breaking changes wherever reasonable. We support the last
|
||||
two versions of Go, currently: 1.5 and 1.6.
|
||||
two versions of Go, currently: 1.6 and 1.7.
|
||||
|
||||
# Goals
|
||||
|
||||
|
||||
4
vendor/github.com/miekg/dns/defaults.go
сгенерированный
поставляемый
4
vendor/github.com/miekg/dns/defaults.go
сгенерированный
поставляемый
@@ -102,11 +102,11 @@ func (dns *Msg) SetAxfr(z string) *Msg {
|
||||
// SetTsig appends a TSIG RR to the message.
|
||||
// This is only a skeleton TSIG RR that is added as the last RR in the
|
||||
// additional section. The Tsig is calculated when the message is being send.
|
||||
func (dns *Msg) SetTsig(z, algo string, fudge, timesigned int64) *Msg {
|
||||
func (dns *Msg) SetTsig(z, algo string, fudge uint16, timesigned int64) *Msg {
|
||||
t := new(TSIG)
|
||||
t.Hdr = RR_Header{z, TypeTSIG, ClassANY, 0, 0}
|
||||
t.Algorithm = algo
|
||||
t.Fudge = 300
|
||||
t.Fudge = fudge
|
||||
t.TimeSigned = uint64(timesigned)
|
||||
t.OrigId = dns.Id
|
||||
dns.Extra = append(dns.Extra, t)
|
||||
|
||||
2
vendor/github.com/miekg/dns/edns.go
сгенерированный
поставляемый
2
vendor/github.com/miekg/dns/edns.go
сгенерированный
поставляемый
@@ -197,7 +197,7 @@ func (e *EDNS0_NSID) String() string { return string(e.Nsid) }
|
||||
// e := new(dns.EDNS0_SUBNET)
|
||||
// e.Code = dns.EDNS0SUBNET
|
||||
// e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
|
||||
// e.NetMask = 32 // 32 for IPV4, 128 for IPv6
|
||||
// e.SourceNetMask = 32 // 32 for IPV4, 128 for IPv6
|
||||
// e.SourceScope = 0
|
||||
// e.Address = net.ParseIP("127.0.0.1").To4() // for IPv4
|
||||
// // e.Address = net.ParseIP("2001:7b8:32a::2") // for IPV6
|
||||
|
||||
29
vendor/github.com/miekg/dns/msg.go
сгенерированный
поставляемый
29
vendor/github.com/miekg/dns/msg.go
сгенерированный
поставляемый
@@ -203,12 +203,6 @@ func packDomainName(s string, msg []byte, off int, compression map[string]int, c
|
||||
bs[j] = bs[j+2]
|
||||
}
|
||||
ls -= 2
|
||||
} else if bs[i] == 't' {
|
||||
bs[i] = '\t'
|
||||
} else if bs[i] == 'r' {
|
||||
bs[i] = '\r'
|
||||
} else if bs[i] == 'n' {
|
||||
bs[i] = '\n'
|
||||
}
|
||||
escapedDot = bs[i] == '.'
|
||||
bsFresh = false
|
||||
@@ -335,10 +329,6 @@ Loop:
|
||||
fallthrough
|
||||
case '"', '\\':
|
||||
s = append(s, '\\', b)
|
||||
case '\t':
|
||||
s = append(s, '\\', 't')
|
||||
case '\r':
|
||||
s = append(s, '\\', 'r')
|
||||
default:
|
||||
if b < 32 || b >= 127 { // unprintable use \DDD
|
||||
var buf [3]byte
|
||||
@@ -431,12 +421,6 @@ func packTxtString(s string, msg []byte, offset int, tmp []byte) (int, error) {
|
||||
if i+2 < len(bs) && isDigit(bs[i]) && isDigit(bs[i+1]) && isDigit(bs[i+2]) {
|
||||
msg[offset] = dddToByte(bs[i:])
|
||||
i += 2
|
||||
} else if bs[i] == 't' {
|
||||
msg[offset] = '\t'
|
||||
} else if bs[i] == 'r' {
|
||||
msg[offset] = '\r'
|
||||
} else if bs[i] == 'n' {
|
||||
msg[offset] = '\n'
|
||||
} else {
|
||||
msg[offset] = bs[i]
|
||||
}
|
||||
@@ -508,12 +492,6 @@ func unpackTxtString(msg []byte, offset int) (string, int, error) {
|
||||
switch b {
|
||||
case '"', '\\':
|
||||
s = append(s, '\\', b)
|
||||
case '\t':
|
||||
s = append(s, `\t`...)
|
||||
case '\r':
|
||||
s = append(s, `\r`...)
|
||||
case '\n':
|
||||
s = append(s, `\n`...)
|
||||
default:
|
||||
if b < 32 || b > 127 { // unprintable
|
||||
var buf [3]byte
|
||||
@@ -781,9 +759,6 @@ func (dns *Msg) Unpack(msg []byte) (err error) {
|
||||
if dh, off, err = unpackMsgHdr(msg, off); err != nil {
|
||||
return err
|
||||
}
|
||||
if off == len(msg) {
|
||||
return ErrTruncated
|
||||
}
|
||||
|
||||
dns.Id = dh.Id
|
||||
dns.Response = (dh.Bits & _QR) != 0
|
||||
@@ -797,6 +772,10 @@ func (dns *Msg) Unpack(msg []byte) (err error) {
|
||||
dns.CheckingDisabled = (dh.Bits & _CD) != 0
|
||||
dns.Rcode = int(dh.Bits & 0xF)
|
||||
|
||||
if off == len(msg) {
|
||||
return ErrTruncated
|
||||
}
|
||||
|
||||
// Optimistically use the count given to us in the header
|
||||
dns.Question = make([]Question, 0, int(dh.Qdcount))
|
||||
|
||||
|
||||
4
vendor/github.com/miekg/dns/msg_generate.go
сгенерированный
поставляемый
4
vendor/github.com/miekg/dns/msg_generate.go
сгенерированный
поставляемый
@@ -117,9 +117,9 @@ return off, err
|
||||
switch {
|
||||
case st.Tag(i) == `dns:"-"`: // ignored
|
||||
case st.Tag(i) == `dns:"cdomain-name"`:
|
||||
fallthrough
|
||||
case st.Tag(i) == `dns:"domain-name"`:
|
||||
o("off, err = PackDomainName(rr.%s, msg, off, compression, compress)\n")
|
||||
case st.Tag(i) == `dns:"domain-name"`:
|
||||
o("off, err = PackDomainName(rr.%s, msg, off, compression, false)\n")
|
||||
case st.Tag(i) == `dns:"a"`:
|
||||
o("off, err = packDataA(rr.%s, msg, off)\n")
|
||||
case st.Tag(i) == `dns:"aaaa"`:
|
||||
|
||||
2
vendor/github.com/miekg/dns/msg_helpers.go
сгенерированный
поставляемый
2
vendor/github.com/miekg/dns/msg_helpers.go
сгенерированный
поставляемый
@@ -263,8 +263,6 @@ func unpackString(msg []byte, off int) (string, int, error) {
|
||||
switch b {
|
||||
case '"', '\\':
|
||||
s = append(s, '\\', b)
|
||||
case '\t', '\r', '\n':
|
||||
s = append(s, b)
|
||||
default:
|
||||
if b < 32 || b > 127 { // unprintable
|
||||
var buf [3]byte
|
||||
|
||||
19
vendor/github.com/miekg/dns/parse_test.go
сгенерированный
поставляемый
19
vendor/github.com/miekg/dns/parse_test.go
сгенерированный
поставляемый
@@ -86,7 +86,7 @@ func TestDomainName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDomainNameAndTXTEscapes(t *testing.T) {
|
||||
tests := []byte{'.', '(', ')', ';', ' ', '@', '"', '\\', '\t', '\r', '\n', 0, 255}
|
||||
tests := []byte{'.', '(', ')', ';', ' ', '@', '"', '\\', 9, 13, 10, 0, 255}
|
||||
for _, b := range tests {
|
||||
rrbytes := []byte{
|
||||
1, b, 0, // owner
|
||||
@@ -127,8 +127,8 @@ func TestTXTEscapeParsing(t *testing.T) {
|
||||
test := [][]string{
|
||||
{`";"`, `";"`},
|
||||
{`\;`, `";"`},
|
||||
{`"\t"`, `"\t"`},
|
||||
{`"\r"`, `"\r"`},
|
||||
{`"\t"`, `"t"`},
|
||||
{`"\r"`, `"r"`},
|
||||
{`"\ "`, `" "`},
|
||||
{`"\;"`, `";"`},
|
||||
{`"\;\""`, `";\""`},
|
||||
@@ -137,8 +137,9 @@ func TestTXTEscapeParsing(t *testing.T) {
|
||||
{`"(a\)"`, `"(a)"`},
|
||||
{`"(a)"`, `"(a)"`},
|
||||
{`"\048"`, `"0"`},
|
||||
{`"\` + "\n" + `"`, `"\n"`},
|
||||
{`"\` + "\r" + `"`, `"\r"`},
|
||||
{`"\` + "\t" + `"`, `"\009"`},
|
||||
{`"\` + "\n" + `"`, `"\010"`},
|
||||
{`"\` + "\r" + `"`, `"\013"`},
|
||||
{`"\` + "\x11" + `"`, `"\017"`},
|
||||
{`"\'"`, `"'"`},
|
||||
}
|
||||
@@ -417,16 +418,16 @@ func TestQuotes(t *testing.T) {
|
||||
tests := map[string]string{
|
||||
`t.example.com. IN TXT "a bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a bc\"",
|
||||
`t.example.com. IN TXT "a
|
||||
bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a\\n bc\"",
|
||||
bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a\\010 bc\"",
|
||||
`t.example.com. IN TXT ""`: "t.example.com.\t3600\tIN\tTXT\t\"\"",
|
||||
`t.example.com. IN TXT "a"`: "t.example.com.\t3600\tIN\tTXT\t\"a\"",
|
||||
`t.example.com. IN TXT "aa"`: "t.example.com.\t3600\tIN\tTXT\t\"aa\"",
|
||||
`t.example.com. IN TXT "aaa" ;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\"",
|
||||
`t.example.com. IN TXT "abc" "DEF"`: "t.example.com.\t3600\tIN\tTXT\t\"abc\" \"DEF\"",
|
||||
`t.example.com. IN TXT "abc" ( "DEF" )`: "t.example.com.\t3600\tIN\tTXT\t\"abc\" \"DEF\"",
|
||||
`t.example.com. IN TXT aaa ;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa \"",
|
||||
`t.example.com. IN TXT aaa aaa;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa aaa\"",
|
||||
`t.example.com. IN TXT aaa aaa`: "t.example.com.\t3600\tIN\tTXT\t\"aaa aaa\"",
|
||||
`t.example.com. IN TXT aaa ;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\"",
|
||||
`t.example.com. IN TXT aaa aaa;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\" \"aaa\"",
|
||||
`t.example.com. IN TXT aaa aaa`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\" \"aaa\"",
|
||||
`t.example.com. IN TXT aaa`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\"",
|
||||
"cid.urn.arpa. NAPTR 100 50 \"s\" \"z3950+I2L+I2C\" \"\" _z3950._tcp.gatech.edu.": "cid.urn.arpa.\t3600\tIN\tNAPTR\t100 50 \"s\" \"z3950+I2L+I2C\" \"\" _z3950._tcp.gatech.edu.",
|
||||
"cid.urn.arpa. NAPTR 100 50 \"s\" \"rcds+I2C\" \"\" _rcds._udp.gatech.edu.": "cid.urn.arpa.\t3600\tIN\tNAPTR\t100 50 \"s\" \"rcds+I2C\" \"\" _rcds._udp.gatech.edu.",
|
||||
|
||||
2
vendor/github.com/miekg/dns/sanitize_test.go
сгенерированный
поставляемый
2
vendor/github.com/miekg/dns/sanitize_test.go
сгенерированный
поставляемый
@@ -65,7 +65,7 @@ func TestNormalizedString(t *testing.T) {
|
||||
tests := map[RR]string{
|
||||
newRR(t, "mIEk.Nl. 3600 IN A 127.0.0.1"): "miek.nl.\tIN\tA\t127.0.0.1",
|
||||
newRR(t, "m\\ iek.nL. 3600 IN A 127.0.0.1"): "m\\ iek.nl.\tIN\tA\t127.0.0.1",
|
||||
newRR(t, "m\\\tIeK.nl. 3600 in A 127.0.0.1"): "m\\tiek.nl.\tIN\tA\t127.0.0.1",
|
||||
newRR(t, "m\\\tIeK.nl. 3600 in A 127.0.0.1"): "m\\009iek.nl.\tIN\tA\t127.0.0.1",
|
||||
}
|
||||
for tc, expected := range tests {
|
||||
n := normalizedString(tc)
|
||||
|
||||
112
vendor/github.com/miekg/dns/scan_rr.go
сгенерированный
поставляемый
112
vendor/github.com/miekg/dns/scan_rr.go
сгенерированный
поставляемый
@@ -64,74 +64,63 @@ func endingToString(c chan lex, errstr, f string) (string, *ParseError, string)
|
||||
return s, nil, l.comment
|
||||
}
|
||||
|
||||
// A remainder of the rdata with embedded spaces, return the parsed string slice (sans the spaces)
|
||||
// or an error
|
||||
// A remainder of the rdata with embedded spaces, split on unquoted whitespace
|
||||
// and return the parsed string slice or an error
|
||||
func endingToTxtSlice(c chan lex, errstr, f string) ([]string, *ParseError, string) {
|
||||
// Get the remaining data until we see a zNewline
|
||||
quote := false
|
||||
l := <-c
|
||||
var s []string
|
||||
if l.err {
|
||||
return s, &ParseError{f, errstr, l}, ""
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
switch l.value == zQuote {
|
||||
case true: // A number of quoted string
|
||||
s = make([]string, 0)
|
||||
empty := true
|
||||
for l.value != zNewline && l.value != zEOF {
|
||||
if l.err {
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
switch l.value {
|
||||
case zString:
|
||||
empty = false
|
||||
if len(l.token) > 255 {
|
||||
// split up tokens that are larger than 255 into 255-chunks
|
||||
sx := []string{}
|
||||
p, i := 0, 255
|
||||
for {
|
||||
if i <= len(l.token) {
|
||||
sx = append(sx, l.token[p:i])
|
||||
} else {
|
||||
sx = append(sx, l.token[p:])
|
||||
break
|
||||
|
||||
}
|
||||
p, i = p+255, i+255
|
||||
}
|
||||
s = append(s, sx...)
|
||||
break
|
||||
}
|
||||
|
||||
s = append(s, l.token)
|
||||
case zBlank:
|
||||
if quote {
|
||||
// zBlank can only be seen in between txt parts.
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
case zQuote:
|
||||
if empty && quote {
|
||||
s = append(s, "")
|
||||
}
|
||||
quote = !quote
|
||||
empty = true
|
||||
default:
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
l = <-c
|
||||
}
|
||||
if quote {
|
||||
// Build the slice
|
||||
s := make([]string, 0)
|
||||
quote := false
|
||||
empty := false
|
||||
for l.value != zNewline && l.value != zEOF {
|
||||
if l.err {
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
case false: // Unquoted text record
|
||||
s = make([]string, 1)
|
||||
for l.value != zNewline && l.value != zEOF {
|
||||
if l.err {
|
||||
return s, &ParseError{f, errstr, l}, ""
|
||||
switch l.value {
|
||||
case zString:
|
||||
empty = false
|
||||
if len(l.token) > 255 {
|
||||
// split up tokens that are larger than 255 into 255-chunks
|
||||
sx := []string{}
|
||||
p, i := 0, 255
|
||||
for {
|
||||
if i <= len(l.token) {
|
||||
sx = append(sx, l.token[p:i])
|
||||
} else {
|
||||
sx = append(sx, l.token[p:])
|
||||
break
|
||||
|
||||
}
|
||||
p, i = p+255, i+255
|
||||
}
|
||||
s = append(s, sx...)
|
||||
break
|
||||
}
|
||||
s[0] += l.token
|
||||
l = <-c
|
||||
|
||||
s = append(s, l.token)
|
||||
case zBlank:
|
||||
if quote {
|
||||
// zBlank can only be seen in between txt parts.
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
case zQuote:
|
||||
if empty && quote {
|
||||
s = append(s, "")
|
||||
}
|
||||
quote = !quote
|
||||
empty = true
|
||||
default:
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
l = <-c
|
||||
}
|
||||
if quote {
|
||||
return nil, &ParseError{f, errstr, l}, ""
|
||||
}
|
||||
return s, nil, l.comment
|
||||
}
|
||||
@@ -2027,9 +2016,12 @@ func setUINFO(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
|
||||
rr.Hdr = h
|
||||
s, e, c1 := endingToTxtSlice(c, "bad UINFO Uinfo", f)
|
||||
if e != nil {
|
||||
return nil, e, ""
|
||||
return nil, e, c1
|
||||
}
|
||||
rr.Uinfo = s[0] // silently discard anything above
|
||||
if ln := len(s); ln == 0 {
|
||||
return rr, nil, c1
|
||||
}
|
||||
rr.Uinfo = s[0] // silently discard anything after the first character-string
|
||||
return rr, nil, c1
|
||||
}
|
||||
|
||||
|
||||
2
vendor/github.com/miekg/dns/server.go
сгенерированный
поставляемый
2
vendor/github.com/miekg/dns/server.go
сгенерированный
поставляемый
@@ -339,7 +339,7 @@ func (srv *Server) ListenAndServe() error {
|
||||
network := "tcp"
|
||||
if srv.Net == "tcp4-tls" {
|
||||
network = "tcp4"
|
||||
} else if srv.Net == "tcp6" {
|
||||
} else if srv.Net == "tcp6-tls" {
|
||||
network = "tcp6"
|
||||
}
|
||||
|
||||
|
||||
40
vendor/github.com/miekg/dns/server_test.go
сгенерированный
поставляемый
40
vendor/github.com/miekg/dns/server_test.go
сгенерированный
поставляемый
@@ -677,3 +677,43 @@ zDCJkckCgYEAndqM5KXGk5xYo+MAA1paZcbTUXwaWwjLU+XSRSSoyBEi5xMtfvUb
|
||||
kFsxKCqxAnBVGEWAvVZAiiTOxleQFjz5RnL0BQp9Lg2cQe+dvuUmIAA=
|
||||
-----END RSA PRIVATE KEY-----`)
|
||||
)
|
||||
|
||||
func testShutdownBindPort(t *testing.T, protocol string, port string) {
|
||||
handler := NewServeMux()
|
||||
handler.HandleFunc(".", func(w ResponseWriter, r *Msg) {})
|
||||
startedCh := make(chan struct{})
|
||||
s := &Server{
|
||||
Addr: net.JoinHostPort("127.0.0.1", port),
|
||||
Net: protocol,
|
||||
Handler: handler,
|
||||
NotifyStartedFunc: func() {
|
||||
startedCh <- struct{}{}
|
||||
},
|
||||
}
|
||||
go func() {
|
||||
if err := s.ListenAndServe(); err != nil {
|
||||
t.Log(err)
|
||||
}
|
||||
}()
|
||||
<-startedCh
|
||||
t.Logf("DNS server is started on: %s", s.Addr)
|
||||
if err := s.Shutdown(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
go func() {
|
||||
if err := s.ListenAndServe(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
<-startedCh
|
||||
t.Logf("DNS server is started on: %s", s.Addr)
|
||||
}
|
||||
|
||||
func TestShutdownBindPortUDP(t *testing.T) {
|
||||
testShutdownBindPort(t, "udp", "1153")
|
||||
}
|
||||
|
||||
func TestShutdownBindPortTCP(t *testing.T) {
|
||||
testShutdownBindPort(t, "tcp", "1154")
|
||||
}
|
||||
|
||||
19
vendor/github.com/miekg/dns/types.go
сгенерированный
поставляемый
19
vendor/github.com/miekg/dns/types.go
сгенерированный
поставляемый
@@ -480,12 +480,6 @@ func appendDomainNameByte(s []byte, b byte) []byte {
|
||||
|
||||
func appendTXTStringByte(s []byte, b byte) []byte {
|
||||
switch b {
|
||||
case '\t':
|
||||
return append(s, '\\', 't')
|
||||
case '\r':
|
||||
return append(s, '\\', 'r')
|
||||
case '\n':
|
||||
return append(s, '\\', 'n')
|
||||
case '"', '\\':
|
||||
return append(s, '\\', b)
|
||||
}
|
||||
@@ -525,17 +519,8 @@ func nextByte(b []byte, offset int) (byte, int) {
|
||||
return dddToByte(b[offset+1:]), 4
|
||||
}
|
||||
}
|
||||
// not \ddd, maybe a control char
|
||||
switch b[offset+1] {
|
||||
case 't':
|
||||
return '\t', 2
|
||||
case 'r':
|
||||
return '\r', 2
|
||||
case 'n':
|
||||
return '\n', 2
|
||||
default:
|
||||
return b[offset+1], 2
|
||||
}
|
||||
// not \ddd, just an RFC 1035 "quoted" character
|
||||
return b[offset+1], 2
|
||||
}
|
||||
|
||||
type SPF struct {
|
||||
|
||||
9
vendor/github.com/miekg/dns/udp_linux.go
сгенерированный
поставляемый
9
vendor/github.com/miekg/dns/udp_linux.go
сгенерированный
поставляемый
@@ -22,14 +22,17 @@ func setUDPSocketOptions4(conn *net.UDPConn) error {
|
||||
return err
|
||||
}
|
||||
if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IP, syscall.IP_PKTINFO, 1); err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
// Calling File() above results in the connection becoming blocking, we must fix that.
|
||||
// See https://github.com/miekg/dns/issues/279
|
||||
err = syscall.SetNonblock(int(file.Fd()), true)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
file.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -40,12 +43,15 @@ func setUDPSocketOptions6(conn *net.UDPConn) error {
|
||||
return err
|
||||
}
|
||||
if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_RECVPKTINFO, 1); err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
err = syscall.SetNonblock(int(file.Fd()), true)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
file.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -59,8 +65,10 @@ func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) {
|
||||
// dual stack. See http://stackoverflow.com/questions/1618240/how-to-support-both-ipv4-and-ipv6-connections
|
||||
v6only, err := syscall.GetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
return false, err
|
||||
}
|
||||
file.Close()
|
||||
return v6only == 1, nil
|
||||
}
|
||||
|
||||
@@ -69,5 +77,6 @@ func getUDPSocketName(conn *net.UDPConn) (syscall.Sockaddr, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
return syscall.Getsockname(int(file.Fd()))
|
||||
}
|
||||
|
||||
34
vendor/github.com/miekg/dns/zmsg.go
сгенерированный
поставляемый
34
vendor/github.com/miekg/dns/zmsg.go
сгенерированный
поставляемый
@@ -221,7 +221,7 @@ func (rr *DNAME) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -447,7 +447,7 @@ func (rr *KX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Exchanger, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Exchanger, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -539,7 +539,7 @@ func (rr *LP) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Fqdn, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Fqdn, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -679,7 +679,7 @@ func (rr *NAPTR) pack(msg []byte, off int, compression map[string]int, compress
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Replacement, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Replacement, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -753,7 +753,7 @@ func (rr *NSAPPTR) pack(msg []byte, off int, compression map[string]int, compres
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Ptr, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Ptr, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -767,7 +767,7 @@ func (rr *NSEC) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.NextDomain, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.NextDomain, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -905,11 +905,11 @@ func (rr *PX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Map822, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Map822, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Mapx400, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Mapx400, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -963,11 +963,11 @@ func (rr *RP) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mbox, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Mbox, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Txt, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Txt, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1009,7 +1009,7 @@ func (rr *RRSIG) pack(msg []byte, off int, compression map[string]int, compress
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1073,7 +1073,7 @@ func (rr *SIG) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1181,7 +1181,7 @@ func (rr *SRV) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1243,11 +1243,11 @@ func (rr *TALINK) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.PreviousName, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.PreviousName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.NextName, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.NextName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1261,7 +1261,7 @@ func (rr *TKEY) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@@ -1333,7 +1333,7 @@ func (rr *TSIG) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, compress)
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user