Documentation
¶
Index ¶
- Variables
- func Dial(c *Config, network, address string) (net.Conn, error)
- func DialWith(dialer Dialer, network, host string, addresses []string, port string) (c net.Conn, err error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) Host() string
- func (c *Client) IsConnected() bool
- func (c *Client) LocalAddr() net.Addr
- func (c *Client) Read(b []byte) (int, error)
- func (c *Client) RemoteAddr() net.Addr
- func (c *Client) SetDeadline(t time.Time) error
- func (c *Client) SetReadDeadline(t time.Time) error
- func (c *Client) SetWriteDeadline(t time.Time) error
- func (c *Client) Test(d testing.Driver)
- func (c *Client) Write(b []byte) (int, error)
- type Config
- type Dialer
- func ConnWrapper(d Dialer, w func(net.Conn) net.Conn) Dialer
- func MakeDialer(c *Config) (Dialer, error)
- func NetDialer(timeout time.Duration) Dialer
- func ProxyDialer(config *ProxyConfig, forward Dialer) (Dialer, error)
- func StatsDialer(d Dialer, s IOStatser) Dialer
- func TLSDialer(forward Dialer, config *TLSConfig, timeout time.Duration) (Dialer, error)
- func TestNetDialer(d testing.Driver, timeout time.Duration) Dialer
- func TestTLSDialer(d testing.Driver, forward Dialer, config *TLSConfig, timeout time.Duration) (Dialer, error)
- type DialerFunc
- type IOStatser
- type ProxyConfig
- type TLSConfig
- type TLSVerificationMode
- type TLSVersion
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotConnected = errors.New("client is not connected")
)
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithDialer ¶
func (*Client) IsConnected ¶
func (*Client) RemoteAddr ¶
type Config ¶
type Config struct {
Proxy *ProxyConfig
TLS *TLSConfig
Timeout time.Duration
Stats IOStatser
}
type Dialer ¶
func MakeDialer ¶
func ProxyDialer ¶
func ProxyDialer(config *ProxyConfig, forward Dialer) (Dialer, error)
func StatsDialer ¶
type DialerFunc ¶
type ProxyConfig ¶
type ProxyConfig struct {
// URL of the SOCKS proxy. Scheme must be socks5. Username and password can be
// embedded in the URL.
URL string `config:"proxy_url"`
// Resolve names locally instead of on the SOCKS server.
LocalResolve bool `config:"proxy_use_local_resolver"`
}
ProxyConfig holds the configuration information required to proxy connections through a SOCKS5 proxy server.
func (*ProxyConfig) Validate ¶
func (c *ProxyConfig) Validate() error
type TLSConfig ¶
type TLSConfig struct {
// List of allowed SSL/TLS protocol versions. Connections might be dropped
// after handshake succeeded, if TLS version in use is not listed.
Versions []TLSVersion
// Configure SSL/TLS verification mode used during handshake. By default
// VerifyFull will be used.
Verification TLSVerificationMode
// List of certificate chains to present to the other side of the
// connection.
Certificates []tls.Certificate
// Set of root certificate authorities use to verify server certificates.
// If RootCAs is nil, TLS might use the system its root CA set (not supported
// on MS Windows).
RootCAs *x509.CertPool
// List of supported cipher suites. If nil, a default list provided by the
// implementation will be used.
CipherSuites []uint16
// Types of elliptic curves that will be used in an ECDHE handshake. If empty,
// the implementation will choose a default.
CurvePreferences []tls.CurveID
// Renegotiation controls what types of renegotiation are supported.
// The default, never, is correct for the vast majority of applications.
Renegotiation tls.RenegotiationSupport
}
type TLSVerificationMode ¶
type TLSVerificationMode uint8
const ( VerifyFull TLSVerificationMode = iota VerifyNone )
func (TLSVerificationMode) String ¶
func (m TLSVerificationMode) String() string
func (*TLSVerificationMode) Unpack ¶
func (m *TLSVerificationMode) Unpack(in interface{}) error
type TLSVersion ¶
type TLSVersion uint16
const ( TLSVersionSSL30 TLSVersion = tls.VersionSSL30 TLSVersion10 TLSVersion = tls.VersionTLS10 TLSVersion11 TLSVersion = tls.VersionTLS11 TLSVersion12 TLSVersion = tls.VersionTLS12 )
func (TLSVersion) String ¶
func (v TLSVersion) String() string
func (*TLSVersion) Unpack ¶
func (v *TLSVersion) Unpack(s string) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.