Docs
This commit is contained in:
parent
be7100cb02
commit
784713d0e0
7
msg.go
7
msg.go
|
@ -286,7 +286,7 @@ End:
|
||||||
// In theory, the pointers are only allowed to jump backward.
|
// In theory, the pointers are only allowed to jump backward.
|
||||||
// We let them jump anywhere and stop jumping after a while.
|
// We let them jump anywhere and stop jumping after a while.
|
||||||
|
|
||||||
// UnpackDomainName unpack a domain name.
|
// UnpackDomainName unpacks a domain name into a string.
|
||||||
func UnpackDomainName(msg []byte, off int) (s string, off1 int, ok bool) {
|
func UnpackDomainName(msg []byte, off int) (s string, off1 int, ok bool) {
|
||||||
s = ""
|
s = ""
|
||||||
lenmsg := len(msg)
|
lenmsg := len(msg)
|
||||||
|
@ -1041,7 +1041,8 @@ func (h *MsgHdr) String() string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pack a msg: convert it to wire format.
|
// Pack packs a Msg: it is converted to to wire format.
|
||||||
|
// If the dns.Compress is true the message will be in compressed wire format.
|
||||||
func (dns *Msg) Pack() (msg []byte, ok bool) {
|
func (dns *Msg) Pack() (msg []byte, ok bool) {
|
||||||
var dh Header
|
var dh Header
|
||||||
compression := make(map[string]int) // Compression pointer mappings
|
compression := make(map[string]int) // Compression pointer mappings
|
||||||
|
@ -1109,7 +1110,7 @@ func (dns *Msg) Pack() (msg []byte, ok bool) {
|
||||||
return msg[:off], true
|
return msg[:off], true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unpack a binary message to a Msg structure.
|
// Unpack unpacks a binary message to a Msg structure.
|
||||||
func (dns *Msg) Unpack(msg []byte) bool {
|
func (dns *Msg) Unpack(msg []byte) bool {
|
||||||
// Header.
|
// Header.
|
||||||
var dh Header
|
var dh Header
|
||||||
|
|
|
@ -125,7 +125,7 @@ func (u *Msg) RRsetNotUsed(rr []RR) {
|
||||||
// NONE rrset rr Delete an RR from RRset RRsetDeleteRR
|
// NONE rrset rr Delete an RR from RRset RRsetDeleteRR
|
||||||
// zone rrset rr Add to an RRset RRsetAddRdata
|
// zone rrset rr Add to an RRset RRsetAddRdata
|
||||||
|
|
||||||
// RRsetAddRdata adds an complete RRset, see RFC 2136 section 2.5.1
|
// RRsetAddRdata creates a dynamic update packet that adds an complete RRset, see RFC 2136 section 2.5.1
|
||||||
func (u *Msg) RRsetAddRdata(rr []RR) {
|
func (u *Msg) RRsetAddRdata(rr []RR) {
|
||||||
if len(u.Question) == 0 {
|
if len(u.Question) == 0 {
|
||||||
panic("empty question section")
|
panic("empty question section")
|
||||||
|
@ -137,7 +137,7 @@ func (u *Msg) RRsetAddRdata(rr []RR) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RRsetDelete deletes an RRset, see RFC 2136 section 2.5.2
|
// RRsetDelete creates a dynamic update packet that deletes an RRset, see RFC 2136 section 2.5.2
|
||||||
func (u *Msg) RRsetDelete(rr []RR) {
|
func (u *Msg) RRsetDelete(rr []RR) {
|
||||||
u.Ns = make([]RR, len(rr))
|
u.Ns = make([]RR, len(rr))
|
||||||
for i, r := range rr {
|
for i, r := range rr {
|
||||||
|
@ -148,7 +148,7 @@ func (u *Msg) RRsetDelete(rr []RR) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NameDelete deletes all RRsets of a name, see RFC 2136 section 2.5.3
|
// NameDelete creates a dynamic update packet that deletes all RRsets of a name, see RFC 2136 section 2.5.3
|
||||||
func (u *Msg) NameDelete(rr []RR) {
|
func (u *Msg) NameDelete(rr []RR) {
|
||||||
u.Ns = make([]RR, len(rr))
|
u.Ns = make([]RR, len(rr))
|
||||||
for i, r := range rr {
|
for i, r := range rr {
|
||||||
|
@ -156,7 +156,7 @@ func (u *Msg) NameDelete(rr []RR) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RRsetDeleteRR deletes RR from the RRSset, see RFC 2136 section 2.5.4
|
// RRsetDeleteRR creates a dynamic update packet deletes RR from the RRSset, see RFC 2136 section 2.5.4
|
||||||
func (u *Msg) RRsetDeleteRR(rr []RR) {
|
func (u *Msg) RRsetDeleteRR(rr []RR) {
|
||||||
u.Ns = make([]RR, len(rr))
|
u.Ns = make([]RR, len(rr))
|
||||||
for i, r := range rr {
|
for i, r := range rr {
|
||||||
|
|
Loading…
Reference in New Issue