server

package
v0.0.0-...-a907d41 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server contains the server and the HTTP endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadHandler

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

func NewDownloadHandler

func NewDownloadHandler(diskPath, servePath string, logger *zap.Logger) *DownloadHandler

NewDownloadHandler creates a new DownloadHandler

func (DownloadHandler) ServeHTTP

func (dh DownloadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP for the DownloadHandler, mostly checks if the file exists, and then routes it based on method.

type FileInfoHandler

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

func NewFileInfoHandler

func NewFileInfoHandler(registry *fs.Registry, logger *zap.Logger) *FileInfoHandler

func (*FileInfoHandler) ServeHTTP

func (h *FileInfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP for the FileInfoHandler, which simply serves all the files in the cache.

type Server

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

func New

func New(host string, port int, logger *zap.Logger) *Server

New returns a new server.

func (Server) Handle

func (s Server) Handle(path string, handler http.Handler)

Handle is just a simple wrapper around http.Handle for now, will add more here later.

func (Server) Serve

func (s Server) Serve() error

Serve creates a new server.

Jump to

Keyboard shortcuts

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