server

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package server implements the Epoch HTTP server.

It serves two APIs:

  • /v2/ — OCI Distribution-shaped push/pull protocol (manifests + blob streaming via object storage)
  • /api/ — Control plane API backed by MySQL

Static frontend files are embedded and served at /.

Routing uses gorilla/mux because Go 1.22+ stdlib net/http.ServeMux's pattern-conflict checks reject the combination of exact-match GET routes (`GET /v2/_catalog`) and method-specific wildcards (`HEAD /v2/{path...}`) that the OCI Distribution shape needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinalizedUpload added in v0.1.7

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

FinalizedUpload owns the tempfile holding a finalized upload session. Callers MUST Close it after digest verification + persisting; that is the only way the underlying tempfile gets removed from disk.

func (*FinalizedUpload) Close added in v0.1.7

func (f *FinalizedUpload) Close() error

Close removes the underlying tempfile. Idempotent.

func (*FinalizedUpload) Reader added in v0.1.7

func (f *FinalizedUpload) Reader() (io.Reader, error)

Reader rewinds the underlying tempfile to offset 0 and returns it as an io.Reader. Safe to call multiple times — the digest-verify pass and the upload-to-S3 pass each call Reader once and stream the same file twice without copying its contents into memory.

func (*FinalizedUpload) Size added in v0.1.7

func (f *FinalizedUpload) Size() int64

Size returns the total bytes accumulated by the session.

type SSOConfig

type SSOConfig struct {
	Provider     string
	ClientID     string
	ClientSecret string //nolint:gosec // OAuth configuration schema field name
	RedirectURI  string
	AuthorizeURL string
	TokenURL     string
	UserInfoURL  string
	LogoutURL    string
	Scopes       string
	// HostedDomains holds the allow-list of Google Workspace domains.
	// Sourced from GOOGLE_OAUTH_HOSTED_DOMAIN as a comma-separated list
	HostedDomains []string
	CookieSecret  []byte
}

SSOConfig holds optional UI auth settings loaded from the environment.

func LoadSSOConfig

func LoadSSOConfig(ctx context.Context) *SSOConfig

LoadSSOConfig reads optional UI auth configuration from the environment.

type Server

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

Server is the Epoch HTTP server.

func New

func New(ctx context.Context, reg *registry.Registry, st *store.Store, addr string) *Server

New creates a new server.

func (*Server) ListenAndServe

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

ListenAndServe starts the server with initial sync and background sync.

Jump to

Keyboard shortcuts

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