brokerc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package brokerc provides functionality to create a Broker Client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Connect to peer by ID
	ConnectPeerById func(peerId string, mode p2p.ConnectionMode) (conn *p2pc.Connection, err error)
	// Connect to peer by Tag
	ConnectPeerByTag func(tag string, mode p2p.ConnectionMode) (conn *p2pc.Connection, err error)

	// Client exit channel
	Exit chan bool
	// contains filtered or unexported fields
}

Broker Client

func New

func New(
	config Config,
	streamHandler udp.StreamHandler,
) (c *Client, err error)

Create Client

func (*Client) Close

func (c *Client) Close()

Close Client

func (*Client) Connect

func (c *Client) Connect() (err error)

Connect to Broker Server

func (*Client) SetCanConnectHandler

func (c *Client) SetCanConnectHandler(handler udpc.CanConnect)

Set CanConnect Handler

func (*Client) SetCanReconnectHandler

func (c *Client) SetCanReconnectHandler(handler udpc.CanReconnect)

Set CanReconnect Handler

func (*Client) SetConnectedHandler

func (c *Client) SetConnectedHandler(handler udpc.ConnectedHandler)

Set Connected Handler

func (*Client) SetConnectionHandler

func (c *Client) SetConnectionHandler(handler p2pc.ConnectionHandler)

Set New Connection Handler

func (*Client) SetDisconnectedHandler

func (c *Client) SetDisconnectedHandler(handler udpc.DisconnectedHandler)

Set Disconnected Handler

func (*Client) SetMessageStreamHandler

func (c *Client) SetMessageStreamHandler(handler p2pc.MessageStreamHandler)

Set Message Stream Handler

type Config

type Config struct {
	// Debug Mode
	Debug bool
	// UDP Client Config
	UdpcConfig udpc.Config
	// P2P Client Manager Config
	P2PConfig p2pc.Config
}

Broker Client Config

Jump to

Keyboard shortcuts

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