client

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// common options
	Options
	// client type
	ConnUse api.UseType
	// consumer for raw data
	Consumer io.Writer
	// extend options
	ExOpts interface{}
	// contains filtered or unexported fields
}

client including common options and extend options

func (*Client) Close

func (c *Client) Close() error

close the connection

func (*Client) Connect

func (c *Client) Connect() (conn.Connection, error)

Connect try to connect remote peer

type Options

type Options struct {
	// protocol type
	Type string
	// the addr or url
	Addr string
	// client type
	ConnUse api.UseType
	// used to configure a TLS client
	TLSConfig *tls.Config
	// the message will route to Handler automatically if AutoRoute is true
	Handler mux.Handler
	// auto route flag
	AutoRoute bool
	// HandshakeTimeout is the maximum duration that the cryptographic handshake may take.
	HandshakeTimeout time.Duration
	// consumer for raw data
	Consumer io.Writer
}

the common options of client

type ProtocolClient

type ProtocolClient interface {
	Connect() (conn.Connection, error)
}

protocol client each protocol(websocket/quic) provide Connect

type QuicClient

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

the client based on quic

func NewQuicClient

func NewQuicClient(opts Options, exOpts interface{}) *QuicClient

new a quic client instance

func (*QuicClient) Connect

func (c *QuicClient) Connect() (conn.Connection, error)

try to dial server and get connection interface for operations

type WSClient

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

the client based on websocket

func NewWSClient

func NewWSClient(options Options, exOpts interface{}) *WSClient

new websocket client instance

func (*WSClient) Connect

func (c *WSClient) Connect() (conn.Connection, error)

Connect try to connect remote server

Jump to

Keyboard shortcuts

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