server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INTERNAL_PAGE_HOME string = "/"
	INTERNAL_PAGE_PING string = "/_/ping/"
)
View Source
const (
	TYPE_NOT_FOUND int = 0
	TYPE_HOME      int = 1
	TYPE_PING      int = 2
)
View Source
const LABEL_NO_VALID_VALUE = "N/A"
View Source
const SERVER_DEFAULT_TEMPLATE = `` /* 15733-byte string literal not displayed */

Variables

This section is empty.

Functions

func CreateRouter added in v0.7.0

func CreateRouter(handler http.Handler, cacheDir string) http.Handler

CreateRouter creates an http.Handler with orthodox routing using http.ServeMux. It registers home and ping handlers, and uses the provided handler for package requests.

func GetBaseTemplate

func GetBaseTemplate(cacheSize string, filesNumber string, availableSize string,
	memoryUsage string, goroutines string) string

func GetInternalResType

func GetInternalResType(url string) int

func IsInternalUrls

func IsInternalUrls(url string) bool

func RenderInternalUrls

func RenderInternalUrls(url string, cacheDir string) (string, int)

Types

type PackageStruct added in v0.7.0

type PackageStruct struct {
	Handler  http.Handler  // The underlying HTTP handler (typically a reverse proxy)
	Rules    []define.Rule // Caching rules for different package types
	CacheDir string        // Cache directory path for statistics
}

PackageStruct is the main HTTP handler that routes requests to appropriate distribution-specific handlers and applies caching rules.

func CreatePackageStructRouter added in v0.7.0

func CreatePackageStructRouter(cacheDir string) *PackageStruct

CreatePackageStructRouter initializes and returns a new PackageStruct instance configured for the current proxy mode. It sets up URL rewriters and caching rules.

func (*PackageStruct) ServeHTTP added in v0.7.0

func (ap *PackageStruct) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface. It processes incoming requests, matches them against caching rules, and routes them to the appropriate handler. If a matching rule is found, the request is processed with cache control headers.

Jump to

Keyboard shortcuts

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