More naming and some docs
This commit is contained in:
parent
b90da23741
commit
9c9f3646ff
|
@ -102,7 +102,7 @@ func (rd *APAIR) Unpack(buf []byte) (int, error) {
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rd *APAIR) PasteRdata(dest dns.PrivateRdata) error {
|
func (rd *APAIR) CopyRdata(dest dns.PrivateRdata) error {
|
||||||
cp := make([]byte, rd.RdataLen())
|
cp := make([]byte, rd.RdataLen())
|
||||||
_, err := rd.Pack(cp)
|
_, err := rd.Pack(cp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
14
privaterr.go
14
privaterr.go
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
PRIVATE RR
|
||||||
|
|
||||||
|
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
|
||||||
|
can be used, before requesting an official type code from IANA.
|
||||||
|
|
||||||
|
*/
|
||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -11,13 +19,15 @@ import (
|
||||||
type PrivateRdata interface {
|
type PrivateRdata interface {
|
||||||
// String returns the text presentaton of the Rdata of the Private RR.
|
// String returns the text presentaton of the Rdata of the Private RR.
|
||||||
String() string
|
String() string
|
||||||
|
// ParseTextSlice parses the Rdata of the private RR.
|
||||||
ParseTextSlice([]string) error
|
ParseTextSlice([]string) error
|
||||||
// Pack is used when packing a private RR into a buffer.
|
// Pack is used when packing a private RR into a buffer.
|
||||||
Pack([]byte) (int, error)
|
Pack([]byte) (int, error)
|
||||||
// Unpack is used when unpacking a private RR from a buffer.
|
// Unpack is used when unpacking a private RR from a buffer.
|
||||||
// TODO(miek): diff. signature than Pack, see edns0.go for instance.
|
// TODO(miek): diff. signature than Pack, see edns0.go for instance.
|
||||||
Unpack([]byte) (int, error)
|
Unpack([]byte) (int, error)
|
||||||
PasteRdata(PrivateRdata) error
|
// CopyRdata copies the Rdata.
|
||||||
|
CopyRdata(PrivateRdata) error
|
||||||
// RdataLen returns the length in octets of the Rdata.
|
// RdataLen returns the length in octets of the Rdata.
|
||||||
RdataLen() int
|
RdataLen() int
|
||||||
}
|
}
|
||||||
|
@ -55,7 +65,7 @@ func (r *PrivateRR) copy() RR {
|
||||||
newh := r.Hdr.copyHeader()
|
newh := r.Hdr.copyHeader()
|
||||||
rr.Hdr = *newh
|
rr.Hdr = *newh
|
||||||
|
|
||||||
err := r.Data.PasteRdata(rr.Data)
|
err := r.Data.CopyRdata(rr.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("dns: got value that could not be used to copy Private rdata")
|
panic("dns: got value that could not be used to copy Private rdata")
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (rd *ISBN) Unpack(buf []byte) (int, error) {
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rd *ISBN) PasteRdata(dest dns.PrivateRdata) error {
|
func (rd *ISBN) CopyRdata(dest dns.PrivateRdata) error {
|
||||||
isbn, ok := dest.(*ISBN)
|
isbn, ok := dest.(*ISBN)
|
||||||
if !ok {
|
if !ok {
|
||||||
return dns.ErrRdata
|
return dns.ErrRdata
|
||||||
|
@ -127,7 +127,7 @@ func (rd *VERSION) Unpack(buf []byte) (int, error) {
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rd *VERSION) PasteRdata(dest dns.PrivateRdata) error {
|
func (rd *VERSION) CopyRdata(dest dns.PrivateRdata) error {
|
||||||
isbn, ok := dest.(*VERSION)
|
isbn, ok := dest.(*VERSION)
|
||||||
if !ok {
|
if !ok {
|
||||||
return dns.ErrRdata
|
return dns.ErrRdata
|
||||||
|
|
Loading…
Reference in New Issue