Make the function on a resolver methods
This commit is contained in:
parent
daf625264e
commit
b4a69fad37
3
TODO
3
TODO
|
@ -7,7 +7,6 @@ Todo:
|
|||
* TSIG -- RFC 4635
|
||||
* IDN?
|
||||
* Unknown RRs?
|
||||
* query-time, server in string ouput of dns.Msg
|
||||
* Parsing from strings
|
||||
* Server support (signing, receiving queries)
|
||||
* Check the network order, it works now, but this is on Intel
|
||||
|
@ -21,3 +20,5 @@ Issues:
|
|||
* Convience functions?
|
||||
- for new(RR*)
|
||||
- ...
|
||||
* query-time, server in string ouput of dns.Msg
|
||||
- DnsMsg when doing resolver querying
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func TestAXFR(t *testing.T) {
|
||||
res := new(Resolver)
|
||||
ch := NewXfer(res)
|
||||
ch := res.NewXfer()
|
||||
|
||||
res.Servers = []string{"127.0.0.1"}
|
||||
m := new(dns.Msg)
|
||||
|
|
|
@ -50,7 +50,7 @@ type Resolver struct {
|
|||
}
|
||||
|
||||
// Start a new resolver as a goroutine, return the communication channel
|
||||
func NewQuerier(res *Resolver) (ch chan DnsMsg) {
|
||||
func (res *Resolver) NewQuerier() (ch chan DnsMsg) {
|
||||
ch = make(chan DnsMsg)
|
||||
go query(res, ch)
|
||||
return
|
||||
|
@ -129,7 +129,7 @@ func query(res *Resolver, msg chan DnsMsg) {
|
|||
// Start a new xfr as a goroutine, return a channel.
|
||||
// Channel will be closed when the axfr is finished, until
|
||||
// that time new messages will appear on the channel
|
||||
func NewXfer(res *Resolver) (ch chan DnsMsg) {
|
||||
func (res *Resolver) NewXfer() (ch chan DnsMsg) {
|
||||
ch = make(chan DnsMsg)
|
||||
go axfr(res, ch)
|
||||
return
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
func TestResolverEdns(t *testing.T) {
|
||||
res := new(Resolver)
|
||||
ch := NewQuerier(res)
|
||||
ch := res.NewQuerier()
|
||||
|
||||
res.Servers = []string{"127.0.0.1"}
|
||||
res.Timeout = 2
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func TestResolver(t *testing.T) {
|
||||
res := new(Resolver)
|
||||
ch := NewQuerier(res)
|
||||
ch := res.NewQuerier()
|
||||
|
||||
res.Servers = []string{"127.0.0.1"}
|
||||
|
||||
|
|
Loading…
Reference in New Issue