protocol

package module
v0.0.0-...-24aa3bb Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: GPL-3.0 Imports: 10 Imported by: 13

README

protocol

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TYPEERROR   = errors.New("Unsupport Type")
	ENCODEERROR = errors.New("Failed To Encode")
)

Functions

func New

func New(port int, usr interface{}, brk breaker.Breaker, df DealFunc) *server

func NewMessageWriter

func NewMessageWriter(w *bufio.Writer) *messageWriter

func NewUnit

func NewUnit(rc int, addr string, timeout time.Duration) *unit

Types

type DealFunc

type DealFunc (func(interface{}, MessageWriter, *Message))

type Message

type Message struct {
	Name string
	Msg  interface{}
}

func NewMessage

func NewMessage(name string, x interface{}) *Message

func ReadMessage

func ReadMessage(r *bufio.Reader) (*Message, error)

type MessageArray

type MessageArray struct {
	M []string
}

type MessageError

type MessageError struct {
	M string
}

type MessageWriter

type MessageWriter interface {
	Write(string, interface{}) error
	WriteMessage(*Message) error
}

type Server

type Server interface {
	Run()
	Stop()
}

type Unit

type Unit interface {
	Remove() error
	Recv() (*Message, error)
	Send(string, interface{}) error
	SendAndRecv(string, interface{}) (*Message, error)
}

Jump to

Keyboard shortcuts

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