client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCloseClosedSession = errors.New("close closed session")
	ErrBrokenPipe         = errors.New("broken low-level pipe")
	ErrHandshake          = errors.New("handshake failed")
	ErrHandshakeAck       = errors.New("handshake ack failed")
	ErrHandshakeTimeout   = errors.New("handshake timeout failed")
	ErrHeartbeatTimeout   = errors.New("heartbeat timeout")
	ErrDialTimeout        = errors.New("dial timeout")
	ErrDialInterrupt      = errors.New("dial interrupt")
	ErrInvalidPacket      = errors.New("invalid packet")
)

Errors that could be occurred during message handling.

Functions

func Dial

func Dial(addr string, opts ...Option) (gira.GatewayClient, error)

Types

type ClientConn

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

func (*ClientConn) Close

func (conn *ClientConn) Close() error

关闭链接,使recv等阻塞操作立刻返回

func (*ClientConn) Notify

func (conn *ClientConn) Notify(route string, data []byte) error

/ 发送通知

func (*ClientConn) Recv

func (conn *ClientConn) Recv(ctx context.Context) (typ int, route string, reqId uint64, data []byte, err error)

func (*ClientConn) Request

func (conn *ClientConn) Request(route string, reqId uint64, data []byte) error

/ 发送请求

type Option

type Option func(conn *ClientConn)

func WithContext

func WithContext(ctx context.Context) Option

func WithDebugMode

func WithDebugMode(debug bool) Option

func WithDialTimeout

func WithDialTimeout(timeout time.Duration) Option

func WithDictionary

func WithDictionary(dict map[string]uint16) Option

func WithHandshakeTimeout

func WithHandshakeTimeout(timeout time.Duration) Option

func WithHandshakeValidator

func WithHandshakeValidator(fn func([]byte) error) Option

func WithHeartbeatInterval

func WithHeartbeatInterval(d time.Duration) Option

func WithIsWebsocket

func WithIsWebsocket(enableWs bool) Option

func WithRSAPublicKey

func WithRSAPublicKey(keyFile string) Option

func WithRecvBacklog

func WithRecvBacklog(v int) Option

func WithRecvBuffSize

func WithRecvBuffSize(v int) Option

func WithSendBacklog

func WithSendBacklog(v int) Option

func WithServerAdd

func WithServerAdd(addr string) Option

func WithTSLConfig

func WithTSLConfig(certificate, key string) Option

func WithTSLInsecure

func WithTSLInsecure(insecureSkipVerify bool) Option

func WithWSPath

func WithWSPath(path string) Option

Jump to

Keyboard shortcuts

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