transport

package
v5.0.0-alpha5+incompat... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotConnected = errors.New("client is not connected")
)

Functions

func Dial

func Dial(c *Config, network, address string) (net.Conn, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *Config, network, host string, defaultPort int) (*Client, error)

func NewClientWithDialer

func NewClientWithDialer(d Dialer, network, host string, defaultPort int) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) IsConnected

func (c *Client) IsConnected() bool

func (*Client) LocalAddr

func (c *Client) LocalAddr() net.Addr

func (*Client) Read

func (c *Client) Read(b []byte) (int, error)

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

func (*Client) Write

func (c *Client) Write(b []byte) (int, error)

type Config

type Config struct {
	Proxy   *ProxyConfig
	TLS     *tls.Config
	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 NetDialer

func NetDialer(timeout time.Duration) Dialer

func ProxyDialer

func ProxyDialer(config *ProxyConfig, forward Dialer) (Dialer, error)

func StatsDialer

func StatsDialer(d Dialer, s *IOStats) Dialer

func TLSDialer

func TLSDialer(tlscfg *tls.Config, timeout time.Duration, forward Dialer) Dialer

type DialerFunc

type DialerFunc func(network, address string) (net.Conn, error)

func (DialerFunc) Dial

func (d DialerFunc) Dial(network, address string) (net.Conn, error)

type IOStats

type IOStats struct {
	Read, Write, ReadErrors, WriteErrors *expvar.Int
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL