Several torrents per filesystem (#38)
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
parent
ed8bd64017
commit
2a38efbb03
8 changed files with 43 additions and 46 deletions
webdav
|
@ -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) {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue