MCPcopy Create free account

hub / github.com/bschaatsbergen/dnsdialer / functions

Functions96 in github.com/bschaatsbergen/dnsdialer

↓ 27 callersMethodClose
Close shuts down the pool and closes all idle connections. After Close() is called, Get() will return net.ErrClosed and Put() will close connections
connpool.go:160
↓ 22 callersFunctionNew
New creates a new Dialer with the given options. Default configuration: - Strategy: Race (lowest latency) - Timeout: 2 seconds per query - Logger: n
resolver.go:99
↓ 22 callersFunctionWithResolvers
WithResolvers sets the DNS resolvers to query. Each address can be: - IP with port: "8.8.8.8:53" - IP without port: "8.8.8.8" (port 53 is assumed) -
options.go:34
↓ 22 callersFunctionWithStrategy
WithStrategy sets the resolution strategy. Available strategies: - Race: Query all servers, return first successful response (minimize latency) - Fa
options.go:59
↓ 12 callersMethodString
String returns a string representation of the record
recordtype.go:51
↓ 12 callersFunctionrecordsEqual
recordsEqual checks if two slices of DNS records are equal, treating them as multisets. This means: - Order doesn't matter: [A, B] equals [B, A] - Du
util.go:26
↓ 11 callersFunctionWithCache
WithCache enables DNS response caching with TTL-aware expiration. Caching reduces query latency for repeated lookups and load on DNS resolvers. The c
options.go:149
↓ 11 callersMethodlookupIPs
lookupIPs extracts IP addresses from DNS records.
resolver.go:168
↓ 10 callersMethodGet
Get retrieves a connection from the pool or creates a new one. This implements a lazy allocation strategy: connections are only created when needed,
connpool.go:71
↓ 9 callersMethodDialContext
DialContext implements the net.Dialer.DialContext signature, making it a drop-in replacement for any Go code that accepts a custom dialer. Use with H
resolver.go:233
↓ 8 callersMethodDebug
(msg string, fields ...Field)
resolver.go:59
↓ 7 callersMethodError
(msg string, err error, fields ...Field)
resolver.go:61
↓ 7 callersFunctiongetSystemResolver
getSystemResolver attempts to read the system's DNS resolver from /etc/resolv.conf. Returns the first nameserver found, with :53 appended if no port i
benchmark_test.go:23
↓ 4 callersMethodName
Name returns the identifier of this resolver (typically the server address). Used for logging and in Compare strategy to identify which resolver retur
resolver.go:26
↓ 4 callersMethodResolveType
(ctx context.Context, host string, qtype RecordType, resolvers []resolver, logger Logger)
compare.go:12
↓ 4 callersMethodResolveType
(ctx context.Context, host string, qtype RecordType, resolvers []resolver, logger Logger)
consensus.go:13
↓ 4 callersMethodResolveType
(ctx context.Context, host string, qtype RecordType, resolvers []resolver, logger Logger)
strategy.go:18
↓ 3 callersMethodResolveType
(ctx context.Context, host string, qtype RecordType, resolvers []resolver, logger Logger)
fallback.go:12
↓ 2 callersMethodResolveType
(ctx context.Context, host string, qtype RecordType, resolvers []resolver, logger Logger)
race.go:13
↓ 2 callersFunctionnewDNSCache
newDNSCache creates a new DNS cache with the specified size and TTL bounds. Size controls the maximum number of hostnames to cache (LRU eviction when
cache.go:50
↓ 1 callersMethodInfo
(msg string, fields ...Field)
resolver.go:60
↓ 1 callersMethodPut
Put returns a connection to the pool for reuse, or closes it if the pool is full. Always call Put() after you're done with a connection, even if an e
connpool.go:117
↓ 1 callersMethodResolveType
ResolveType performs a DNS query for a specific record type. Returns records on success, or an error if the query fails.
resolver.go:22
↓ 1 callersFunctionWithTimeout
WithTimeout sets the per-query timeout. This timeout applies to individual DNS queries, not the overall Lookup() call. For strategies that query mult
options.go:80
↓ 1 callersMethodgetIPs
getIPs retrieves cached IP addresses for a hostname if they exist and haven't expired. This is the fast path for lookupIPs() and is crucial for perfor
cache.go:72
↓ 1 callersMethodisExpired
isExpired checks if the IP cache entry has expired based on DNS TTL.
cache.go:25
↓ 1 callersMethodlookup
lookup performs DNS resolution using the configured strategy. Always queries for A and AAAA records (IPv4 and IPv6).
resolver.go:118
↓ 1 callersFunctionnewConnPool
(addr string, timeout time.Duration, size int)
connpool.go:45
↓ 1 callersFunctionnewUDPResolver
(addr string, timeout time.Duration, poolSize int)
udp.go:35
↓ 1 callersMethodsetIPs
setIPs stores already-parsed IP addresses in the cache with TTL-based expiration. The TTL is passed in from the caller who has already figured out the
cache.go:101
FunctionBenchmarkCGOStatus_Info
This is just a convenience bench test to report CGO status in benchmarks. If the Go compiler is invoked with CGO_ENABLED=1, cgoStatus will be "WithCGO
cgo_benchmark_test.go:20
FunctionBenchmarkCGO_DNSDialer_LookupHost
(b *testing.B)
cgo_benchmark_test.go:49
FunctionBenchmarkCGO_StdLib_LookupHost
(b *testing.B)
cgo_benchmark_test.go:24
FunctionBenchmarkDNSDialer_DialContext_Cache_Race3
(b *testing.B)
benchmark_test.go:273
FunctionBenchmarkDNSDialer_DialContext_Cache_Single_Race
(b *testing.B)
benchmark_test.go:239
FunctionBenchmarkDNSDialer_DialContext_IPLiteral
(b *testing.B)
benchmark_test.go:459
FunctionBenchmarkDNSDialer_DialContext_NoCache_Race3
(b *testing.B)
benchmark_test.go:257
FunctionBenchmarkDNSDialer_DialContext_NoCache_Single_Race
(b *testing.B)
benchmark_test.go:222
FunctionBenchmarkDNSDialer_HTTPGet_Cache_Race3
(b *testing.B)
benchmark_test.go:371
FunctionBenchmarkDNSDialer_HTTPGet_Cache_Single_Race
(b *testing.B)
benchmark_test.go:326
FunctionBenchmarkDNSDialer_HTTPGet_Local
(b *testing.B)
benchmark_test.go:414
FunctionBenchmarkDNSDialer_HTTPGet_NoCache_Race3
(b *testing.B)
benchmark_test.go:349
FunctionBenchmarkDNSDialer_HTTPGet_NoCache_Single_Race
(b *testing.B)
benchmark_test.go:304
FunctionBenchmarkDNSDialer_LookupHost_Cache_Consensus2
(b *testing.B)
benchmark_test.go:186
FunctionBenchmarkDNSDialer_LookupHost_Cache_Fallback2
(b *testing.B)
benchmark_test.go:169
FunctionBenchmarkDNSDialer_LookupHost_Cache_Race3
(b *testing.B)
benchmark_test.go:152
FunctionBenchmarkDNSDialer_LookupHost_Cache_Single_Race
(b *testing.B)
benchmark_test.go:135
FunctionBenchmarkDNSDialer_LookupHost_NoCache_Consensus2
(b *testing.B)
benchmark_test.go:114
FunctionBenchmarkDNSDialer_LookupHost_NoCache_Fallback2
(b *testing.B)
benchmark_test.go:98
FunctionBenchmarkDNSDialer_LookupHost_NoCache_Race3
(b *testing.B)
benchmark_test.go:82
FunctionBenchmarkDNSDialer_LookupHost_NoCache_Single_Race
(b *testing.B)
benchmark_test.go:66
FunctionBenchmarkStdLibResolver_LookupHost
(b *testing.B)
benchmark_test.go:53
FunctionBenchmarkStdLib_DialContext
(b *testing.B)
benchmark_test.go:206
FunctionBenchmarkStdLib_DialContext_IPLiteral
(b *testing.B)
benchmark_test.go:443
FunctionBenchmarkStdLib_HTTPGet
(b *testing.B)
benchmark_test.go:290
FunctionBenchmarkStdLib_HTTPGet_Local
(b *testing.B)
benchmark_test.go:394
MethodDebug
(msg string, fields ...Field)
strategy_test.go:49
MethodDebug
(msg string, fields ...Field)
resolver.go:75
MethodError
(msg string, err error, fields ...Field)
strategy_test.go:57
MethodError
(msg string, err error, fields ...Field)
resolver.go:77
MethodInfo
(msg string, fields ...Field)
strategy_test.go:53
MethodInfo
(msg string, fields ...Field)
resolver.go:76
MethodName
()
strategy_test.go:25
MethodName
()
udp.go:170
MethodResolveType
(ctx context.Context, host string, qtype RecordType)
strategy_test.go:29
MethodResolveType
(ctx context.Context, host string, qtype RecordType)
udp.go:54
MethodString
()
strategy_test.go:40
MethodString
String returns the string representation of the record type
recordtype.go:39
FunctionTestCompare_IgnoreTTLDifferences
(t *testing.T)
strategy_test.go:269
FunctionTestCompare_NoDiscrepancy
(t *testing.T)
strategy_test.go:219
FunctionTestCompare_NoOnDiscrepancyCallback
(t *testing.T)
strategy_test.go:294
FunctionTestCompare_WithDiscrepancy
(t *testing.T)
strategy_test.go:243
FunctionTestConsensus_DefaultMinAgreement
(t *testing.T)
strategy_test.go:150
FunctionTestConsensus_IgnoreTTL
(t *testing.T)
strategy_test.go:133
FunctionTestConsensus_MajorityAgreement_Succeeds
(t *testing.T)
strategy_test.go:115
FunctionTestConsensus_MinorityAgreement_Fails
(t *testing.T)
strategy_test.go:98
FunctionTestDialer_DialContext
(t *testing.T)
resolver_test.go:23
FunctionTestDialer_DialContext_HTTPClient
(t *testing.T)
resolver_test.go:48
FunctionTestDialer_DialContext_gRPC
(t *testing.T)
resolver_test.go:75
FunctionTestFallback_AllResolversFail
(t *testing.T)
strategy_test.go:203
FunctionTestFallback_FirstResolverFails
(t *testing.T)
strategy_test.go:186
FunctionTestFallback_FirstResolverSucceeds
(t *testing.T)
strategy_test.go:169
FunctionTestRace_AllResolversFail
(t *testing.T)
strategy_test.go:82
FunctionTestRace_FirstSuccessfulResponse
(t *testing.T)
strategy_test.go:65
FunctionTestRecordsEqual_DifferentDuplicateCount
(t *testing.T)
util_test.go:88
FunctionTestRecordsEqual_DifferentLengths
(t *testing.T)
util_test.go:116
FunctionTestRecordsEqual_DifferentOrder
(t *testing.T)
util_test.go:27
FunctionTestRecordsEqual_DifferentTTL
(t *testing.T)
util_test.go:51
FunctionTestRecordsEqual_DifferentValues
(t *testing.T)
util_test.go:40
FunctionTestRecordsEqual_DuplicateRecords
(t *testing.T)
util_test.go:73
FunctionTestRecordsEqual_EmptySlices
(t *testing.T)
util_test.go:100
FunctionTestRecordsEqual_IgnoreTTL
(t *testing.T)
util_test.go:62
FunctionTestRecordsEqual_OneEmpty
(t *testing.T)
util_test.go:107
FunctionTestRecordsEqual_SameRecords
(t *testing.T)
util_test.go:14
FunctionWithConnPoolSize
WithConnPoolSize sets the maximum number of pooled connections per resolver. Connection pooling reduces socket creation/destruction overhead. Each DN
options.go:121
FunctionWithLogger
WithLogger sets a custom logger for debugging and monitoring. The logger receives structured log events about query attempts, failures, strategy deci
options.go:100