fastdialer

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 13 Imported by: 203

Documentation

Index

Constants

View Source
const HostsFilePath = "/etc/hosts"

HostsFilePath in unix file os

Variables

View Source
var DefaultOptions = Options{
	BaseResolvers: DefaultResolvers,
	MaxRetries:    5,
	HostsFile:     true,
}

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 HandleLine added in v0.0.2

func HandleLine(raw string) (ip string, hosts []string)

HandleLine a hosts file line

func HasComment added in v0.0.2

func HasComment(raw string) bool

HasComment check if the line has a comment

func IsComment added in v0.0.2

func IsComment(raw string) bool

IsComment check if the file is a comment

Types

type Dialer

type Dialer struct {
	// contains filtered or unexported fields
}

Dialer structure containing data information

func NewDialer

func NewDialer(options Options) (*Dialer, error)

NewDialer instance

func (*Dialer) Close

func (d *Dialer) Close()

Close instance and cleanups

func (*Dialer) Dial

func (d *Dialer) Dial(ctx context.Context, network, address string) (conn net.Conn, err error)

Dial function compatible with net/http

func (*Dialer) DialTLS added in v0.0.6

func (d *Dialer) DialTLS(ctx context.Context, network, address string) (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

func (d *Dialer) GetDialedIP(hostname string) string

GetDialedIP returns the ip dialed by the HTTP client

type NoAddressFoundError

type NoAddressFoundError struct{}

func (*NoAddressFoundError) Error

func (m *NoAddressFoundError) Error() string

type Options

type Options struct {
	BaseResolvers []string
	MaxRetries    int
	HostsFile     bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL