mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-01 14:05:39 +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
|
dnsMap *Map
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResolverConfig is the set of configuration options for a Resolver.
|
// Config is the set of configuration options for a Resolver.
|
||||||
type ResolverConfig struct {
|
type Config struct {
|
||||||
// Logf is the logger to use throughout the Resolver.
|
// Logf is the logger to use throughout the Resolver.
|
||||||
Logf logger.Logf
|
Logf logger.Logf
|
||||||
// Forward determines whether the resolver will forward packets to
|
// 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.
|
// New constructs a resolver associated with the given root domain.
|
||||||
// The root domain must be in canonical form (with a trailing period).
|
// The root domain must be in canonical form (with a trailing period).
|
||||||
func New(config ResolverConfig) *Resolver {
|
func New(config Config) *Resolver {
|
||||||
r := &Resolver{
|
r := &Resolver{
|
||||||
logf: logger.WithPrefix(config.Logf, "dns: "),
|
logf: logger.WithPrefix(config.Logf, "dns: "),
|
||||||
linkMon: config.LinkMonitor,
|
linkMon: config.LinkMonitor,
|
||||||
|
@ -194,7 +194,7 @@ func TestRDNSNameToIPv6(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestResolve(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)
|
r.SetMap(dnsMap)
|
||||||
|
|
||||||
if err := r.Start(); err != nil {
|
if err := r.Start(); err != nil {
|
||||||
@ -240,7 +240,7 @@ func TestResolve(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestResolveReverse(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)
|
r.SetMap(dnsMap)
|
||||||
|
|
||||||
if err := r.Start(); err != nil {
|
if err := r.Start(); err != nil {
|
||||||
@ -318,7 +318,7 @@ func TestDelegate(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
r := New(Config{Logf: t.Logf, Forward: true})
|
||||||
r.SetMap(dnsMap)
|
r.SetMap(dnsMap)
|
||||||
r.SetUpstreams([]net.Addr{
|
r.SetUpstreams([]net.Addr{
|
||||||
v4server.PacketConn.LocalAddr(),
|
v4server.PacketConn.LocalAddr(),
|
||||||
@ -397,7 +397,7 @@ func TestDelegateCollision(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer server.Shutdown()
|
defer server.Shutdown()
|
||||||
|
|
||||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
r := New(Config{Logf: t.Logf, Forward: true})
|
||||||
r.SetMap(dnsMap)
|
r.SetMap(dnsMap)
|
||||||
r.SetUpstreams([]net.Addr{server.PacketConn.LocalAddr()})
|
r.SetUpstreams([]net.Addr{server.PacketConn.LocalAddr()})
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ func TestDelegateCollision(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConcurrentSetMap(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 {
|
if err := r.Start(); err != nil {
|
||||||
t.Fatalf("start: %v", err)
|
t.Fatalf("start: %v", err)
|
||||||
@ -499,7 +499,7 @@ func TestConcurrentSetUpstreams(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer server.Shutdown()
|
defer server.Shutdown()
|
||||||
|
|
||||||
r := New(ResolverConfig{Logf: t.Logf, Forward: true})
|
r := New(Config{Logf: t.Logf, Forward: true})
|
||||||
r.SetMap(dnsMap)
|
r.SetMap(dnsMap)
|
||||||
|
|
||||||
if err := r.Start(); err != nil {
|
if err := r.Start(); err != nil {
|
||||||
@ -670,7 +670,7 @@ func TestConcurrentSetUpstreams(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFull(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)
|
r.SetMap(dnsMap)
|
||||||
|
|
||||||
if err := r.Start(); err != nil {
|
if err := r.Start(); err != nil {
|
||||||
@ -709,7 +709,7 @@ func TestFull(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAllocs(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)
|
r.SetMap(dnsMap)
|
||||||
|
|
||||||
if err := r.Start(); err != nil {
|
if err := r.Start(); err != nil {
|
||||||
@ -778,7 +778,7 @@ func BenchmarkFull(b *testing.B) {
|
|||||||
}
|
}
|
||||||
defer server.Shutdown()
|
defer server.Shutdown()
|
||||||
|
|
||||||
r := New(ResolverConfig{Logf: b.Logf, Forward: true})
|
r := New(Config{Logf: b.Logf, Forward: true})
|
||||||
r.SetMap(dnsMap)
|
r.SetMap(dnsMap)
|
||||||
r.SetUpstreams([]net.Addr{server.PacketConn.LocalAddr()})
|
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.linkMonOwned = true
|
||||||
}
|
}
|
||||||
|
|
||||||
e.resolver = resolver.New(resolver.ResolverConfig{
|
e.resolver = resolver.New(resolver.Config{
|
||||||
Logf: logf,
|
Logf: logf,
|
||||||
Forward: true,
|
Forward: true,
|
||||||
LinkMonitor: e.linkMon,
|
LinkMonitor: e.linkMon,
|
||||||
|
Loading…
Reference in New Issue
Block a user