Commit Graph

26 Commits

Author SHA1 Message Date
Tom Thorogood d8ff986484 Use for range loops instead of manual for loops (#937)
* Use for range loops instead of manual loops

* Use for range loop in Msg.CopyTo

This is a separate commit as the change is slightly more than just
switching the loop style.

* Use for range loop in DNSKEY.publicKeyRSA

* Add explen comment to DNSKEY.publicKeyRSA
2019-03-18 07:06:44 +00:00
Ludovic Fernandez 906238edc6 fix: panicing on options parsing. (#642) 2018-03-01 06:22:09 -08:00
Marc Ende 5ec0c6d20f Modified clientconfig to match ndots0 (#590)
* Modified clientconfig to match ndots0

* Added Tests for reading resolv.conf

* Cleaned up and removed duplicated code in test

* Added test for ndots below 0

* Cleaned up test

* Clean up
2017-11-27 11:17:45 +00:00
sarneaud ca092a4398 Allow parsing resolv.conf from io.Reader (#532)
* Allow parsing resolv.conf from io.Reader

This allows projects that use this parser to write unit tests without
writing temporary files to the filesystem.

* Avoid allocation by using strings.NewReader
2017-10-15 16:18:44 +02:00
James Hartig 672033dedc Added NameList function to ClientConfig (#452) 2017-02-13 20:16:50 +00:00
Miek Gieben 67945c119e A bunch of golint fixes
The proposed vars names are a nono, because they break the API.
Things left: document each RR and zscan_rr.go has some funcky if-then-elses.
2015-02-19 09:58:33 +00:00
Yann Kerhervé 80d2db2e86 Fix ignored last line of resolv.conf
When ClientConfigFromFile is given a file that is missing a newline
before EOF, then the last directive is completely ignored.

This also adds a very basic test for a normal resolv.conf parsing.
2015-02-03 16:27:39 -08:00
Miek Gieben 0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben fd12a9cea4 Rename this variable 2014-01-19 07:45:16 +00:00
Miek Gieben a627d88e3f Remove stale comments 2014-01-08 10:11:19 +00:00
Miek Gieben c66494c6c5 Resolv merge conflicts 2013-05-12 19:08:37 +02:00
Miek Gieben 98b677a97c Update the copy right for the original GO files 2013-05-12 16:07:06 +02:00
Ask Bjørn Hansen e7e56ada07 Don't try to close the client config file if opening fails
$ q
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x9c124]

goroutine 1 [running]:
os.(*File).Close(0x0, 0xf800000010, 0x0, 0xf840054e40)
/usr/local/go/src/pkg/os/file_unix.go:99 +0x1c
github.com/miekg/dns.ClientConfigFromFile(0x1c3294, 0x6374652f00000010, 0x0, 0xf840054e40, 0xf840054de0, ...)
/Users/ask/go/src/github.com/miekg/dns/clientconfig.go:30 +0xcc
main.main()
/Users/ask/go/src/github.com/miekg/dns/ex/q/q.go:50 +0x45b
2013-05-11 01:22:20 -07:00
Miek Gieben c0b80818cb Documentation 2013-01-28 19:10:13 +01:00
jdnurmi d0c884fdbf Update clientconfig.go
net is no longer used in clientconfig.go
2012-12-26 10:51:26 -08:00
Miek Gieben 3e3234c4ea net.JoinHostPort will add [ and ]
dont do this in the clientconfig
2012-12-26 17:58:18 +01:00
Miek Gieben ba40d60ce7 fix v6 ip presentation.
Also fix the parsing from /etc/resolv.conf and make it simpler
in the process.
2012-10-12 10:53:38 +02:00
Miek Gieben 53b065793b More preparation for the root 2012-06-03 09:35:39 +02:00
Miek Gieben 131f6962d1 gofmt 2011-12-09 21:45:57 +01:00
Miek Gieben d5c309e8d8 Dont append the default port to the nameservers 2011-12-09 16:13:59 +01:00
Miek Gieben 22a467e718 Fixes the latest weekly 2011-11-02 23:06:54 +01:00
Miek Gieben da0603089a gofmt -w 2011-07-23 23:43:43 +02:00
Miek Gieben b0a9805be9 Documentation 2011-07-04 21:32:39 +02:00
Miek Gieben 7b4a5eca06 fix key2ds.go 2011-07-04 20:57:19 +02:00
Elazar 904e322dfd Ran gofix, and manually bring code up to latest go release.
1) Ran gofix on all files.
2) Added "tcp" and "udp" to Resolve* functions in server.go
3) Generated primes to the primes array and not to two predefined
   struct members (P and Q), since now rsa support multi-factor primes.
2011-06-02 13:31:12 +03:00
Miek Gieben a5cb1c70b4 move this name 2011-03-31 11:37:11 +02:00