webdav

package
v0.0.1-alpha4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCredentials

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

AuthCredentials holds the current WebDAV authentication credentials

func NewAuthCredentials

func NewAuthCredentials(username, password string) *AuthCredentials

NewAuthCredentials creates new authentication credentials

func (*AuthCredentials) GetCredentials

func (ac *AuthCredentials) GetCredentials() (string, string)

GetCredentials returns the current credentials (thread-safe)

func (*AuthCredentials) UpdateCredentials

func (ac *AuthCredentials) UpdateCredentials(username, password string)

UpdateCredentials updates the credentials (thread-safe)

type AuthUpdater

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

AuthUpdater provides methods to update WebDAV authentication

func NewAuthUpdater

func NewAuthUpdater() *AuthUpdater

NewAuthUpdater creates a new WebDAV auth updater

func (*AuthUpdater) SetAuthCredentials

func (u *AuthUpdater) SetAuthCredentials(credentials *AuthCredentials)

SetAuthCredentials sets the auth credentials reference for dynamic updates

func (*AuthUpdater) UpdateAuth

func (u *AuthUpdater) UpdateAuth(username, password string) error

UpdateAuth updates WebDAV authentication credentials

type Config

type Config struct {
	// Port is the port where the webdav server will be listening
	Port int `yaml:"port" default:"8080" mapstructure:"port"`
	// User is the user to access the webdav server
	User string `yaml:"username" default:"usenet" json:"-" mapstructure:"username"`
	// Pass is the password to access the webdav server
	Pass string `yaml:"password" default:"usenet" json:"-" mapstructure:"password"`
	// Debug enables debug mode and exposes profiler endpoints
	Debug bool `yaml:"debug" default:"false" mapstructure:"debug"`
	// Prefix is the URL path prefix for the WebDAV server
	Prefix string `yaml:"prefix" default:"/webdav/" mapstructure:"prefix"`
}

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
	Err        error
}

HTTPError represents an HTTP error with a specific status code

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Unwrap

func (e *HTTPError) Unwrap() error

type Handler

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

Handler provides WebDAV functionality as an HTTP handler

func NewHandler

func NewHandler(
	config *Config,
	fs afero.Fs,
	tokenService *token.Service,
	userRepo *database.UserRepository,
	configGetter config.ConfigGetter,
) (*Handler, error)

NewHandler creates a new WebDAV handler that can be used with Fiber adaptor

func (*Handler) GetAuthCredentials

func (h *Handler) GetAuthCredentials() *AuthCredentials

GetAuthCredentials returns the auth credentials for dynamic updates

func (*Handler) GetHTTPHandler

func (h *Handler) GetHTTPHandler() http.Handler

GetHTTPHandler returns the HTTP handler for use with Fiber adaptor

func (*Handler) SyncAuthCredentials

func (h *Handler) SyncAuthCredentials()

SyncAuthCredentials updates auth credentials from current config

Directories

Path Synopsis
xml

Jump to

Keyboard shortcuts

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