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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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