Documentation
¶
Overview ¶
fastdialer is a dialer package containing a dns/tls cache layer
Index ¶
- Constants
- Variables
- func HandleHostLine(raw string) (ip string, hosts []string)
- func HandleResolverLine(raw string) (ip string)
- func HasComment(raw string) bool
- func IsComment(raw string) bool
- type CacheType
- type Dialer
- func (d *Dialer) Close()
- func (d *Dialer) Dial(ctx context.Context, network, address string) (conn net.Conn, err error)
- func (d *Dialer) DialTLS(ctx context.Context, network, address string) (conn net.Conn, err error)
- func (d *Dialer) DialTLSWithConfig(ctx context.Context, network, address string, config *tls.Config) (conn net.Conn, err error)
- func (d *Dialer) GetDNSData(hostname string) (*retryabledns.DNSData, error)
- func (d *Dialer) GetDNSDataFromCache(hostname string) (*retryabledns.DNSData, error)
- func (d *Dialer) GetDialedIP(hostname string) string
- func (d *Dialer) GetTLSData(hostname string) (*cryptoutil.TLSData, error)
- type DiskDBType
- type NoAddressAllowedError
- type NoAddressFoundError
- type Options
Constants ¶
View Source
const HostsFilePath = "/etc/hosts"
HostsFilePath in unix file os
View Source
const ResolverFilePath = "/etc/resolv.conf"
ResolverFilePath in unix file os
Variables ¶
View Source
var DefaultOptions = Options{ BaseResolvers: DefaultResolvers, MaxRetries: 5, HostsFile: true, ResolversFile: true, CacheType: Disk, DialerTimeout: 10 * time.Second, DialerKeepAlive: 10 * time.Second, }
DefaultOptions of the cache
View Source
var DefaultResolvers = []string{
"1.1.1.1:53",
"1.0.0.1:53",
"8.8.8.8:53",
"8.8.4.4:53",
}
DefaultResolvers trusted
Functions ¶
func HandleHostLine ¶ added in v0.0.9
HandleHostLine a hosts file line
func HandleResolverLine ¶ added in v0.0.9
HandleLine a resolver file line
func HasComment ¶ added in v0.0.2
HasComment check if the line has a comment
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer structure containing data information
func (*Dialer) DialTLSWithConfig ¶ added in v0.0.13
func (d *Dialer) DialTLSWithConfig(ctx context.Context, network, address string, config *tls.Config) (conn net.Conn, err error)
DialTLS with encrypted connection
func (*Dialer) GetDNSData ¶
func (d *Dialer) GetDNSData(hostname string) (*retryabledns.DNSData, error)
GetDNSData for the given hostname
func (*Dialer) GetDNSDataFromCache ¶
func (d *Dialer) GetDNSDataFromCache(hostname string) (*retryabledns.DNSData, error)
GetDNSDataFromCache cached by the resolver
func (*Dialer) GetDialedIP ¶
GetDialedIP returns the ip dialed by the HTTP client
func (*Dialer) GetTLSData ¶ added in v0.0.13
func (d *Dialer) GetTLSData(hostname string) (*cryptoutil.TLSData, error)
GetTLSData returns the tls data for a hostname
type NoAddressAllowedError ¶ added in v0.0.13
type NoAddressAllowedError struct{}
func (*NoAddressAllowedError) Error ¶ added in v0.0.13
func (m *NoAddressAllowedError) Error() string
type NoAddressFoundError ¶
type NoAddressFoundError struct{}
func (*NoAddressFoundError) Error ¶
func (m *NoAddressFoundError) Error() string
type Options ¶
type Options struct { BaseResolvers []string MaxRetries int HostsFile bool ResolversFile bool EnableFallback bool Allow []string Deny []string CacheType CacheType CacheMemoryMaxItems int // used by Memory cache type DiskDbType DiskDBType WithDialerHistory bool WithCleanup bool WithTLSData bool DialerTimeout time.Duration DialerKeepAlive time.Duration Dialer *net.Dialer }
Click to show internal directories.
Click to hide internal directories.