Documentation
¶
Index ¶
- Variables
- func Dial(c *Config, network, address string) (net.Conn, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- 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) 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 *IOStats) Dialer
- func TLSDialer(forward Dialer, config *TLSConfig, timeout time.Duration) (Dialer, error)
- type DialerFunc
- type IOStats
- 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 NewClientWithDialer(d Dialer, network, host string, defaultPort int) (*Client, error)
func (*Client) IsConnected ¶
func (c *Client) IsConnected() bool
func (*Client) RemoteAddr ¶
func (c *Client) RemoteAddr() net.Addr
func (*Client) SetDeadline ¶
func (c *Client) SetDeadline(t time.Time) error
func (*Client) SetReadDeadline ¶
func (c *Client) SetReadDeadline(t time.Time) error
func (*Client) SetWriteDeadline ¶
func (c *Client) SetWriteDeadline(t time.Time) error
type Config ¶
type Config struct {
Proxy *ProxyConfig
TLS *TLSConfig
Timeout time.Duration
Stats *IOStats
}
type Dialer ¶
type Dialer interface {
Dial(network, address string) (net.Conn, error)
}
func ConnWrapper ¶
func ConnWrapper(d Dialer, w func(net.Conn) net.Conn) Dialer
func MakeDialer ¶
func MakeDialer(c *Config) (Dialer, error)
func ProxyDialer ¶
func ProxyDialer(config *ProxyConfig, forward Dialer) (Dialer, error)
func StatsDialer ¶
func StatsDialer(d Dialer, s *IOStats) Dialer
type DialerFunc ¶
type DialerFunc func(network, address string) (net.Conn, error)
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.
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
}
func (*TLSConfig) BuildModuleConfig ¶
func (c *TLSConfig) BuildModuleConfig(host string) *tls.Config
type TLSVerificationMode ¶
type TLSVerificationMode uint8
const (
VerifyFull TLSVerificationMode = iota
VerifyNone
)
type TLSVersion ¶
type TLSVersion uint16
const (
TLSVersionSSL30 TLSVersion = tls.VersionSSL30
TLSVersion10 TLSVersion = tls.VersionTLS10
TLSVersion11 TLSVersion = tls.VersionTLS11
TLSVersion12 TLSVersion = tls.VersionTLS12
)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.