Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Spencer Comfort | d8fbd0a755 | |
dnschecktool | f8a185d39e | |
Kian-Meng Ang | 0089167cae | |
Ali Mosajjal | fe20d5d323 | |
Tom Thorogood | 41a7730f43 | |
Miek Gieben | 4bd038eb76 | |
Sam Therapy | caa3fe0583 | |
Miek Gieben | 3b7e0b9bdd | |
Caleb Jasik | 8c643eba82 | |
Simon Elsbrock | 16b12df562 | |
Mike Schinkel | 4822b271aa |
|
@ -15,7 +15,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ jobs:
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|
|
@ -7,16 +7,16 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [ 1.17.x, 1.18.x ]
|
go: [ 1.19.x, 1.20.x ]
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v ./...
|
run: go build -v ./...
|
||||||
|
|
45
LICENSE
45
LICENSE
|
@ -1,30 +1,29 @@
|
||||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2009, The Go Authors. Extensions copyright (c) 2011, Miek Gieben.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are met:
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
notice, this list of conditions and the following disclaimer.
|
list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
in the documentation and/or other materials provided with the
|
this list of conditions and the following disclaimer in the documentation
|
||||||
distribution.
|
and/or other materials provided with the distribution.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
As this is fork of the official Go code the same license applies.
|
|
||||||
Extensions of the original work are copyright (c) 2011 Miek Gieben
|
|
||||||
|
|
|
@ -77,6 +77,9 @@ A not-so-up-to-date-list-that-may-be-actually-current:
|
||||||
* https://ping.sx/dig
|
* https://ping.sx/dig
|
||||||
* https://fleetdeck.io/
|
* https://fleetdeck.io/
|
||||||
* https://github.com/markdingo/autoreverse
|
* https://github.com/markdingo/autoreverse
|
||||||
|
* https://github.com/slackhq/nebula
|
||||||
|
* https://github.com/dnschecktool/dow-proxy
|
||||||
|
* https://dnscheck.tools/
|
||||||
|
|
||||||
|
|
||||||
Send pull request if you want to be listed here.
|
Send pull request if you want to be listed here.
|
||||||
|
|
|
@ -19,7 +19,6 @@ type MsgAcceptFunc func(dh Header) MsgAcceptAction
|
||||||
// * has more than 0 RRs in the Authority section
|
// * has more than 0 RRs in the Authority section
|
||||||
//
|
//
|
||||||
// * has more than 2 RRs in the Additional section
|
// * has more than 2 RRs in the Additional section
|
||||||
//
|
|
||||||
var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc
|
var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc
|
||||||
|
|
||||||
// MsgAcceptAction represents the action to be taken.
|
// MsgAcceptAction represents the action to be taken.
|
||||||
|
|
|
@ -185,7 +185,7 @@ func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, er
|
||||||
// that entails when using "tcp" and especially "tcp-tls" clients.
|
// that entails when using "tcp" and especially "tcp-tls" clients.
|
||||||
//
|
//
|
||||||
// When the singleflight is set for this client the context is _not_ forwarded to the (shared) exchange, to
|
// When the singleflight is set for this client the context is _not_ forwarded to the (shared) exchange, to
|
||||||
// prevent one cancelation from canceling all outstanding requests.
|
// prevent one cancellation from canceling all outstanding requests.
|
||||||
func (c *Client) ExchangeWithConn(m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) {
|
func (c *Client) ExchangeWithConn(m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) {
|
||||||
return c.exchangeWithConnContext(context.Background(), m, conn)
|
return c.exchangeWithConnContext(context.Background(), m, conn)
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ func (c *Client) exchangeWithConnContext(ctx context.Context, m *Msg, conn *Conn
|
||||||
q := m.Question[0]
|
q := m.Question[0]
|
||||||
key := fmt.Sprintf("%s:%d:%d", q.Name, q.Qtype, q.Qclass)
|
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) {
|
r, rtt, err, shared := c.group.Do(key, func() (*Msg, time.Duration, error) {
|
||||||
// When we're doing singleflight we don't want one context cancelation, cancel _all_ outstanding queries.
|
// When we're doing singleflight we don't want one context cancellation, cancel _all_ outstanding queries.
|
||||||
// Hence we ignore the context and use Background().
|
// Hence we ignore the context and use Background().
|
||||||
return c.exchangeContext(context.Background(), m, conn)
|
return c.exchangeContext(context.Background(), m, conn)
|
||||||
})
|
})
|
||||||
|
@ -431,7 +431,6 @@ func ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg, err error)
|
||||||
// co.WriteMsg(m)
|
// co.WriteMsg(m)
|
||||||
// in, _ := co.ReadMsg()
|
// in, _ := co.ReadMsg()
|
||||||
// co.Close()
|
// co.Close()
|
||||||
//
|
|
||||||
func ExchangeConn(c net.Conn, m *Msg) (r *Msg, err error) {
|
func ExchangeConn(c net.Conn, m *Msg) (r *Msg, err error) {
|
||||||
println("dns: ExchangeConn: this function is deprecated")
|
println("dns: ExchangeConn: this function is deprecated")
|
||||||
co := new(Conn)
|
co := new(Conn)
|
||||||
|
|
|
@ -63,7 +63,7 @@ func TestTrimDomainName(t *testing.T) {
|
||||||
// Paranoid tests.
|
// Paranoid tests.
|
||||||
// These test shouldn't be needed but I was weary of off-by-one errors.
|
// These test shouldn't be needed but I was weary of off-by-one errors.
|
||||||
// In theory, these can't happen because there are no single-letter TLDs,
|
// In theory, these can't happen because there are no single-letter TLDs,
|
||||||
// but it is good to exercize the code this way.
|
// but it is good to exercise the code this way.
|
||||||
tests := []struct{ experiment, expected string }{
|
tests := []struct{ experiment, expected string }{
|
||||||
{"", "@"},
|
{"", "@"},
|
||||||
{".", "."},
|
{".", "."},
|
||||||
|
|
14
doc.go
14
doc.go
|
@ -72,7 +72,7 @@ and port to use for the connection:
|
||||||
Port: 12345,
|
Port: 12345,
|
||||||
Zone: "",
|
Zone: "",
|
||||||
}
|
}
|
||||||
c.Dialer := &net.Dialer{
|
c.Dialer = &net.Dialer{
|
||||||
Timeout: 200 * time.Millisecond,
|
Timeout: 200 * time.Millisecond,
|
||||||
LocalAddr: &laddr,
|
LocalAddr: &laddr,
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ the Answer section:
|
||||||
// do something with t.Txt
|
// do something with t.Txt
|
||||||
}
|
}
|
||||||
|
|
||||||
Domain Name and TXT Character String Representations
|
# Domain Name and TXT Character String Representations
|
||||||
|
|
||||||
Both domain names and TXT character strings are converted to presentation form
|
Both domain names and TXT character strings are converted to presentation form
|
||||||
both when unpacked and when converted to strings.
|
both when unpacked and when converted to strings.
|
||||||
|
@ -108,7 +108,7 @@ be escaped. Bytes below 32 and above 127 will be converted to \DDD form.
|
||||||
For domain names, in addition to the above rules brackets, periods, spaces,
|
For domain names, in addition to the above rules brackets, periods, spaces,
|
||||||
semicolons and the at symbol are escaped.
|
semicolons and the at symbol are escaped.
|
||||||
|
|
||||||
DNSSEC
|
# DNSSEC
|
||||||
|
|
||||||
DNSSEC (DNS Security Extension) adds a layer of security to the DNS. It uses
|
DNSSEC (DNS Security Extension) adds a layer of security to the DNS. It uses
|
||||||
public key cryptography to sign resource records. The public keys are stored in
|
public key cryptography to sign resource records. The public keys are stored in
|
||||||
|
@ -122,7 +122,7 @@ bit to a request.
|
||||||
|
|
||||||
Signature generation, signature verification and key generation are all supported.
|
Signature generation, signature verification and key generation are all supported.
|
||||||
|
|
||||||
DYNAMIC UPDATES
|
# DYNAMIC UPDATES
|
||||||
|
|
||||||
Dynamic updates reuses the DNS message format, but renames three of the
|
Dynamic updates reuses the DNS message format, but renames three of the
|
||||||
sections. Question is Zone, Answer is Prerequisite, Authority is Update, only
|
sections. Question is Zone, Answer is Prerequisite, Authority is Update, only
|
||||||
|
@ -156,7 +156,7 @@ shows the options you have and what functions to call.
|
||||||
NONE rrset rr Delete an RR from RRset dns.Remove
|
NONE rrset rr Delete an RR from RRset dns.Remove
|
||||||
zone rrset rr Add to an RRset dns.Insert
|
zone rrset rr Add to an RRset dns.Insert
|
||||||
|
|
||||||
TRANSACTION SIGNATURE
|
# TRANSACTION SIGNATURE
|
||||||
|
|
||||||
An TSIG or transaction signature adds a HMAC TSIG record to each message sent.
|
An TSIG or transaction signature adds a HMAC TSIG record to each message sent.
|
||||||
The supported algorithms include: HmacSHA1, HmacSHA256 and HmacSHA512.
|
The supported algorithms include: HmacSHA1, HmacSHA256 and HmacSHA512.
|
||||||
|
@ -239,7 +239,7 @@ Basic use pattern validating and replying to a message that has TSIG set.
|
||||||
w.WriteMsg(m)
|
w.WriteMsg(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIVATE RRS
|
# PRIVATE RRS
|
||||||
|
|
||||||
RFC 6895 sets aside a range of type codes for private use. This range is 65,280
|
RFC 6895 sets aside a range of type codes for private use. This range is 65,280
|
||||||
- 65,534 (0xFF00 - 0xFFFE). When experimenting with new Resource Records these
|
- 65,534 (0xFF00 - 0xFFFE). When experimenting with new Resource Records these
|
||||||
|
@ -248,7 +248,7 @@ can be used, before requesting an official type code from IANA.
|
||||||
See https://miek.nl/2014/september/21/idn-and-private-rr-in-go-dns/ for more
|
See https://miek.nl/2014/september/21/idn-and-private-rr-in-go-dns/ for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
EDNS0
|
# EDNS0
|
||||||
|
|
||||||
EDNS0 is an extension mechanism for the DNS defined in RFC 2671 and updated by
|
EDNS0 is an extension mechanism for the DNS defined in RFC 2671 and updated by
|
||||||
RFC 6891. It defines a new RR type, the OPT RR, which is then completely
|
RFC 6891. It defines a new RR type, the OPT RR, which is then completely
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// types_generate.go is meant to run with go generate. It will use
|
// types_generate.go is meant to run with go generate. It will use
|
||||||
|
|
7
edns.go
7
edns.go
|
@ -80,6 +80,9 @@ func (rr *OPT) String() string {
|
||||||
} else {
|
} else {
|
||||||
s += "flags:; "
|
s += "flags:; "
|
||||||
}
|
}
|
||||||
|
if rr.Hdr.Ttl&0x7FFF != 0 {
|
||||||
|
s += fmt.Sprintf("MBZ: 0x%04x, ", rr.Hdr.Ttl&0x7FFF)
|
||||||
|
}
|
||||||
s += "udp: " + strconv.Itoa(int(rr.UDPSize()))
|
s += "udp: " + strconv.Itoa(int(rr.UDPSize()))
|
||||||
|
|
||||||
for _, o := range rr.Option {
|
for _, o := range rr.Option {
|
||||||
|
@ -98,6 +101,8 @@ func (rr *OPT) String() string {
|
||||||
s += "\n; SUBNET: " + o.String()
|
s += "\n; SUBNET: " + o.String()
|
||||||
case *EDNS0_COOKIE:
|
case *EDNS0_COOKIE:
|
||||||
s += "\n; COOKIE: " + o.String()
|
s += "\n; COOKIE: " + o.String()
|
||||||
|
case *EDNS0_EXPIRE:
|
||||||
|
s += "\n; EXPIRE: " + o.String()
|
||||||
case *EDNS0_TCP_KEEPALIVE:
|
case *EDNS0_TCP_KEEPALIVE:
|
||||||
s += "\n; KEEPALIVE: " + o.String()
|
s += "\n; KEEPALIVE: " + o.String()
|
||||||
case *EDNS0_UL:
|
case *EDNS0_UL:
|
||||||
|
@ -258,7 +263,7 @@ func (e *EDNS0_NSID) copy() EDNS0 { return &EDNS0_NSID{e.Code, e.Nsid}
|
||||||
// o.Hdr.Name = "."
|
// o.Hdr.Name = "."
|
||||||
// o.Hdr.Rrtype = dns.TypeOPT
|
// o.Hdr.Rrtype = dns.TypeOPT
|
||||||
// e := new(dns.EDNS0_SUBNET)
|
// e := new(dns.EDNS0_SUBNET)
|
||||||
// e.Code = dns.EDNS0SUBNET
|
// e.Code = dns.EDNS0SUBNET // by default this is filled in through unpacking OPT packets (unpackDataOpt)
|
||||||
// e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
|
// e.Family = 1 // 1 for IPv4 source address, 2 for IPv6
|
||||||
// e.SourceNetmask = 32 // 32 for IPV4, 128 for IPv6
|
// e.SourceNetmask = 32 // 32 for IPV4, 128 for IPv6
|
||||||
// e.SourceScope = 0
|
// e.SourceScope = 0
|
||||||
|
|
1
fuzz.go
1
fuzz.go
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build fuzz
|
||||||
// +build fuzz
|
// +build fuzz
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
|
@ -122,7 +122,7 @@ func Split(s string) []int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextLabel returns the index of the start of the next label in the
|
// NextLabel returns the index of the start of the next label in the
|
||||||
// string s starting at offset.
|
// string s starting at offset. A negative offset will cause a panic.
|
||||||
// The bool end is true when the end of the string has been reached.
|
// The bool end is true when the end of the string has been reached.
|
||||||
// Also see PrevLabel.
|
// Also see PrevLabel.
|
||||||
func NextLabel(s string, offset int) (i int, end bool) {
|
func NextLabel(s string, offset int) (i int, end bool) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !go1.11 || (!aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd)
|
||||||
// +build !go1.11 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
|
// +build !go1.11 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build go1.11 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd)
|
||||||
// +build go1.11
|
// +build go1.11
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// msg_generate.go is meant to run with go generate. It will use
|
// msg_generate.go is meant to run with go generate. It will use
|
||||||
|
|
|
@ -18,7 +18,7 @@ func TestRequestTruncateAnswer(t *testing.T) {
|
||||||
|
|
||||||
reply.Truncate(MinMsgSize)
|
reply.Truncate(MinMsgSize)
|
||||||
if want, got := MinMsgSize, reply.Len(); want < got {
|
if want, got := MinMsgSize, reply.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
if !reply.Truncated {
|
if !reply.Truncated {
|
||||||
t.Errorf("truncated bit should be set")
|
t.Errorf("truncated bit should be set")
|
||||||
|
@ -38,7 +38,7 @@ func TestRequestTruncateExtra(t *testing.T) {
|
||||||
|
|
||||||
reply.Truncate(MinMsgSize)
|
reply.Truncate(MinMsgSize)
|
||||||
if want, got := MinMsgSize, reply.Len(); want < got {
|
if want, got := MinMsgSize, reply.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
if !reply.Truncated {
|
if !reply.Truncated {
|
||||||
t.Errorf("truncated bit should be set")
|
t.Errorf("truncated bit should be set")
|
||||||
|
@ -62,7 +62,7 @@ func TestRequestTruncateExtraEdns0(t *testing.T) {
|
||||||
|
|
||||||
reply.Truncate(size)
|
reply.Truncate(size)
|
||||||
if want, got := size, reply.Len(); want < got {
|
if want, got := size, reply.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
if !reply.Truncated {
|
if !reply.Truncated {
|
||||||
t.Errorf("truncated bit should be set")
|
t.Errorf("truncated bit should be set")
|
||||||
|
@ -94,7 +94,7 @@ func TestRequestTruncateExtraRegression(t *testing.T) {
|
||||||
|
|
||||||
reply.Truncate(size)
|
reply.Truncate(size)
|
||||||
if want, got := size, reply.Len(); want < got {
|
if want, got := size, reply.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
if !reply.Truncated {
|
if !reply.Truncated {
|
||||||
t.Errorf("truncated bit should be set")
|
t.Errorf("truncated bit should be set")
|
||||||
|
@ -130,7 +130,7 @@ func TestTruncation(t *testing.T) {
|
||||||
|
|
||||||
copy.Truncate(bufsize)
|
copy.Truncate(bufsize)
|
||||||
if want, got := bufsize, copy.Len(); want < got {
|
if want, got := bufsize, copy.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ func TestRequestTruncateAnswerExact(t *testing.T) {
|
||||||
|
|
||||||
reply.Truncate(size)
|
reply.Truncate(size)
|
||||||
if want, got := size, reply.Len(); want < got {
|
if want, got := size, reply.Len(); want < got {
|
||||||
t.Errorf("message length should be bellow %d bytes, got %d bytes", want, got)
|
t.Errorf("message length should be below %d bytes, got %d bytes", want, got)
|
||||||
}
|
}
|
||||||
if expected := 52; len(reply.Answer) != expected {
|
if expected := 52; len(reply.Answer) != expected {
|
||||||
t.Errorf("wrong number of answers; expected %d, got %d", expected, len(reply.Answer))
|
t.Errorf("wrong number of answers; expected %d, got %d", expected, len(reply.Answer))
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
const maxTCPQueries = 128
|
const maxTCPQueries = 128
|
||||||
|
|
||||||
// aLongTimeAgo is a non-zero time, far in the past, used for
|
// aLongTimeAgo is a non-zero time, far in the past, used for
|
||||||
// immediate cancelation of network operations.
|
// immediate cancellation of network operations.
|
||||||
var aLongTimeAgo = time.Unix(1, 0)
|
var aLongTimeAgo = time.Unix(1, 0)
|
||||||
|
|
||||||
// Handler is implemented by any value that implements ServeDNS.
|
// Handler is implemented by any value that implements ServeDNS.
|
||||||
|
|
2
svcb.go
2
svcb.go
|
@ -353,7 +353,7 @@ func (*SVCBAlpn) Key() SVCBKey { return SVCB_ALPN }
|
||||||
func (s *SVCBAlpn) String() string {
|
func (s *SVCBAlpn) String() string {
|
||||||
// An ALPN value is a comma-separated list of values, each of which can be
|
// An ALPN value is a comma-separated list of values, each of which can be
|
||||||
// an arbitrary binary value. In order to allow parsing, the comma and
|
// an arbitrary binary value. In order to allow parsing, the comma and
|
||||||
// backslash characters are themselves excaped.
|
// backslash characters are themselves escaped.
|
||||||
//
|
//
|
||||||
// However, this escaping is done in addition to the normal escaping which
|
// However, this escaping is done in addition to the normal escaping which
|
||||||
// happens in zone files, meaning that these values must be
|
// happens in zone files, meaning that these values must be
|
||||||
|
|
1
tools.go
1
tools.go
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build tools
|
||||||
// +build tools
|
// +build tools
|
||||||
|
|
||||||
// We include our tool dependencies for `go generate` here to ensure they're
|
// We include our tool dependencies for `go generate` here to ensure they're
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// types_generate.go is meant to run with go generate. It will use
|
// types_generate.go is meant to run with go generate. It will use
|
||||||
|
|
1
udp.go
1
udp.go
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build linux && !appengine
|
||||||
// +build linux,!appengine
|
// +build linux,!appengine
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
package dns
|
package dns
|
||||||
|
|
|
@ -92,7 +92,7 @@ func TestRemoveRRset(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPreReqAndRemovals(t *testing.T) {
|
func TestPreReqAndRemovals(t *testing.T) {
|
||||||
// Build a list of multiple prereqs and then somes removes followed by an insert.
|
// Build a list of multiple prereqs and then some removes followed by an insert.
|
||||||
// We should be able to add multiple prereqs and updates.
|
// We should be able to add multiple prereqs and updates.
|
||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.SetUpdate("example.org.")
|
m.SetUpdate("example.org.")
|
||||||
|
|
1
xfr.go
1
xfr.go
|
@ -44,7 +44,6 @@ func (t *Transfer) tsigProvider() TsigProvider {
|
||||||
// dnscon := &dns.Conn{Conn:con}
|
// dnscon := &dns.Conn{Conn:con}
|
||||||
// transfer = &dns.Transfer{Conn: dnscon}
|
// transfer = &dns.Transfer{Conn: dnscon}
|
||||||
// channel, err := transfer.In(message, master)
|
// channel, err := transfer.In(message, master)
|
||||||
//
|
|
||||||
func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) {
|
func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) {
|
||||||
switch q.Question[0].Qtype {
|
switch q.Question[0].Qtype {
|
||||||
case TypeAXFR, TypeIXFR:
|
case TypeAXFR, TypeIXFR:
|
||||||
|
|
Loading…
Reference in New Issue