server

package
v0.0.0-...-19e5693 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Clients           = make(map[string]*Client)
	ClientLastConnect = make(map[string]time.Time)
	ErrClientExists   = errors.New("client id already exists")
)

Functions

func AddClient

func AddClient(clientId string, c *Client) error

func InternalServer

func InternalServer(listenAddr string, timeout time.Duration) error

func PublicServer

func PublicServer(listenAddr string) error

func RemoveClient

func RemoveClient(clientId string)

func TimeoutConnections

func TimeoutConnections(timeout time.Duration)

Types

type Client

type Client struct {
	ID     string          `json:"id"`
	IP     string          `json:"ip"`
	Port   int             `json:"port"`
	Conn   net.Conn        `json:"-"`
	WSConn *websocket.Conn `json:"-"`
	WSCtx  context.Context `json:"-"`
}

Jump to

Keyboard shortcuts

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