client

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Debug = iota
	Conn
	Error
	Fatal
)

Message levels control which messages will be sent to h.Msgr

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// transmission sequence id
	Seq uint32
	// contains filtered or unexported fields
}

Client is a Petrel client instance.

func TCPClient

func TCPClient(c *Config) (*Client, error)

TCPClient returns a Client which uses TCP.

func TLSClient

func TLSClient(c *Config, t *tls.Config) (*Client, error)

TLSClient returns a Client which uses TLS + TCP.

func UnixClient

func UnixClient(c *Config) (*Client, error)

UnixClient returns a Client which uses Unix domain sockets.

func (*Client) Dispatch

func (c *Client) Dispatch(req []byte) ([]byte, error)

Dispatch sends a request and returns the response.

func (*Client) DispatchRaw

func (c *Client) DispatchRaw(xmission []byte) ([]byte, error)

DispatchRaw sends a pre-encoded transmission and returns the response.

func (*Client) Quit

func (c *Client) Quit()

Quit terminates the client's network connection and other operations.

type Config added in v0.34.0

type Config struct {
	// For Unix clients, Addr takes the form "/path/to/socket". For
	// TCP clients, it is either an IPv4 or IPv6 address followed by
	// the desired port number ("127.0.0.1:9090", "[::1]:9090").
	Addr string

	// Timeout is the number of milliseconds the client will wait
	// before timing out due to on a Dispatch() or Read()
	// call. Default (zero) is no timeout.
	Timeout int64

	//HMACKey is the secret key used to generate MACs for signing
	//and verifying messages. Default (nil) means MACs will not be
	//generated for messages sent, or expected for messages
	//received.
	HMACKey []byte
}

Config holds values to be passed to the client constructor.

Jump to

Keyboard shortcuts

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