Created
July 19, 2022 13:34
-
-
Save miekg/8e0a435f4f3b15852ed7ccd34424efd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dns | |
import ( | |
"fmt" | |
"net" | |
"testing" | |
) | |
// Test function to test how the API feels. | |
func TestDNS(t *testing.T) { | |
rr := new(A) | |
rr.Hdr.Name.Set("example.net.") | |
rr.Hdr.Class.Set(ClassINET) | |
rr.Hdr.TTL.Set(15) | |
rr.SetData(0, net.IPv4allrouter) | |
fmt.Printf("%s %s\n", rr.Hdr.String(), rr.String()) // example.net. 15 IN A 224.0.0.2 | |
fmt.Printf("%#v %#v\n", rr.Hdr.GoString(), rr.String()) // "07example03net00 15 IN" "A\t224.0.0.2" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment