Clean segregated file share backends
This commit is contained in:
parent
cbce4f1dfc
commit
40aa08c86c
6 changed files with 320 additions and 0 deletions
19
share/backend.go
Normal file
19
share/backend.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package share
|
||||
|
||||
import "context"
|
||||
|
||||
type NewBackendFunc func(uc *UserConfiguration) (Backend, *VMShareOptions, error)
|
||||
|
||||
type Backend interface {
|
||||
Apply(ctx context.Context, sharePWD string, vc *VMShareContext) (string, error)
|
||||
}
|
||||
|
||||
var backends = map[string]NewBackendFunc{
|
||||
"ftp": NewFTPBackend,
|
||||
"smb": NewSMBBackend,
|
||||
}
|
||||
|
||||
// Will return nil if no backend is found.
|
||||
func GetBackend(id string) NewBackendFunc {
|
||||
return backends[id]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue