Documentation
¶
Overview ¶
Copyright 2026 Reto Gantenbein SPDX-License-Identifier: Apache-2.0
Copyright 2026 Reto Gantenbein SPDX-License-Identifier: Apache-2.0
Copyright 2022 Reto Gantenbein SPDX-License-Identifier: Apache-2.0
Copyright 2022 Reto Gantenbein SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LandingHandler ¶
func LandingHandler(config *RepoConfig, publicAddr string) echo.HandlerFunc
LandingHandler returns an Echo handler that renders an HTML overview page listing all configured repositories, their mirrors, and package manager snippets. publicAddr is the address (host or host:port) rendered in config snippets.
func LoadConfig ¶
func LoadConfig(config *RepoConfig, path string) error
func NewEcho ¶ added in v0.3.0
NewEcho returns an Echo instance with pkgproxy's router configuration. It registers no routes and no middleware; callers wire those up themselves.
AutoHandleHEAD lets the router answer HEAD requests with the matching GET route. Without it the landing page only accepts GET and replies 405 to HEAD, which is inconsistent with the proxy itself (HEAD is an allowed method) and breaks health check probes that use HEAD on "/".
AllowOverwritingRoute must be set explicitly: NewWithConfig replaces the router wholesale and does not inherit the defaults echo.New() applies.
Types ¶
type PkgProxy ¶
type PkgProxy interface {
Cache(echo.HandlerFunc) echo.HandlerFunc
ForwardProxy(echo.HandlerFunc) echo.HandlerFunc
}
func New ¶
func New(config *PkgProxyConfig) PkgProxy
type PkgProxyConfig ¶
type PkgProxyConfig struct {
CacheBasePath string
RepositoryConfig *RepoConfig
// To customize the transport to remote.
// Examples: If custom TLS certificates are required.
Transport http.RoundTripper
}
type RepoConfig ¶
type RepoConfig struct {
Repositories map[string]Repository `yaml:"repositories"`
}
RepoConfig defines the upstream package repositories