Documentation ¶
Index ¶
- func Serve(addr string, options ...Option) error
- func ServeDir(addr, dir string, options ...Option) error
- func ServeFS(addr string, fileSystem fs.FS, options ...Option) error
- type Config
- type DiscardLogger
- type Option
- func WithAcceptByteRange() Option
- func WithCacheDuration(duration time.Duration) Option
- func WithCompress() Option
- func WithCompressBrotli() Option
- func WithDir(dir string) Option
- func WithFS(fileSystem fs.FS) Option
- func WithGenerateIndexPages() Option
- func WithGracefulShutdown() Option
- func WithIndexNames(names ...string) Option
- func WithPathNotFound(handler fasthttp.RequestHandler) Option
- func WithPathRewrite(rewrite fasthttp.PathRewriteFunc) Option
- func WithPathRewriteToRoot() Option
- func WithServer(server *fasthttp.Server) Option
- func WithSubDir(dir string) Option
- func WithTempDir(dir string) Option
- func WithTempDirPattern(pattern string) Option
- func WithTempFilesPerm(perm os.FileMode) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Addr string `validate:"hostname_port"` Server *fasthttp.Server `validate:"required"` GracefulShutdown bool `validate:"-"` SubDir string `validate:"-"` Dir string `validate:"omitempty,dir"` FileSystem fs.FS `validate:"required_without=Dir"` TempDir string `validate:"omitempty,required_with=FileSystem,dir"` TempDirPattern string `validate:"-"` TempFilesPerm os.FileMode `validate:"required_with=FileSystem"` IndexNames []string `validate:"-"` GenerateIndexPages bool `validate:"-"` Compress bool `validate:"-"` CompressBrotli bool `validate:"omitempty,excluded_unless=Compress false"` AcceptByteRange bool `validate:"-"` PathRewrite fasthttp.PathRewriteFunc `validate:"-"` PathRewriteToRoot bool `validate:"-"` PathNotFound fasthttp.RequestHandler `validate:"-"` CacheDuration time.Duration `validate:"gte=0"` }
type DiscardLogger ¶
type DiscardLogger struct{}
func (DiscardLogger) Printf ¶
func (d DiscardLogger) Printf(format string, args ...any)
type Option ¶
func WithAcceptByteRange ¶
func WithAcceptByteRange() Option
func WithCacheDuration ¶
func WithCompress ¶
func WithCompress() Option
func WithCompressBrotli ¶
func WithCompressBrotli() Option
func WithGenerateIndexPages ¶
func WithGenerateIndexPages() Option
func WithGracefulShutdown ¶
func WithGracefulShutdown() Option
func WithIndexNames ¶
func WithPathNotFound ¶
func WithPathNotFound(handler fasthttp.RequestHandler) Option
func WithPathRewrite ¶
func WithPathRewrite(rewrite fasthttp.PathRewriteFunc) Option
func WithPathRewriteToRoot ¶
func WithPathRewriteToRoot() Option
func WithServer ¶
func WithSubDir ¶
func WithTempDir ¶
func WithTempDirPattern ¶
func WithTempFilesPerm ¶
Click to show internal directories.
Click to hide internal directories.