Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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"`
// Prefix is the URL path prefix for the WebDAV server
Prefix string `yaml:"prefix" default:"/webdav/" mapstructure:"prefix"`
}
type File ¶
type File interface {
io.ReadSeekCloser
Write(p []byte) (n int, err error)
Readdir(count int) ([]os.FileInfo, error)
Stat() (os.FileInfo, error)
}
File provides access to a single file or directory.
type FileSystem ¶
type FileSystem interface {
Mkdir(ctx context.Context, name string, perm os.FileMode) error
OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error)
RemoveAll(ctx context.Context, name string) error
Rename(ctx context.Context, oldName, newName string) error
Stat(ctx context.Context, name string) (os.FileInfo, error)
}
FileSystem provides virtual filesystem access for WebDAV.
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 *nzbfilesystem.NzbFilesystem, tokenService *token.Service, userRepo *database.UserRepository, configGetter config.ConfigGetter, streamTracker *api.StreamTracker, ) (*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 ¶
GetHTTPHandler returns the HTTP handler for use with Fiber adaptor
func (*Handler) SyncAuthCredentials ¶
func (h *Handler) SyncAuthCredentials()
SyncAuthCredentials updates auth credentials from current config