server

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientNotExists = fmt.Errorf("client session is not exists")
	ErrClientIDReused  = fmt.Errorf("client id is reused. %w", ErrClientNotExists)
)

Functions

func ExportClients

func ExportClients(hub *Hub) map[uint64]*bash.Client

Types

type Header [12]byte

func (*Header) ID

func (h *Header) ID() uint64

func (*Header) MsgType

func (h *Header) MsgType() MsgType

func (*Header) String

func (h *Header) String() string

func (*Header) Version

func (h *Header) Version() uint8

type Hub

type Hub struct {
	OnSessionOpen func(bash.Session) func()
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) Close

func (hub *Hub) Close() (err error)

func (*Hub) NewClientSession

func (hub *Hub) NewClientSession(conn net.Conn) (err error)

func (*Hub) Serve

func (hub *Hub) Serve(l net.Listener) (err error)

func (*Hub) ServeConn

func (hub *Hub) ServeConn(conn net.Conn) (err error)

type MsgType

type MsgType uint8
const (
	MsgToSession MsgType = iota
	MsgInitSession
)

Jump to

Keyboard shortcuts

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