server

package
v0.0.0-...-6682903 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidXForwardedFor = errors.New("Failed to parse IP from X-Forwarded-For header")

ErrInvalidXForwardedFor occurs if the X-Forwarded-For header is trusted but invalid

Functions

This section is empty.

Types

type Config

type Config struct {
	Server struct {
		ListenAddress             string
		BasePath                  string
		CorsOrigins               []string
		TrustedReverseProxyRanges []ipnet
	}
	Storage struct {
		Path              string
		ShardLayers       int
		MaximumUploadSize datasize.ByteSize
	}
	Database struct {
		Type string
		Path string
	}
	Expiration struct {
		MaxAge           duration
		IdentifiedMaxAge duration
		CheckInterval    duration
	}
	JwtSecretsByIssuer map[string]string
	Loggers            []LoggerConfig
}

func NewConfig

func NewConfig() *Config

func (*Config) DoPostLoadLogging

func (cfg *Config) DoPostLoadLogging(log *zerolog.Logger, configPath string, md toml.MetaData)

func (*Config) Load

func (cfg *Config) Load(log *zerolog.Logger, configPath string) (toml.MetaData, error)

type LoggerConfig

type LoggerConfig struct {
	Level  logLevel
	Format logFormat
	Output logOutput
}

type ReplaceableHandler

type ReplaceableHandler struct {
	Handler http.Handler
}

func (*ReplaceableHandler) ServeHTTP

func (m *ReplaceableHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

type RunContext

type RunContext struct {
	ShutdownPromise sync.WaitGroup
	// contains filtered or unexported fields
}

func NewRunContext

func NewRunContext(parentRouter *http.ServeMux, configPath string) *RunContext

func (*RunContext) Run

func (runCtx *RunContext) Run()

type UnknownIssuerError

type UnknownIssuerError struct {
	Issuer string
}

UnknownIssuerError occurs when a file creation request includes an EXTJWT with an issuer that is not present in the config

func (UnknownIssuerError) Error

func (e UnknownIssuerError) Error() string

type UploadServer

type UploadServer struct {
	DBConn *db.DatabaseConnection
	Router *gin.Engine
	// contains filtered or unexported fields
}

UploadServer is a simple configurable service for file sharing. Compatible with TUS upload clients.

func (*UploadServer) GetStartedChan

func (serv *UploadServer) GetStartedChan() chan struct{}

GetStartedChan returns a channel that will close when the server startup is complete

func (*UploadServer) Run

func (serv *UploadServer) Run(replaceableHandler *ReplaceableHandler) error

Run starts the UploadServer

func (*UploadServer) Shutdown

func (serv *UploadServer) Shutdown()

Shutdown gracefully terminates the UploadServer instance. The HTTP listen socket will close immediately, causing the .Run() call to return. The call to .Shutdown() will block until all outstanding requests have been served and other resources like database connections and timers have been closed and stopped.

Jump to

Keyboard shortcuts

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