Help us shape the future of Go! Take the 2026 Go Developer Survey

handler

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package handler provides HTTP request handlers for the gofs file server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebDAVAdapter added in v0.2.0

func NewWebDAVAdapter(fs internal.FileSystem) webdav.FileSystem

NewWebDAVAdapter creates a new WebDAV file system adapter

Types

type AdvancedFile added in v0.1.5

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

func NewAdvancedFile added in v0.1.5

func NewAdvancedFile(fs internal.FileSystem, cfg *config.Config) *AdvancedFile

func (*AdvancedFile) ServeHTTP added in v0.1.5

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

type DirectoryResponse added in v0.1.5

type DirectoryResponse struct {
	Path  string         `json:"path"`
	Files []FileItemJSON `json:"files"`
	Count int            `json:"count"`
}

type File

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

File implements HTTP request handling for file system operations.

func NewFile

func NewFile(fs internal.FileSystem, cfg *config.Config, logger *slog.Logger) *File

NewFile creates a new file handler with the given file system and configuration.

func (*File) ServeHTTP

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

ServeHTTP handles incoming HTTP requests for file operations. It only supports GET requests and returns Method Not Allowed for others.

type FileItemJSON added in v0.1.5

type FileItemJSON struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	IsDir   bool      `json:"isDir"`
	ModTime time.Time `json:"modTime"`
}

type FolderResponse added in v0.1.5

type FolderResponse struct {
	Success bool   `json:"success"`
	Folder  string `json:"folder"`
}

type Middleware added in v0.1.5

type Middleware func(http.Handler) http.Handler

type MountHandler added in v0.2.0

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

MountHandler represents a single directory mount

type MultiDir added in v0.2.0

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

MultiDir handles multiple directory mounts with thread-safe operations

func NewMultiDir added in v0.2.0

func NewMultiDir(dirs []config.DirMount, cfg *config.Config, logger *slog.Logger) *MultiDir

NewMultiDir creates a new multi-directory handler with optimized path matching

func (*MultiDir) ServeHTTP added in v0.2.0

func (m *MultiDir) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler with panic recovery

type RequestContext added in v0.1.5

type RequestContext struct {
	StartTime  time.Time
	RequestID  string
	UserAgent  string
	RemoteAddr string
	Path       string
}

type UploadResponse added in v0.1.5

type UploadResponse struct {
	Success bool   `json:"success"`
	File    string `json:"file"`
	Size    int64  `json:"size"`
}

type WebDAV added in v0.2.0

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

WebDAV handles WebDAV protocol requests for read-only file access

func NewWebDAV added in v0.2.0

func NewWebDAV(fs internal.FileSystem, cfg *config.Config, logger *slog.Logger) *WebDAV

NewWebDAV creates a new WebDAV handler

func (*WebDAV) ServeHTTP added in v0.2.0

func (w *WebDAV) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface

Directories

Path Synopsis
themes
Package themes provides the advanced theme for GoFS
Package themes provides the advanced theme for GoFS

Jump to

Keyboard shortcuts

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