chore: update deps
This commit is contained in:
parent
95803010d5
commit
d514cf41c3
525 changed files with 43230 additions and 14901 deletions
109
vendor/github.com/miekg/dns/svcb.go
generated
vendored
109
vendor/github.com/miekg/dns/svcb.go
generated
vendored
|
@ -14,7 +14,7 @@ import (
|
|||
// SVCBKey is the type of the keys used in the SVCB RR.
|
||||
type SVCBKey uint16
|
||||
|
||||
// Keys defined in draft-ietf-dnsop-svcb-https-08 Section 14.3.2.
|
||||
// Keys defined in rfc9460
|
||||
const (
|
||||
SVCB_MANDATORY SVCBKey = iota
|
||||
SVCB_ALPN
|
||||
|
@ -23,7 +23,8 @@ const (
|
|||
SVCB_IPV4HINT
|
||||
SVCB_ECHCONFIG
|
||||
SVCB_IPV6HINT
|
||||
SVCB_DOHPATH // draft-ietf-add-svcb-dns-02 Section 9
|
||||
SVCB_DOHPATH // rfc9461 Section 5
|
||||
SVCB_OHTTP // rfc9540 Section 8
|
||||
|
||||
svcb_RESERVED SVCBKey = 65535
|
||||
)
|
||||
|
@ -37,6 +38,7 @@ var svcbKeyToStringMap = map[SVCBKey]string{
|
|||
SVCB_ECHCONFIG: "ech",
|
||||
SVCB_IPV6HINT: "ipv6hint",
|
||||
SVCB_DOHPATH: "dohpath",
|
||||
SVCB_OHTTP: "ohttp",
|
||||
}
|
||||
|
||||
var svcbStringToKeyMap = reverseSVCBKeyMap(svcbKeyToStringMap)
|
||||
|
@ -85,7 +87,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
|
|||
l, _ := c.Next()
|
||||
i, e := strconv.ParseUint(l.token, 10, 16)
|
||||
if e != nil || l.err {
|
||||
return &ParseError{l.token, "bad SVCB priority", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB priority", lex: l}
|
||||
}
|
||||
rr.Priority = uint16(i)
|
||||
|
||||
|
@ -95,7 +97,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
|
|||
|
||||
name, nameOk := toAbsoluteName(l.token, o)
|
||||
if l.err || !nameOk {
|
||||
return &ParseError{l.token, "bad SVCB Target", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB Target", lex: l}
|
||||
}
|
||||
rr.Target = name
|
||||
|
||||
|
@ -111,7 +113,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
|
|||
if !canHaveNextKey {
|
||||
// The key we can now read was probably meant to be
|
||||
// a part of the last value.
|
||||
return &ParseError{l.token, "bad SVCB value quotation", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB value quotation", lex: l}
|
||||
}
|
||||
|
||||
// In key=value pairs, value does not have to be quoted unless value
|
||||
|
@ -124,7 +126,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
|
|||
// Key with no value and no equality sign
|
||||
key = l.token
|
||||
} else if idx == 0 {
|
||||
return &ParseError{l.token, "bad SVCB key", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB key", lex: l}
|
||||
} else {
|
||||
key, value = l.token[:idx], l.token[idx+1:]
|
||||
|
||||
|
@ -144,30 +146,30 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
|
|||
value = l.token
|
||||
l, _ = c.Next()
|
||||
if l.value != zQuote {
|
||||
return &ParseError{l.token, "SVCB unterminated value", l}
|
||||
return &ParseError{file: l.token, err: "SVCB unterminated value", lex: l}
|
||||
}
|
||||
case zQuote:
|
||||
// There's nothing in double quotes.
|
||||
default:
|
||||
return &ParseError{l.token, "bad SVCB value", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB value", lex: l}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
kv := makeSVCBKeyValue(svcbStringToKey(key))
|
||||
if kv == nil {
|
||||
return &ParseError{l.token, "bad SVCB key", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB key", lex: l}
|
||||
}
|
||||
if err := kv.parse(value); err != nil {
|
||||
return &ParseError{l.token, err.Error(), l}
|
||||
return &ParseError{file: l.token, wrappedErr: err, lex: l}
|
||||
}
|
||||
xs = append(xs, kv)
|
||||
case zQuote:
|
||||
return &ParseError{l.token, "SVCB key can't contain double quotes", l}
|
||||
return &ParseError{file: l.token, err: "SVCB key can't contain double quotes", lex: l}
|
||||
case zBlank:
|
||||
canHaveNextKey = true
|
||||
default:
|
||||
return &ParseError{l.token, "bad SVCB values", l}
|
||||
return &ParseError{file: l.token, err: "bad SVCB values", lex: l}
|
||||
}
|
||||
l, _ = c.Next()
|
||||
}
|
||||
|
@ -201,6 +203,8 @@ func makeSVCBKeyValue(key SVCBKey) SVCBKeyValue {
|
|||
return new(SVCBIPv6Hint)
|
||||
case SVCB_DOHPATH:
|
||||
return new(SVCBDoHPath)
|
||||
case SVCB_OHTTP:
|
||||
return new(SVCBOhttp)
|
||||
case svcb_RESERVED:
|
||||
return nil
|
||||
default:
|
||||
|
@ -314,10 +318,11 @@ func (s *SVCBMandatory) unpack(b []byte) error {
|
|||
}
|
||||
|
||||
func (s *SVCBMandatory) parse(b string) error {
|
||||
str := strings.Split(b, ",")
|
||||
codes := make([]SVCBKey, 0, len(str))
|
||||
for _, e := range str {
|
||||
codes = append(codes, svcbStringToKey(e))
|
||||
codes := make([]SVCBKey, 0, strings.Count(b, ",")+1)
|
||||
for len(b) > 0 {
|
||||
var key string
|
||||
key, b, _ = strings.Cut(b, ",")
|
||||
codes = append(codes, svcbStringToKey(key))
|
||||
}
|
||||
s.Code = codes
|
||||
return nil
|
||||
|
@ -613,19 +618,24 @@ func (s *SVCBIPv4Hint) String() string {
|
|||
}
|
||||
|
||||
func (s *SVCBIPv4Hint) parse(b string) error {
|
||||
if b == "" {
|
||||
return errors.New("dns: svcbipv4hint: empty hint")
|
||||
}
|
||||
if strings.Contains(b, ":") {
|
||||
return errors.New("dns: svcbipv4hint: expected ipv4, got ipv6")
|
||||
}
|
||||
str := strings.Split(b, ",")
|
||||
dst := make([]net.IP, len(str))
|
||||
for i, e := range str {
|
||||
|
||||
hint := make([]net.IP, 0, strings.Count(b, ",")+1)
|
||||
for len(b) > 0 {
|
||||
var e string
|
||||
e, b, _ = strings.Cut(b, ",")
|
||||
ip := net.ParseIP(e).To4()
|
||||
if ip == nil {
|
||||
return errors.New("dns: svcbipv4hint: bad ip")
|
||||
}
|
||||
dst[i] = ip
|
||||
hint = append(hint, ip)
|
||||
}
|
||||
s.Hint = dst
|
||||
s.Hint = hint
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -733,9 +743,14 @@ func (s *SVCBIPv6Hint) String() string {
|
|||
}
|
||||
|
||||
func (s *SVCBIPv6Hint) parse(b string) error {
|
||||
str := strings.Split(b, ",")
|
||||
dst := make([]net.IP, len(str))
|
||||
for i, e := range str {
|
||||
if b == "" {
|
||||
return errors.New("dns: svcbipv6hint: empty hint")
|
||||
}
|
||||
|
||||
hint := make([]net.IP, 0, strings.Count(b, ",")+1)
|
||||
for len(b) > 0 {
|
||||
var e string
|
||||
e, b, _ = strings.Cut(b, ",")
|
||||
ip := net.ParseIP(e)
|
||||
if ip == nil {
|
||||
return errors.New("dns: svcbipv6hint: bad ip")
|
||||
|
@ -743,9 +758,9 @@ func (s *SVCBIPv6Hint) parse(b string) error {
|
|||
if ip.To4() != nil {
|
||||
return errors.New("dns: svcbipv6hint: expected ipv6, got ipv4-mapped-ipv6")
|
||||
}
|
||||
dst[i] = ip
|
||||
hint = append(hint, ip)
|
||||
}
|
||||
s.Hint = dst
|
||||
s.Hint = hint
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -760,8 +775,8 @@ func (s *SVCBIPv6Hint) copy() SVCBKeyValue {
|
|||
// SVCBDoHPath pair is used to indicate the URI template that the
|
||||
// clients may use to construct a DNS over HTTPS URI.
|
||||
//
|
||||
// See RFC xxxx (https://datatracker.ietf.org/doc/html/draft-ietf-add-svcb-dns-02)
|
||||
// and RFC yyyy (https://datatracker.ietf.org/doc/html/draft-ietf-add-ddr-06).
|
||||
// See RFC 9461 (https://datatracker.ietf.org/doc/html/rfc9461)
|
||||
// and RFC 9462 (https://datatracker.ietf.org/doc/html/rfc9462).
|
||||
//
|
||||
// A basic example of using the dohpath option together with the alpn
|
||||
// option to indicate support for DNS over HTTPS on a certain path:
|
||||
|
@ -805,6 +820,44 @@ func (s *SVCBDoHPath) copy() SVCBKeyValue {
|
|||
}
|
||||
}
|
||||
|
||||
// The "ohttp" SvcParamKey is used to indicate that a service described in a SVCB RR
|
||||
// can be accessed as a target using an associated gateway.
|
||||
// Both the presentation and wire-format values for the "ohttp" parameter MUST be empty.
|
||||
//
|
||||
// See RFC 9460 (https://datatracker.ietf.org/doc/html/rfc9460/)
|
||||
// and RFC 9230 (https://datatracker.ietf.org/doc/html/rfc9230/)
|
||||
//
|
||||
// A basic example of using the dohpath option together with the alpn
|
||||
// option to indicate support for DNS over HTTPS on a certain path:
|
||||
//
|
||||
// s := new(dns.SVCB)
|
||||
// s.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeSVCB, Class: dns.ClassINET}
|
||||
// e := new(dns.SVCBAlpn)
|
||||
// e.Alpn = []string{"h2", "h3"}
|
||||
// p := new(dns.SVCBOhttp)
|
||||
// s.Value = append(s.Value, e, p)
|
||||
type SVCBOhttp struct{}
|
||||
|
||||
func (*SVCBOhttp) Key() SVCBKey { return SVCB_OHTTP }
|
||||
func (*SVCBOhttp) copy() SVCBKeyValue { return &SVCBOhttp{} }
|
||||
func (*SVCBOhttp) pack() ([]byte, error) { return []byte{}, nil }
|
||||
func (*SVCBOhttp) String() string { return "" }
|
||||
func (*SVCBOhttp) len() int { return 0 }
|
||||
|
||||
func (*SVCBOhttp) unpack(b []byte) error {
|
||||
if len(b) != 0 {
|
||||
return errors.New("dns: svcbotthp: svcbotthp must have no value")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*SVCBOhttp) parse(b string) error {
|
||||
if b != "" {
|
||||
return errors.New("dns: svcbotthp: svcbotthp must have no value")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SVCBLocal pair is intended for experimental/private use. The key is recommended
|
||||
// to be in the range [SVCB_PRIVATE_LOWER, SVCB_PRIVATE_UPPER].
|
||||
// Basic use pattern for creating a keyNNNNN option:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue