Documentation ¶
Index ¶
- Constants
- Variables
- func FasthttpHTTPDialerProxy(proxy string) fasthttp.DialFunc
- func FasthttpHTTPDialerProxyTimeout(proxy string, timeout time.Duration) fasthttp.DialFunc
- func FetchReliableDNSRecords(url string) ([]string, error)
- func Get(requestURI string) ([]byte, int, error)
- func GetFast(requestURI string) ([]byte, int, error)
- func GetProxyUrl() func(*http.Request) (*url.URL, error)
- type DNSRecord
Constants ¶
View Source
const DefaultMaxBody int64 = 1024 * 1024 * 1024 // 1GB
Variables ¶
View Source
var DnsResolver = &net.Resolver{ Dial: func(ctx context.Context, network, address string) (net.Conn, error) { d := &net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, DualStack: true, } i := int(atomic.AddUint64(¤tResolverIndex, 1)) % len(dnsResolvers) return d.DialContext(ctx, "udp", dnsResolvers[i]+":53") }, }
DNSResolver resolves DNS nameservers randomly that previously loaded.
View Source
var FasthttpDialer = &fasthttp.TCPDialer{ Concurrency: 1000, DNSCacheDuration: fasthttp.DefaultDNSCacheDuration * 60, Resolver: DnsResolver, }
Functions ¶
func FasthttpHTTPDialerProxy ¶
FasthttpHTTPDialer returns a fasthttp.DialFunc that dials using the provided HTTP proxy.
Example usage:
c := &fasthttp.Client{ Dial: fasthttpproxy.FasthttpHTTPDialer("username:password@localhost:9050"), }
func FasthttpHTTPDialerProxyTimeout ¶
FasthttpHTTPDialerTimeout returns a fasthttp.DialFunc that dials using the provided HTTP proxy using the given timeout.
Example usage:
c := &fasthttp.Client{ Dial: fasthttpproxy.FasthttpHTTPDialerTimeout("username:password@localhost:9050", time.Second * 2),
func FetchReliableDNSRecords ¶
Types ¶
type DNSRecord ¶
type DNSRecord struct { IP string `json:"ip"` Name string `json:"name"` ASNumber int `json:"as_number"` ASOrg string `json:"as_org"` CountryID string `json:"country_id"` City string `json:"city"` Version string `json:"version"` Error string `json:"error"` DNSSEC bool `json:"dnssec"` Reliability float64 `json:"reliability"` CheckedAt string `json:"checked_at"` CreatedAt string `json:"created_at"` }
Click to show internal directories.
Click to hide internal directories.