server

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the local IP address

func StatsSocketHandler

func StatsSocketHandler(sharedDir string) http.HandlerFunc

StatsSocketHandler handles WebSocket connections for real-time stats updates It fetches fresh stats from the database and system on each interval and sends them to the client

Types

type ExtendedStats

type ExtendedStats struct {
	Downloads int                `json:"downloads"`
	Requests  int                `json:"requests"`
	Uploads   int                `json:"uploads"`
	StartTime time.Time          `json:"startTime"`
	System    system.SystemStats `json:"system"`
}

ExtendedStats contains both database stats and system stats

type Server

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

func New

func New(sharedDir string, flags config.Flags) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server and all managed resources. It drains in-flight HTTP requests within the given context deadline, then closes the rate limiter, orphan cleaner, database, and logger.

func (*Server) Start

func (s *Server) Start() error

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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