More convience functions
This commit is contained in:
parent
7888cd96b8
commit
0040c9b30e
9
edns.go
9
edns.go
|
@ -117,7 +117,12 @@ func (rr *RR_OPT) Nsid() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the NSID
|
// Set the NSID
|
||||||
func (rr *RR_OPT) SetNsid(nsid string) {
|
func (rr *RR_OPT) SetNsidToHex(hexnsid string) {
|
||||||
rr.Option[0].Code = OptionCodeNSID
|
rr.Option[0].Code = OptionCodeNSID
|
||||||
rr.Option[0].Data = nsid
|
rr.Option[0].Data = hexnsid
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rr *RR_OPT) SetNsidToString(nsid string) {
|
||||||
|
rr.Option[0].Code = OptionCodeNSID
|
||||||
|
rr.Option[0].Data = hex.EncodeToString([]byte(nsid))
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,7 @@ func TestPackUnpack(t *testing.T) {
|
||||||
edns.Hdr.Class = ClassINET
|
edns.Hdr.Class = ClassINET
|
||||||
edns.Hdr.Ttl = 3600
|
edns.Hdr.Ttl = 3600
|
||||||
edns.Option = make([]Option, 1)
|
edns.Option = make([]Option, 1)
|
||||||
edns.Option[0].Code = OptionCodeNSID
|
edns.SetNsidToString("lalalala")
|
||||||
edns.Option[0].Data = "lalalala"
|
|
||||||
|
|
||||||
_, ok = packRR(edns, msg, 0)
|
_, ok = packRR(edns, msg, 0)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue