server

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: AGPL-3.0 Imports: 23 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, allowedOrigins []string, disableSystemStats bool) 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"`
	BytesUploaded   int64               `json:"bytesUploaded"`
	BytesDownloaded int64               `json:"bytesDownloaded"`
	StartTime       time.Time           `json:"startTime"`
	System          *system.SystemStats `json:"system,omitempty"`
}

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