net

package
Version: v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMLI

func AddMLI(mliType MliType, data []byte) []byte

* This function adds a mli (length indicator) based on the type of mli - 2I, 2L etc *

func HandleError

func HandleError(err error)

Types

type EchoServ

type EchoServ struct {
	TcpAddr *net.TCPAddr
}

func (*EchoServ) ListenAndAccept

func (echoServ *EchoServ) ListenAndAccept() (err error)

type MliType

type MliType string
const (
	Mli2i MliType = "2i"
	Mli2e MliType = "2e"
)

type NetCatClient

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

func NewNetCatClient

func NewNetCatClient(connectionStr string, mliType MliType) *NetCatClient

func (*NetCatClient) Close

func (nt *NetCatClient) Close()

func (*NetCatClient) IsConnected

func (nt *NetCatClient) IsConnected() bool

func (*NetCatClient) OpenConnection

func (nt *NetCatClient) OpenConnection() (err error)

func (*NetCatClient) Read

func (nt *NetCatClient) Read(data []byte) (n int, err error)

func (*NetCatClient) ReadNextPacket

func (nt *NetCatClient) ReadNextPacket() ([]byte, error)

func (*NetCatClient) Write

func (nt *NetCatClient) Write(data []byte) (err error)

type TcpHost

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

func NewTcpHost

func NewTcpHost(mliType MliType, tcpAddr *net.TCPAddr) *TcpHost

func (*TcpHost) SetHandler

func (tcpHost *TcpHost) SetHandler(handler TcpMessageHandler)

func (*TcpHost) Start

func (tcpHost *TcpHost) Start()

type TcpMessageHandler

type TcpMessageHandler interface {
	HandleMessage(clientCon *net.TCPConn, msgData []byte)
}

Jump to

Keyboard shortcuts

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