app

package
v0.0.0-...-cb4786f Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(cnf conf.Log, verbose bool)

func Run

func Run(conf conf.Conf)

Types

type Args

type Args struct {
	Host     string `arg:"-H,--host" help:"host address"`
	Port     int    `arg:"-p,--port" help:"port"`
	Username string `arg:"-u,--user" help:"username"`
	Verbose  bool   `arg:"-v,--verbose" help:"verbose output"`
	Config   string `arg:"-c,--config" help:"config file"`
}

type AuthService

type AuthService interface {
	IsEnabled() bool
	Authenticate(username, password string) error
	GetAuthorizedSubDir(username string) (string, error)
	GetPathPrefix(username string) (string, error)
	GetSpeedLimit(username string) (uint64, error)
}

type StaticServer

type StaticServer struct {
	AuthService AuthService
	Host        string
	Port        int
	Path        string
	FsDir       string
	TlsConf     conf.SSL
	Middlewares []func(http.HandlerFunc) http.HandlerFunc
}

func NewStaticServer

func NewStaticServer(authService AuthService, serverConf conf.Server, tlsConf conf.SSL) *StaticServer

func (*StaticServer) AddMiddleware

func (s *StaticServer) AddMiddleware(middleware func(http.HandlerFunc) http.HandlerFunc)

func (*StaticServer) ApplyUserSpeedLimitMiddleware

func (s *StaticServer) ApplyUserSpeedLimitMiddleware(username string, h http.Handler) http.Handler

func (*StaticServer) Listen

func (s *StaticServer) Listen()

Jump to

Keyboard shortcuts

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