server

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKeepAlive = 5 * time.Minute
)

Variables

This section is empty.

Functions

func LogMiddleware

func LogMiddleware(next http.Handler) http.Handler

LogMiddleware logs HTTP requests to the standard logger with timing info.

func SetupLogging

func SetupLogging(buf *LogBuffer)

SetupLogging redirects log output to the in-memory buffer and, by default, mirrors it to stderr and ~/.csghub-lite/logs/csghub-lite.log.

Types

type LogBuffer

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

LogBuffer is a thread-safe ring buffer for log lines, supporting SSE subscribers.

func NewLogBuffer

func NewLogBuffer(maxSize int) *LogBuffer

func (*LogBuffer) Recent

func (lb *LogBuffer) Recent(n int) []string

func (*LogBuffer) Subscribe

func (lb *LogBuffer) Subscribe() chan string

func (*LogBuffer) Unsubscribe

func (lb *LogBuffer) Unsubscribe(ch chan string)

func (*LogBuffer) Write

func (lb *LogBuffer) Write(p []byte) (n int, err error)

type Server

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

func New

func New(cfg *config.Config, version string) *Server

func (*Server) Run

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

Jump to

Keyboard shortcuts

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