network

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCPConnection uint8 = 0x0
	TLSConnection uint8 = 0x1

	TextMessage   uint8 = 0x1
	BinaryMessage uint8 = 0x2
	PingMessage   uint8 = 0x3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Cert string
	Key  string

	Ready     func(conn net.Conn)
	Message   func(conn net.Conn, text *string, binary []byte)
	Failed    func(conn net.Conn, err error)
	Cancelled func(conn net.Conn)
	// contains filtered or unexported fields
}

Connection is a a tcp based connection this is for handling pure tcp connections

func (*Connection) Cancel

func (connection *Connection) Cancel()

Cancel closes all connections and stops the listener from accepting new connections

func (*Connection) SendBinaryMessage

func (connection *Connection) SendBinaryMessage(conn net.Conn, data []byte)

SendBinaryMessage is for sending a text based message

func (*Connection) SendTextMessage

func (connection *Connection) SendTextMessage(conn net.Conn, str string)

SendTextMessage is for sending a text based message

func (*Connection) Start

func (connection *Connection) Start(parameter uint8, port uint16) error

Start the NetworkGO connection listener waits for incoming connections

Jump to

Keyboard shortcuts

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