Documentation
¶
Index ¶
- Variables
- func ContainsAny(s string, substrs ...string) bool
- func CountLinesInFile(filename string) (int, error)
- func GetInterfaceIPv4(name string) (net.IP, error)
- func GetTLSConfig() *tls.Config
- func HasStdin() bool
- func IsFileExists(filePath string) bool
- func LoadLines(filename string) []string
- func LoadSSHKeyPaths(path string) []string
- func LookupAddr(addr string) (net.IP, error)
- func MD5Hex(s string) string
- func ParseFileByLine(filename string) <-chan string
- func ReadFull(conn net.Conn, buf []byte) (int, error)
- type CustomTransport
- type ProxyAwareDialer
- func (p *ProxyAwareDialer) Dial(network, addr string) (net.Conn, error)
- func (p *ProxyAwareDialer) DialAuto(network, addr string, encryption bool) (net.Conn, error)
- func (p *ProxyAwareDialer) DialAutoContext(ctx context.Context, network, addr string, encryption bool) (net.Conn, error)
- func (p *ProxyAwareDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func (p *ProxyAwareDialer) DialTLS(network, addr string, config *tls.Config) (net.Conn, error)
- func (p *ProxyAwareDialer) DialTLSContext(ctx context.Context, network, addr string, config *tls.Config) (net.Conn, error)
- func (p *ProxyAwareDialer) DialTimeout(network, addr string, timeout time.Duration) (net.Conn, error)
- func (p *ProxyAwareDialer) Timeout() time.Duration
- type TLSDialerWrapper
Constants ¶
This section is empty.
Variables ¶
var TLSConfig = &tls.Config{ InsecureSkipVerify: true, MinVersion: tls.VersionTLS10, }
Functions ¶
func ContainsAny ¶ added in v0.1.1
func CountLinesInFile ¶
func GetInterfaceIPv4 ¶ added in v1.0.0
GetInterfaceIPv4 returns the first IPv4 address bound to the named network interface. For loopback interfaces ("lo", "lo0") loopback addresses (127.x.x.x) are included. For all other interfaces loopback addresses are skipped. Returns an error if the interface does not exist or has no matching IPv4 address.
func GetTLSConfig ¶
GetTLSConfig returns a clone of the base TLS config so each caller can safely mutate fields (e.g. ServerName) without racing other callers.
func HasStdin ¶ added in v1.0.0
func HasStdin() bool
HasStdin returns true if data is being piped to stdin.
func IsFileExists ¶
IsFileExists checks if a file exists at the given path.
func LoadLines ¶ added in v1.0.0
LoadLines reads all non-empty lines from a file into a slice. If filename is not a real file, it returns a single-element slice.
func LoadSSHKeyPaths ¶ added in v1.0.0
LoadSSHKeyPaths handles -p for the sshkey module. If the argument is a PEM key file (starts with "-----"), the path itself becomes the single entry. If it's a plain text file of key paths, each line is loaded. If it's not a file at all, it's returned as-is (could be raw PEM passed on the command line).
func ParseFileByLine ¶ added in v0.1.1
ParseFileByLine is a function to read file in iterations
Types ¶
type CustomTransport ¶ added in v0.1.1
type CustomTransport struct {
Transport http.RoundTripper
UserAgent string
}
CustomTransport wraps http.Transport and adds a default User-Agent header.
type ProxyAwareDialer ¶
type ProxyAwareDialer struct {
HTTPClient *http.Client
UserAgent string
// contains filtered or unexported fields
}
func NewProxyAwareDialer ¶
func NewProxyAwareDialer(proxyHost, proxyAuth string, timeout time.Duration, userAgent string, localAddr net.IP) (*ProxyAwareDialer, error)
NewProxyAwareDialer creates a dialer with optional SOCKS5 proxy and optional local address binding. localAddr binds outgoing connections to a specific interface IP (nil = OS default).
func (*ProxyAwareDialer) Dial ¶
func (p *ProxyAwareDialer) Dial(network, addr string) (net.Conn, error)
func (*ProxyAwareDialer) DialAuto ¶ added in v1.0.0
DialAuto dials using TLS or plaintext based on the encryption flag.
func (*ProxyAwareDialer) DialAutoContext ¶ added in v1.0.0
func (p *ProxyAwareDialer) DialAutoContext(ctx context.Context, network, addr string, encryption bool) (net.Conn, error)
DialAutoContext dials using TLS or plaintext based on the encryption flag, with context support.
func (*ProxyAwareDialer) DialContext ¶
func (*ProxyAwareDialer) DialTLSContext ¶
func (p *ProxyAwareDialer) DialTLSContext(ctx context.Context, network, addr string, config *tls.Config) (net.Conn, error)
DialTLSContext establishes a TLS connection with context support
func (*ProxyAwareDialer) DialTimeout ¶
func (p *ProxyAwareDialer) DialTimeout(network, addr string, timeout time.Duration) (net.Conn, error)
DialTimeout dials with a specific timeout (implements pq.Dialer interface)
func (*ProxyAwareDialer) Timeout ¶
func (p *ProxyAwareDialer) Timeout() time.Duration
type TLSDialerWrapper ¶
type TLSDialerWrapper struct {
Dialer *ProxyAwareDialer
}
TLSDialerWrapper wraps ProxyAwareDialer to use TLS for all connections
func (*TLSDialerWrapper) Dial ¶
func (w *TLSDialerWrapper) Dial(network, addr string) (net.Conn, error)