Debian Codegraph @

update_test.go

raw
1 package dns
2
3 // ExampleMsg_dynamicUpdateNameUsed shows how to set the RRs in the prereq section to
4 // "Name is in use" RRs. RFC 2136 section 2.4.4. Also see [ANY].
5 func ExampleMsg_dynamicUpdateNameUsed() {
6 u := NewMsg("example.org.", TypeSOA)
7 u.Opcode = OpcodeUpdate
8 any := &ANY{Hdr: Header{Name: "example.org.", Class: ClassANY}}
9 u.Answer = append(u.Answer, any)
10 // u can now be send
11 }
12
13 func ExampleMsg_dynamicUpdateRemoveName() {
14 u := NewMsg("example.org.", TypeSOA)
15 u.Opcode = OpcodeUpdate
16
17 any := &ANY{Hdr: Header{Name: "example.org.", Class: ClassANY}}
18 u.Ns = append(u.Ns, any)
19 // u can now be send
20 }
21
22 // ExampleMsg_dynamicRemove creates a dynamic update packet that deletes RR from a
23 // RRSset, see RFC 2136 section 2.5.4. Also see [ANY].
24 func ExampleMsg_dynamicUpdateRemove() {
25 u := NewMsg("example.org.", TypeSOA)
26 u.Opcode = OpcodeUpdate
27
28 a, _ := New("example.org. IN A 127.0.0.1")
29 a.Header().Class = ClassNONE
30 a.Header().TTL = 0
31 u.Ns = append(u.Ns, a)
32 // u can now be send
33 }