Several torrents per filesystem ()

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
Antonio Navarro Perez 2021-03-06 23:08:15 +01:00 committed by GitHub
parent ed8bd64017
commit 2a38efbb03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 46 deletions

View file

@ -19,12 +19,13 @@ type WebDAV struct {
fss []fs.Filesystem
}
func newFS(mFss map[string][]fs.Filesystem) *WebDAV {
for _, fss := range mFss {
return &WebDAV{fss: fss}
func newFS(mFss map[string]fs.Filesystem) *WebDAV {
var fss []fs.Filesystem
for _, fs := range mFss {
fss = append(fss, fs)
}
return nil
return &WebDAV{fss: fss}
}
func (wd *WebDAV) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {

View file

@ -5,7 +5,7 @@ import (
"golang.org/x/net/webdav"
)
func newHandler(fss map[string][]fs.Filesystem) *webdav.Handler {
func newHandler(fss map[string]fs.Filesystem) *webdav.Handler {
return &webdav.Handler{
Prefix: "/",
FileSystem: newFS(fss),

View file

@ -8,7 +8,7 @@ import (
"github.com/sirupsen/logrus"
)
func NewWebDAVServer(fss map[string][]fs.Filesystem, port int) error {
func NewWebDAVServer(fss map[string]fs.Filesystem, port int) error {
logrus.WithField("host", fmt.Sprintf("0.0.0.0:%d", port)).Info("starting webDAV server")
return http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", port), newHandler(fss))
}