connection

package
v0.0.0-...-4e8a67a Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc

type CallbackFunc func(ConnectionInterface)

type ConnectionInterface

type ConnectionInterface interface {
	Read(int) ([]byte, error)
	Write([]byte) error
	Close() error
	UpdateLogger(*logger.Logger)
}

type ServerInterface

type ServerInterface interface {
	Start(string, CallbackFunc)
	GetChannel() chan ConnectionInterface
}

type TcpConn

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

func NewTcpConn

func NewTcpConn(conn net.Conn) *TcpConn

func (*TcpConn) Close

func (t *TcpConn) Close() error

Close fecha a conexão TCP.

func (*TcpConn) Read

func (t *TcpConn) Read(length int) ([]byte, error)

ReadExactly lê exatamente n bytes da conexão TCP.

func (*TcpConn) UpdateLogger

func (t *TcpConn) UpdateLogger(logger *logger.Logger)

func (*TcpConn) Write

func (t *TcpConn) Write(data []byte) error

Write escreve dados na conexão TCP.

type TcpServer

type TcpServer struct {
	ChNewConn chan ConnectionInterface
	// contains filtered or unexported fields
}

func NewTcpServer

func NewTcpServer() *TcpServer

NewTcpServer cria uma nova instância de TcpServer.

func (*TcpServer) GetChannel

func (t *TcpServer) GetChannel() chan ConnectionInterface

func (*TcpServer) Start

func (t *TcpServer) Start(address string, fn CallbackFunc)

type TypeConnection

type TypeConnection int
const (
	TCP TypeConnection = iota
	WEBSOCKET
)

Jump to

Keyboard shortcuts

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