giotgo

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const CLIENT_BUFFER_SZ = 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientHandler

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

func NewClientHandler

func NewClientHandler(conn *net.Conn, server *Server, timeout int) *ClientHandler

func (*ClientHandler) Command

func (client *ClientHandler) Command(cmd giot_packet.Command, data []byte)

func (*ClientHandler) Context

func (client *ClientHandler) Context() context.Context

func (*ClientHandler) Execute

func (client *ClientHandler) Execute(cmd giot_packet.Command, data giot_packet.Data)

type ClientState

type ClientState uint8
const (
	CLIENT_STATE_CLOSE ClientState = iota
	CLIENT_STATE_CONNECTING
	CLIENT_STATE_CONNECT
	CLIENT_STATE_READIKNG_PAYLOAD
)

type CommandExecutor

type CommandExecutor func(client *ClientHandler, data giot_packet.Data)

type CommandHandler

type CommandHandler func(client *ClientHandler, data giot_packet.Data) (giot_packet.RespStatus, *bytes.Buffer)

type Server

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

func NewServer

func NewServer() *Server

func (*Server) ClientAuth

func (svr *Server) ClientAuth(authenticator func(username, password string) bool)

func (*Server) On

func (svr *Server) On(cmd giot_packet.Command, handler CommandHandler)

func (*Server) OnExecute

func (svr *Server) OnExecute(cmd giot_packet.Command, handler CommandExecutor)

func (*Server) Serve

func (svr *Server) Serve(addr string)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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