client

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	IP        string
	PORT      any
	Conn      net.Conn
	CONFIG    *quickproto.Config
	OnMessage func(*quickproto.Message)
	AesKey    *[32]byte
	Cookies   map[string][]string
}

Client struct for connecting to a server.

func New added in v1.1.6

func New(ip string, port any, conf *quickproto.Config, onmessage func(*quickproto.Message)) *Client

Initiate a new client.

func (*Client) Addr

func (c *Client) Addr() string

Addr returns the address of the server, in the form "ip:port".

func (*Client) Connect

func (c *Client) Connect(typ ...string) error

Connect to the server.

func (*Client) GetCookies added in v1.5.1

func (c *Client) GetCookies(key string) []string

func (*Client) Listen added in v1.3.1

func (c *Client) Listen() error

Listen for messages from the server.

func (*Client) Read

func (c *Client) Read() (*quickproto.Message, error)

Read a message from the server.

func (*Client) Terminate

func (c *Client) Terminate() error

Terminate the connection.

func (*Client) Write

func (c *Client) Write(msg *quickproto.Message) error

Write a message to the server.

Jump to

Keyboard shortcuts

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