server

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	BuildTime = "unknown"
	GitCommit = "unknown"
)

Version information - these will be set during build via main package

Functions

func ClientHandler

func ClientHandler(ws *websocket.Conn)

func HandleArgs added in v0.4.1

func HandleArgs() bool

HandleArgs processes command-line arguments and returns true if the program should exit

func InitStatsMonitoring

func InitStatsMonitoring()

Start stats monitoring

func PrintStats

func PrintStats()

PrintStats periodically logs messaging and connection statistics

func Run added in v0.4.1

func Run() error

Run starts the GRAIN relay server with configuration management and graceful shutdown

func SetVersionInfo added in v0.4.1

func SetVersionInfo(version, buildTime, gitCommit string)

SetVersionInfo allows main package to set version information

Types

type Client

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

Client implements ClientInterface

func (*Client) ClientInfo

func (c *Client) ClientInfo() string

func (*Client) CloseClient

func (c *Client) CloseClient()

CloseClient closes the client connection and cleans up resources

func (*Client) GetSubscriptions

func (c *Client) GetSubscriptions() map[string][]nostr.Filter

func (*Client) GetWS

func (c *Client) GetWS() *websocket.Conn

func (*Client) IsConnected

func (c *Client) IsConnected() bool

IsConnected returns true if the client connection is still active

func (*Client) SendMessage

func (c *Client) SendMessage(msg interface{})

Implement `ClientInterface` methods SendMessage sends a message with write timeout and proper error handling

type ConnectionManager

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

ConnectionManager tracks connections and memory usage

func (*ConnectionManager) GetConnectionCount

func (cm *ConnectionManager) GetConnectionCount() int

GetConnectionCount returns the current number of connections

func (*ConnectionManager) GetMemoryStats

func (cm *ConnectionManager) GetMemoryStats() map[string]interface{}

GetMemoryStats returns memory statistics for monitoring

func (*ConnectionManager) RegisterConnection

func (cm *ConnectionManager) RegisterConnection(client *Client)

RegisterConnection adds a connection to the manager

func (*ConnectionManager) RemoveConnection

func (cm *ConnectionManager) RemoveConnection(client *Client)

RemoveConnection removes a connection from tracking

Directories

Path Synopsis
db
log

Jump to

Keyboard shortcuts

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