Skip to content

Commit

Permalink
consolidate dns resolver constructors
Browse files Browse the repository at this point in the history
The current convention is to return the concrete type instead of an interface so
let's go with that and have one constructor.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
  • Loading branch information
Stebalien committed May 9, 2018
1 parent 5f3eb87 commit 1ff835b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions namesys/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ type DNSResolver struct {
}

// NewDNSResolver constructs a name resolver using DNS TXT records.
func NewDNSResolver() Resolver {
return &DNSResolver{lookupTXT: net.LookupTXT}
}

// newDNSResolver constructs a name resolver using DNS TXT records,
// returning a resolver instead of NewDNSResolver's Resolver.
func newDNSResolver() resolver {
func NewDNSResolver() *DNSResolver {
return &DNSResolver{lookupTXT: net.LookupTXT}
}

Expand Down
2 changes: 1 addition & 1 deletion namesys/namesys.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type mpns struct {
func NewNameSystem(r routing.ValueStore, ds ds.Datastore, cachesize int) NameSystem {
return &mpns{
resolvers: map[string]resolver{
"dns": newDNSResolver(),
"dns": NewDNSResolver(),
"proquint": new(ProquintResolver),
"dht": NewRoutingResolver(r, cachesize),
},
Expand Down

0 comments on commit 1ff835b

Please sign in to comment.