mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
net/dns/resolver: rename ResolverConfig to just Config.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
d99f5b1596
commit
bc81dd4690
@ -82,8 +82,8 @@ type Resolver struct {
|
||||
dnsMap *Map
|
||||
}
|
||||
|
||||
// ResolverConfig is the set of configuration options for a Resolver.
|
||||
type ResolverConfig struct {
|
||||
// Config is the set of configuration options for a Resolver.
|
||||
type Config struct {
|
||||
// Logf is the logger to use throughout the Resolver.
|
||||
Logf logger.Logf
|
||||
// Forward determines whether the resolver will forward packets to
|
||||
@ -97,7 +97,7 @@ type ResolverConfig struct {
|
||||
|
||||
// New constructs a resolver associated with the given root domain.
|
||||
// The root domain must be in canonical form (with a trailing period).
|
||||
func New(config ResolverConfig) *Resolver {
|
||||
func New(config Config) *Resolver {
|
||||
r := &Resolver{
|
||||
logf: logger.WithPrefix(config.Logf, "dns: "),
|
||||
linkMon: config.LinkMonitor,
|
||||
|
@ -194,7 +194,7 @@ func TestRDNSNameToIPv6(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolve(t *testing.T) {
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: false})
|
||||
r := New(Config{Logf: t.Logf, Forward: false})
|
||||
r.SetMap(dnsMap)
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
@ -240,7 +240,7 @@ func TestResolve(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveReverse(t *testing.T) {
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: false})
|
||||
r := New(Config{Logf: t.Logf, Forward: false})
|
||||
r.SetMap(dnsMap)
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
@ -318,7 +318,7 @@ func TestDelegate(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
||||
r := New(Config{Logf: t.Logf, Forward: true})
|
||||
r.SetMap(dnsMap)
|
||||
r.SetUpstreams([]net.Addr{
|
||||
v4server.PacketConn.LocalAddr(),
|
||||
@ -397,7 +397,7 @@ func TestDelegateCollision(t *testing.T) {
|
||||
}
|
||||
defer server.Shutdown()
|
||||
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
||||
r := New(Config{Logf: t.Logf, Forward: true})
|
||||
r.SetMap(dnsMap)
|
||||
r.SetUpstreams([]net.Addr{server.PacketConn.LocalAddr()})
|
||||
|
||||
@ -463,7 +463,7 @@ func TestDelegateCollision(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConcurrentSetMap(t *testing.T) {
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: false})
|
||||
r := New(Config{Logf: t.Logf, Forward: false})
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
t.Fatalf("start: %v", err)
|
||||
@ -499,7 +499,7 @@ func TestConcurrentSetUpstreams(t *testing.T) {
|
||||
}
|
||||
defer server.Shutdown()
|
||||
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
||||
r := New(Config{Logf: t.Logf, Forward: true})
|
||||
r.SetMap(dnsMap)
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
@ -670,7 +670,7 @@ func TestConcurrentSetUpstreams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFull(t *testing.T) {
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: false})
|
||||
r := New(Config{Logf: t.Logf, Forward: false})
|
||||
r.SetMap(dnsMap)
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
@ -709,7 +709,7 @@ func TestFull(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllocs(t *testing.T) {
|
||||
r := New(ResolverConfig{Logf: t.Logf, Forward: false})
|
||||
r := New(Config{Logf: t.Logf, Forward: false})
|
||||
r.SetMap(dnsMap)
|
||||
|
||||
if err := r.Start(); err != nil {
|
||||
@ -778,7 +778,7 @@ func BenchmarkFull(b *testing.B) {
|
||||
}
|
||||
defer server.Shutdown()
|
||||
|
||||
r := New(ResolverConfig{Logf: b.Logf, Forward: true})
|
||||
r := New(Config{Logf: b.Logf, Forward: true})
|
||||
r.SetMap(dnsMap)
|
||||
r.SetUpstreams([]net.Addr{server.PacketConn.LocalAddr()})
|
||||
|
||||
|
@ -219,7 +219,7 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
|
||||
e.linkMonOwned = true
|
||||
}
|
||||
|
||||
e.resolver = resolver.New(resolver.ResolverConfig{
|
||||
e.resolver = resolver.New(resolver.Config{
|
||||
Logf: logf,
|
||||
Forward: true,
|
||||
LinkMonitor: e.linkMon,
|
||||
|
Loading…
Reference in New Issue
Block a user