utils

package
v2.2.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTimeoutError

func IsTimeoutError(err error) bool

IsTimeoutError will check whether the err is a timeout error.

func URLQueryEscape

func URLQueryEscape(origin string) string

URLQueryEscape escapes the original string.

func URLQueryUnescape

func URLQueryUnescape(escaped string) (string, error)

URLQueryUnescape unescapes the escaped string.

Types

type Conn

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

Conn is a generic stream-oriented network connection.

func NewConn

func NewConn(c netConn) *Conn

NewConn will create a new conn.

func (Conn) Close

func (c Conn) Close() (err error)

Close will close the conn.

func (Conn) Read

func (c Conn) Read(buf []byte) (n int, err error)

Read will read from the conn.

func (*Conn) SetReadTimeout

func (c *Conn) SetReadTimeout(d time.Duration)

SetReadTimeout will set the conn's read timeout.

func (*Conn) SetWriteTimeout

func (c *Conn) SetWriteTimeout(d time.Duration)

SetWriteTimeout will set the conn's write timeout.

func (Conn) Write

func (c Conn) Write(buf []byte) (n int, err error)

Write will write into the conn.

type Dialer

type Dialer struct {
	*net.Dialer
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Dialer is wrapped dialer provided by qingstor go sdk.

We provide this dialer wrapper ReadTimeout & WriteTimeout attributes into connection object. This timeout is for individual buffer I/O operation like other language (python, perl... etc), so don't bother with SetDeadline or stupid nethttp.Client timeout.

func NewDialer

func NewDialer(connTimeout, readTimeout, writeTimeout time.Duration) *Dialer

NewDialer will create a new dialer.

func (*Dialer) Dial

func (d *Dialer) Dial(network, addr string) (net.Conn, error)

Dial connects to the address on the named network.

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

DialContext connects to the address on the named network using the provided context.

Jump to

Keyboard shortcuts

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