Add CONTEXT.md, consumer README skeleton, and package Examples.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Konrad Neitzel
2026-08-27 22:00:02 +02:00
co-authored by Cursor
parent 992899c354
commit a722194b5a
3 changed files with 120 additions and 12 deletions
+46
View File
@@ -0,0 +1,46 @@
package godns_test
import (
"fmt"
"net"
godns "gitea.neitzel.de/konrad/go-dns"
)
func ExampleNewClient() {
key := godns.TSIG{
Name: "exapp-key.",
Algorithm: "hmac-sha256",
Secret: "dGVzdA==", // base64; construction only — no network call
}
client, err := godns.NewClient("127.0.0.1:53", "example.com.", key)
if err != nil {
fmt.Println("err:", err)
return
}
_ = client
fmt.Println("ok")
// Output: ok
}
func ExampleAdd() {
rec, err := godns.A("www.example.com.", 300, net.ParseIP("192.0.2.10"))
if err != nil {
fmt.Println("err:", err)
return
}
change := godns.Add(rec)
fmt.Println(change.Action == godns.ActionAdd, change.Record.Type, change.Record.RData)
// Output: true A 192.0.2.10
}
func ExampleDelete() {
rec, err := godns.TXT("note.example.com.", 60, "retire")
if err != nil {
fmt.Println("err:", err)
return
}
change := godns.Delete(rec)
fmt.Println(change.Action == godns.ActionDelete, change.Record.Type)
// Output: true TXT
}