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 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) 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
Source Files
¶
Click to show internal directories.
Click to hide internal directories.