Removed checking
This commit is contained in:
parent
158e202ed8
commit
8a667a9065
@ -1,8 +1,6 @@
|
|||||||
package runner
|
package runner
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"git.supernets.org/perp/blink/v1/pkg/dns"
|
"git.supernets.org/perp/blink/v1/pkg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,41 +20,3 @@ type Options struct {
|
|||||||
|
|
||||||
// Result handler function
|
// Result handler function
|
||||||
type OnResultFunc func(*dns.Result)
|
type OnResultFunc func(*dns.Result)
|
||||||
|
|
||||||
// Check resolvers
|
|
||||||
func (o *Options) resolvers() {
|
|
||||||
// No resolvers found
|
|
||||||
if len(o.Resolvers) == 0 {
|
|
||||||
o.Resolvers = append(o.Resolvers, "1.1.1.1:53")
|
|
||||||
o.Resolvers = append(o.Resolvers, "9.9.9.9:53")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go through resolvers
|
|
||||||
for index, resolver := range o.Resolvers {
|
|
||||||
// Split
|
|
||||||
split := strings.Split(resolver, ":")
|
|
||||||
|
|
||||||
// No port found
|
|
||||||
if len(split) == 1 {
|
|
||||||
// Ignore empty & commented lines
|
|
||||||
if resolver != "" && !strings.HasPrefix(resolver, "#") {
|
|
||||||
o.Resolvers[index] = resolver + ":53"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check threads
|
|
||||||
func (o *Options) threads() {
|
|
||||||
// No threads found
|
|
||||||
if o.Threads == 0 {
|
|
||||||
o.Threads = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check options
|
|
||||||
func (o *Options) Check() {
|
|
||||||
o.resolvers()
|
|
||||||
o.threads()
|
|
||||||
}
|
|
||||||
|
@ -18,9 +18,6 @@ type Runner struct {
|
|||||||
|
|
||||||
// Return a new Runner
|
// Return a new Runner
|
||||||
func New(options *Options) *Runner {
|
func New(options *Options) *Runner {
|
||||||
// Check options
|
|
||||||
options.Check()
|
|
||||||
|
|
||||||
// Create client
|
// Create client
|
||||||
client := &mdns.Client{
|
client := &mdns.Client{
|
||||||
Net: "tcp",
|
Net: "tcp",
|
||||||
|
Loading…
Reference in New Issue
Block a user