Documentation
¶
Overview ¶
fastdialer is a dialer package containing a dns/tls cache layer
Index ¶
- Constants
- Variables
- func AsTLSConfig(ztlsConfig *ztls.Config) (*tls.Config, error)
- func AsZTLSConfig(tlsConfig *tls.Config) (*ztls.Config, error)
- func HandleResolverLine(raw string) (ip string)
- func IsTLS13(config interface{}) bool
- type CacheType
- type ContextOption
- 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) DialTLSWithConfigImpersonate(ctx context.Context, network, address string, config *tls.Config, ...) (conn net.Conn, err error)
- func (d *Dialer) DialZTLS(ctx context.Context, network, address string) (conn net.Conn, err error)
- func (d *Dialer) DialZTLSWithConfig(ctx context.Context, network, address string, config *ztls.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 Options
Constants ¶
View Source
const ResolverFilePath = "/etc/resolv.conf"
ResolverFilePath in unix file os
Variables ¶
View Source
var ( MaxDNSCacheSize int64 MaxDNSItems = 1024 MaxDialCacheSize = 10000 )
option to disable ztls fallback in case of handshake error reads from env variable DISABLE_ZTLS_FALLBACK
View Source
var ( CouldNotConnectError = errkit.New("could not connect to any address found for host").SetKind(errkit.ErrKindNetworkPermanent) NoAddressFoundError = errkit.New("no address found for host").SetKind(errkit.ErrKindNetworkPermanent) NoAddressAllowedError = errkit.New("denied address found for host").SetKind(errkit.ErrKindNetworkPermanent) NoPortSpecifiedError = errkit.New("port was not specified").SetKind(errkit.ErrKindNetworkPermanent) MalformedIP6Error = errkit.New("malformed IPv6 address").SetKind(errkit.ErrKindNetworkPermanent) ResolveHostError = errkit.New("could not resolve host").SetKind(errkit.ErrKindNetworkPermanent) NoTLSHistoryError = errkit.New("no tls data history available") NoTLSDataError = errkit.New("no tls data found for the key") NoDNSDataError = errkit.New("no data found") AsciiConversionError = errkit.New("could not convert hostname to ASCII") ErrDialTimeout = errkit.New("dial timeout").SetKind(errkit.ErrKindNetworkTemporary) )
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
View Source
var (
MaxResolverEntries = 4096
)
Functions ¶
func HandleResolverLine ¶ added in v0.0.9
HandleLine a resolver file line
Types ¶
type ContextOption ¶ added in v0.0.16
type ContextOption string
const ( // SniName to use in tls connection SniName ContextOption = "sni-name" IP ContextOption = "ip" )
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) DialTLSWithConfigImpersonate ¶ added in v0.0.29
func (d *Dialer) DialTLSWithConfigImpersonate(ctx context.Context, network, address string, config *tls.Config, impersonate impersonate.Strategy, identity *impersonate.Identity) (conn net.Conn, err error)
DialTLSWithConfigImpersonate dials tls with impersonation
func (*Dialer) DialZTLSWithConfig ¶ added in v0.0.15
func (d *Dialer) DialZTLSWithConfig(ctx context.Context, network, address string, config *ztls.Config) (conn net.Conn, err error)
DialZTLSWithConfig dials ztls with config
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 Options ¶
type Options struct { BaseResolvers []string MaxRetries int HostsFile bool ResolversFile bool EnableFallback bool Allow []string Deny []string AllowSchemeList []string DenySchemeList []string AllowPortList []int DenyPortList []int 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 ProxyDialer *proxy.Dialer WithZTLS bool SNIName string OnBeforeDial func(hostname, IP, port string) OnInvalidTarget func(hostname, IP, port string) OnDialCallback func(hostname, IP string) DisableZtlsFallback bool WithNetworkPolicyOptions *networkpolicy.Options Logger *log.Logger // optional logger to log errors(like hostfile init error) }
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
ja3 is a package for creating JA3 fingerprints from TLS clients.
|
ja3 is a package for creating JA3 fingerprints from TLS clients. |
impersonate
impersonate package contains strategy to impersonate a client and define an alias for the internal client tls spefications
|
impersonate package contains strategy to impersonate a client and define an alias for the internal client tls spefications |
metafiles are metadata files related to networking like /etc/hosts etc
|
metafiles are metadata files related to networking like /etc/hosts etc |
Click to show internal directories.
Click to hide internal directories.