Эх сурвалжийг харах

Added template for nfs abstraction

Toby Chui 3 жил өмнө
parent
commit
328858bf9a

+ 63 - 40
README.md

@@ -2,19 +2,39 @@
 
 This is the go implementation of ArozOS (aka ArOZ Online) Web Desktop environment,designed to run on linux, but somehow still works on Windows and Mac OS
 
+
+
+This README file is intended for developer only. If you are normal users, please refer to the README file outside of the /src folder. 
+
 ## Development Notes
 
 - Start each module with {ModuleName}Init() function, e.g. ```WiFiInit()```
-- Put your function in module (if possible) and call it in the main program
+- Put your function in mod (if possible) and call it in the main program
 - Do not change the sequence in the startup() function unless necessary
 - When in doubt, add startup flags (and use startup flag to disable experimental functions on startup)
 
+## File System Virtualization and File System Abstractions Layers
+
+The ArozOS system contains both the virtualization layer and abstraction layer. The easiest way to check if your path is under which layer is by looking at their starting dir name.
+
+| Path Structure                                | Example Path                                         | Layer                                            |
+| --------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------ |
+| {vroot_id}:/{subpath}                         | user:/Desktop/myfile.txt                             | File System Virtualization Layer (Highest Layer) |
+| fsh (*File System Handler) + subpath (string) | fsh (localfs) + /files/users/alan/Desktop/myfile.txt | File System Abstraction                          |
+| {physical_location}/{subpath}                 | /home/aroz/arozos/files/users/Desktop/myfile.txt     | Physical (Disk) Layer                            |
+
+Since ArozOS v2.000, we added File System Abstraction (fsa, or sometime as seen as fshAbs, abbr for "File System Handler underlaying File System Abstraction) to the (already complex) File System Handler (fsh) infrastruture.  There are two type of fsh that are currently supported by ArozOS File System Abstraction layer.
+
+
+
 ## ArOZ JavaScript Gateway Interface / Plugin Loader
+
 The ArOZ AJGI / AGI interface provide a JavaScript programmable interface for ArozOS users to create 
 plugin for the system. To initiate the module, you can place a "init.agi" file in the web directory of the module
 (also named the module root). See more details in the [AJGI Documentation](AJGI Documentation.md).
 
 ## Subservice Logics and Configuration
+
 To intergrate other binary based web server to the subservice interface,
 you can create a folder inside the "./subservice/your_service" where your binary
 executable should be named identically with the containing directory.
@@ -30,14 +50,16 @@ Please follow the naming convention given in the build.sh template.
 For example, the corresponding platform will search for the corresponding binary excitable filename:
 
 ```
-demo_linux_amd64	=> Linux AMD64
-demo_linux_arm		=> Linux ARMv6l / v7l
-demo_linux_arm64	=> Linux ARM64
-demo_macOS_amd64	=> MacOS AMD64 (Not tested)
+demo_linux_amd64    => Linux AMD64
+demo_linux_arm      => Linux ARMv6l / v7l
+demo_linux_arm64    => Linux ARM64
+demo_macOS_amd64    => MacOS AMD64 
 ```
 
 ### Startup Flags
+
 During the startup of the subservice, two types of parameter will be passed in. Here are the examples
+
 ```
 demo.exe -info
 demo.exe -port 12810 -rpt "http://localhost:8080/api/ajgi/interface"
@@ -49,39 +71,39 @@ as stated in the struct below.
 ```
 //Struct for storing module information
 type serviecInfo struct{
-	Name string				//Name of this module. e.g. "Audio"
-	Desc string				//Description for this module
-	Group string			//Group of the module, e.g. "system" / "media" etc
-	IconPath string			//Module icon image path e.g. "Audio/img/function_icon.png"
-	Version string			//Version of the module. Format: [0-9]*.[0-9][0-9].[0-9]
-	StartDir string 		//Default starting dir, e.g. "Audio/index.html"
-	SupportFW bool 			//Support floatWindow. If yes, floatWindow dir will be loaded
-	LaunchFWDir string 		//This link will be launched instead of 'StartDir' if fw mode
-	SupportEmb bool			//Support embedded mode
-	LaunchEmb string 		//This link will be launched instead of StartDir / Fw if a file is opened with this module
-	InitFWSize []int 		//Floatwindow init size. [0] => Width, [1] => Height
-	InitEmbSize []int		//Embedded mode init size. [0] => Width, [1] => Height
-	SupportedExt []string 	//Supported File Extensions. e.g. ".mp3", ".flac", ".wav"
+    Name string                //Name of this module. e.g. "Audio"
+    Desc string                //Description for this module
+    Group string            //Group of the module, e.g. "system" / "media" etc
+    IconPath string            //Module icon image path e.g. "Audio/img/function_icon.png"
+    Version string            //Version of the module. Format: [0-9]*.[0-9][0-9].[0-9]
+    StartDir string         //Default starting dir, e.g. "Audio/index.html"
+    SupportFW bool             //Support floatWindow. If yes, floatWindow dir will be loaded
+    LaunchFWDir string         //This link will be launched instead of 'StartDir' if fw mode
+    SupportEmb bool            //Support embedded mode
+    LaunchEmb string         //This link will be launched instead of StartDir / Fw if a file is opened with this module
+    InitFWSize []int         //Floatwindow init size. [0] => Width, [1] => Height
+    InitEmbSize []int        //Embedded mode init size. [0] => Width, [1] => Height
+    SupportedExt []string     //Supported File Extensions. e.g. ".mp3", ".flac", ".wav"
 }
 
 //Example Usage when reciving the -info flag
 infoObject := serviecInfo{
-		Name: "Demo Subservice",
-		Desc: "A simple subservice code for showing how subservice works in ArOZ Online",			
-		Group: "Development",
-		IconPath: "demo/icon.png",
-		Version: "0.0.1",
-		//You can define any path before the actualy html file. This directory (in this case demo/ ) will be the reverse proxy endpoint for this module
-		StartDir: "demo/home.html",			
-		SupportFW: true, 
-		LaunchFWDir: "demo/home.html",
-		SupportEmb: true,
-		LaunchEmb: "demo/embedded.html",
-		InitFWSize: []int{720, 480},
-		InitEmbSize: []int{720, 480},
-		SupportedExt: []string{".txt",".md"},
-	}
-	
+        Name: "Demo Subservice",
+        Desc: "A simple subservice code for showing how subservice works in ArOZ Online",            
+        Group: "Development",
+        IconPath: "demo/icon.png",
+        Version: "0.0.1",
+        //You can define any path before the actualy html file. This directory (in this case demo/ ) will be the reverse proxy endpoint for this module
+        StartDir: "demo/home.html",            
+        SupportFW: true, 
+        LaunchFWDir: "demo/home.html",
+        SupportEmb: true,
+        LaunchEmb: "demo/embedded.html",
+        InitFWSize: []int{720, 480},
+        InitEmbSize: []int{720, 480},
+        SupportedExt: []string{".txt",".md"},
+    }
+
 jsonString, _ := json.Marshal(info);
 fmt.Println(string(infoObject))
 os.Exit(0);
@@ -95,37 +117,38 @@ var port = flag.String("port", ":80", "The default listening endpoint for this s
 flag.Parse()
 err := http.ListenAndServe(*port, nil)
 if err != nil {
-	log.Fatal(err)
+    log.Fatal(err)
 }
 ```
 
-
 ### Subservice Exec Settings
+
 In default, subservice routine will create a reverse proxy with URL rewrite build in that serve your web ui launched
 from the binary executable. If you do not need a reverse proxy connection, want a custom launch script or else, you can 
 use the following setting files.
 
 ```
-.noproxy		=> Do not start a proxy to the given port
-.startscript	=> Send the launch parameter to the "start.bat" or "start.sh" file instead of the binary executable
-.disabled		=> Do not load this subservice during startup. But the user can enable it via the setting interface
+.noproxy        => Do not start a proxy to the given port
+.startscript    => Send the launch parameter to the "start.bat" or "start.sh" file instead of the binary executable
+.disabled        => Do not load this subservice during startup. But the user can enable it via the setting interface
 ```
 
 Here is an example "start.bat" used in integrating Syncthing into ArOZ Online System with ".startscript" file placed next
 to the syncthing.exe file.
+
 ```
 if not exist ".\config" mkdir ".\config"
 syncthing.exe -home=".\config" -no-browser -gui-address=127.0.0.1%2
 ```
 
 ## Systemd support
+
 To enable systemd in your host that support aroz online system, create a bash script at your aroz online root named "start.sh"
 and fill it up with your prefered startup paratmers. The most basic one is as follow:
 
 ```
 #/bin/bash
 sudo ./aroz_online_linux_amd64
-
 ```
 
 And then you can create a new file called "arozos.service" in /etc/systemd/system with the following contents (Assume your aroz online root is at /home/pi/arozos)

+ 2 - 0
go.mod

@@ -23,7 +23,9 @@ require (
 	github.com/gorilla/sessions v1.2.1
 	github.com/gorilla/websocket v1.5.0
 	github.com/grandcat/zeroconf v1.0.0
+	github.com/hashicorp/errwrap v1.1.0 // indirect
 	github.com/hirochachacha/go-smb2 v1.1.0
+	github.com/jlaffaye/ftp v0.0.0-20220829015825-b85cf1edccd4 // indirect
 	github.com/kevinburke/ssh_config v1.2.0 // indirect
 	github.com/klauspost/compress v1.15.4 // indirect
 	github.com/koron/go-ssdp v0.0.3

+ 9 - 0
go.sum

@@ -265,10 +265,14 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb
 github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
 github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
 github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
+github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
 github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
 github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
 github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
 github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
+github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
 github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
 github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
 github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
@@ -293,6 +297,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
 github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
+github.com/jlaffaye/ftp v0.0.0-20220829015825-b85cf1edccd4 h1:8bWaY08VCoFn17gezYWKLhCwAJr2Er8tUOZCvDVshos=
+github.com/jlaffaye/ftp v0.0.0-20220829015825-b85cf1edccd4/go.mod h1:hhq4G4crv+nW2qXtNYcuzLeOudG92Ps37HEKeg2e3lE=
 github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
@@ -413,6 +419,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
 github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@@ -421,6 +428,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/studio-b12/gowebdav v0.0.0-20220128162035-c7b1ff8a5e62 h1:b2nJXyPCa9HY7giGM+kYcnQ71m14JnGdQabMPmyt++8=
 github.com/studio-b12/gowebdav v0.0.0-20220128162035-c7b1ff8a5e62/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
 github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=

+ 137 - 0
mod/filesystem/abstractions/nfsfs/nfsfs.go

@@ -0,0 +1,137 @@
+package nfsfs
+
+import (
+	"io"
+	"io/fs"
+	"os"
+	"path/filepath"
+	"strings"
+	"time"
+
+	"imuslab.com/arozos/mod/filesystem/arozfs"
+)
+
+/*
+	FTPFS.go
+
+	File System Abstraciton for File Transfer Protocol (FTP)
+
+*/
+
+type NFSFileSystemAbstraction struct {
+	uuid      string
+	hierarchy string
+}
+
+func NewNFSFileSystemAbstraction(uuid string, hierarchy string, ipAndPort string, username string, password string) (NFSFileSystemAbstraction, error) {
+	return NFSFileSystemAbstraction{
+		uuid:      uuid,
+		hierarchy: hierarchy,
+	}, nil
+}
+func (l NFSFileSystemAbstraction) Chmod(filename string, mode os.FileMode) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Chown(filename string, uid int, gid int) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Chtimes(filename string, atime time.Time, mtime time.Time) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Create(filename string) (arozfs.File, error) {
+	return nil, arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Mkdir(filename string, mode os.FileMode) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) MkdirAll(filename string, mode os.FileMode) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Name() string {
+	return ""
+}
+func (l NFSFileSystemAbstraction) Open(filename string) (arozfs.File, error) {
+	return nil, arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) OpenFile(filename string, flag int, perm os.FileMode) (arozfs.File, error) {
+	return nil, arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Remove(filename string) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) RemoveAll(path string) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Rename(oldname, newname string) error {
+	return arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Stat(filename string) (os.FileInfo, error) {
+	return nil, arozfs.ErrNullOperation
+}
+func (l NFSFileSystemAbstraction) Close() error {
+	return nil
+}
+
+/*
+	Abstraction Utilities
+*/
+
+func (a NFSFileSystemAbstraction) VirtualPathToRealPath(subpath string, username string) (string, error) {
+	return arozfs.GenericVirtualPathToRealPathTranslator(a.uuid, a.hierarchy, subpath, username)
+}
+
+func (a NFSFileSystemAbstraction) RealPathToVirtualPath(fullpath string, username string) (string, error) {
+	return arozfs.GenericRealPathToVirtualPathTranslator(a.uuid, a.hierarchy, fullpath, username)
+}
+
+func (a NFSFileSystemAbstraction) FileExists(realpath string) bool {
+	return false
+}
+
+func (a NFSFileSystemAbstraction) IsDir(realpath string) bool {
+	return false
+}
+
+func (a NFSFileSystemAbstraction) Glob(realpathWildcard string) ([]string, error) {
+	return []string{}, arozfs.ErrNullOperation
+}
+
+func (a NFSFileSystemAbstraction) GetFileSize(realpath string) int64 {
+	return 0
+}
+
+func (a NFSFileSystemAbstraction) GetModTime(realpath string) (int64, error) {
+	return 0, arozfs.ErrOperationNotSupported
+}
+
+func (a NFSFileSystemAbstraction) WriteFile(filename string, content []byte, mode os.FileMode) error {
+	return arozfs.ErrNullOperation
+}
+func (a NFSFileSystemAbstraction) ReadFile(filename string) ([]byte, error) {
+	return []byte(""), arozfs.ErrOperationNotSupported
+}
+func (a NFSFileSystemAbstraction) ReadDir(filename string) ([]fs.DirEntry, error) {
+	return []fs.DirEntry{}, arozfs.ErrOperationNotSupported
+}
+func (a NFSFileSystemAbstraction) WriteStream(filename string, stream io.Reader, mode os.FileMode) error {
+	return arozfs.ErrNullOperation
+}
+func (a NFSFileSystemAbstraction) ReadStream(filename string) (io.ReadCloser, error) {
+
+	return nil, arozfs.ErrOperationNotSupported
+}
+
+func (a NFSFileSystemAbstraction) Walk(root string, walkFn filepath.WalkFunc) error {
+	return arozfs.ErrOperationNotSupported
+}
+
+//Utilities
+func filterFilepath(rawpath string) string {
+	rawpath = arozfs.ToSlash(filepath.Clean(strings.TrimSpace(rawpath)))
+	if strings.HasPrefix(rawpath, "./") {
+		return rawpath[1:]
+	} else if rawpath == "." || rawpath == "" {
+		return "/"
+	}
+	return rawpath
+}

+ 55 - 0
mod/filesystem/arozfs/arozfs.go

@@ -10,6 +10,7 @@ import (
 	"errors"
 	"io"
 	"io/fs"
+	"path/filepath"
 	"strings"
 )
 
@@ -88,6 +89,60 @@ func GetSupportedFileSystemTypes() []string {
 	return []string{"ext4", "ext2", "ext3", "fat", "vfat", "ntfs", "webdav", "ftp", "smb"}
 }
 
+/*
+	Standard file system abstraction translate function
+*/
+
+//Generic virtual path to real path translator
+func GenericVirtualPathToRealPathTranslator(uuid string, hierarchy string, subpath string, username string) (string, error) {
+	subpath = ToSlash(filepath.Clean(subpath))
+	subpath = ToSlash(filepath.Clean(strings.TrimSpace(subpath)))
+	if strings.HasPrefix(subpath, "./") {
+		subpath = subpath[1:]
+	}
+
+	if subpath == "." || subpath == "" {
+		subpath = "/"
+	}
+	if strings.HasPrefix(subpath, uuid+":") {
+		//This is full virtual path. Trim the uuid and correct the subpath
+		subpath = strings.TrimPrefix(subpath, uuid+":")
+	}
+
+	if hierarchy == "user" {
+		return filepath.ToSlash(filepath.Clean(filepath.Join("users", username, subpath))), nil
+	} else if hierarchy == "public" {
+		return filepath.ToSlash(filepath.Clean(subpath)), nil
+	}
+	return "", errors.New("unsupported filesystem hierarchy")
+}
+
+//Generic real path to virtual path translator
+func GenericRealPathToVirtualPathTranslator(uuid string, hierarchy string, rpath string, username string) (string, error) {
+	rpath = ToSlash(filepath.Clean(strings.TrimSpace(rpath)))
+	if strings.HasPrefix(rpath, "./") {
+		rpath = rpath[1:]
+	}
+
+	if rpath == "." || rpath == "" {
+		rpath = "/"
+	}
+
+	if hierarchy == "user" && strings.HasPrefix(rpath, "/users/"+username) {
+		rpath = strings.TrimPrefix(rpath, "/users/"+username)
+	}
+
+	rpath = filepath.ToSlash(rpath)
+	if !strings.HasPrefix(rpath, "/") {
+		rpath = "/" + rpath
+	}
+	return uuid + ":" + rpath, nil
+}
+
+/*
+	OS Independent filepath functions
+*/
+
 func ToSlash(filename string) string {
 	return strings.ReplaceAll(filename, "\\", "/")
 }

+ 21 - 0
mod/filesystem/filesystem.go

@@ -24,6 +24,7 @@ import (
 
 	db "imuslab.com/arozos/mod/database"
 	"imuslab.com/arozos/mod/filesystem/abstractions/localfs"
+	"imuslab.com/arozos/mod/filesystem/abstractions/nfsfs"
 	"imuslab.com/arozos/mod/filesystem/abstractions/smbfs"
 	"imuslab.com/arozos/mod/filesystem/abstractions/webdavfs"
 	"imuslab.com/arozos/mod/filesystem/arozfs"
@@ -226,6 +227,26 @@ func NewFileSystemHandler(option FileSystemOption) (*FileSystemHandler, error) {
 			Filesystem:            fstype,
 			Closed:                false,
 		}, nil
+	} else if fstype == "nfs" {
+		ftpfs, err := nfsfs.NewNFSFileSystemAbstraction(option.Uuid, option.Hierarchy, option.Path, option.Username, option.Password)
+		if err != nil {
+			return nil, err
+		}
+		return &FileSystemHandler{
+			Name:                  option.Name,
+			UUID:                  option.Uuid,
+			Path:                  option.Path,
+			ReadOnly:              option.Access == arozfs.FsReadOnly,
+			RequireBuffer:         true,
+			Hierarchy:             option.Hierarchy,
+			HierarchyConfig:       nil,
+			InitiationTime:        time.Now().Unix(),
+			FilesystemDatabase:    nil,
+			FileSystemAbstraction: ftpfs,
+			Filesystem:            fstype,
+			Closed:                false,
+		}, nil
+
 	} else if option.Filesystem == "virtual" {
 		//Virtual filesystem, deprecated
 		log.Println("[File System] Deprecated file system type: Virtual")

+ 1 - 0
update-licenses.bat

@@ -0,0 +1 @@
+go-licenses report imuslab.com/arozos > web\SystemAO\info\gomod-license.csv

+ 149 - 0
web/SystemAO/info/gomod-license.csv

@@ -0,0 +1,149 @@
+cloud.google.com/go/compute/metadata,https://github.com/googleapis/google-cloud-go/blob/compute/v1.6.1/compute/LICENSE,Apache-2.0
+github.com/Microsoft/go-winio,https://github.com/Microsoft/go-winio/blob/v0.5.2/LICENSE,MIT
+github.com/ProtonMail/go-crypto,https://github.com/ProtonMail/go-crypto/blob/902f79d34c9f/LICENSE,BSD-3-Clause
+github.com/andybalholm/brotli,https://github.com/andybalholm/brotli/blob/v1.0.4/LICENSE,MIT
+github.com/boltdb/bolt,https://github.com/boltdb/bolt/blob/v1.3.1/LICENSE,MIT
+github.com/cenkalti/backoff,https://github.com/cenkalti/backoff/blob/v2.2.1/LICENSE,MIT
+github.com/dhowden/tag,https://github.com/dhowden/tag/blob/d52dcb253c63/LICENSE,BSD-2-Clause
+github.com/disintegration/imaging,https://github.com/disintegration/imaging/blob/v1.6.2/LICENSE,MIT
+github.com/dsnet/compress,https://github.com/dsnet/compress/blob/f66993602bf5/LICENSE.md,BSD-3-Clause
+github.com/emirpasic/gods,https://github.com/emirpasic/gods/blob/v1.18.1/LICENSE,BSD-2-Clause
+github.com/fclairamb/ftpserverlib,https://github.com/fclairamb/ftpserverlib/blob/v0.18.0/license.txt,MIT
+github.com/fclairamb/go-log,Unknown,Unknown
+github.com/fclairamb/go-log/noop,Unknown,Unknown
+github.com/fogleman/fauxgl,https://github.com/fogleman/fauxgl/blob/27cddc103802/LICENSE.md,MIT
+github.com/fogleman/simplify,https://github.com/fogleman/simplify/blob/d32f302d5046/LICENSE.md,MIT
+github.com/gabriel-vasile/mimetype,https://github.com/gabriel-vasile/mimetype/blob/v1.4.0/LICENSE,MIT
+github.com/geoffgarside/ber,https://github.com/geoffgarside/ber/blob/v1.1.0/LICENSE,BSD-3-Clause
+github.com/go-git/gcfg,https://github.com/go-git/gcfg/blob/v1.5.0/LICENSE,BSD-3-Clause
+github.com/go-git/go-billy/v5,https://github.com/go-git/go-billy/blob/v5.3.1/LICENSE,Apache-2.0
+github.com/go-git/go-git/v5,https://github.com/go-git/go-git/blob/v5.4.2/LICENSE,Apache-2.0
+github.com/go-ldap/ldap,https://github.com/go-ldap/ldap/blob/v3.0.3/LICENSE,MIT
+github.com/golang/freetype,Unknown,Unknown
+github.com/golang/freetype/raster,Unknown,Unknown
+github.com/golang/freetype/truetype,Unknown,Unknown
+github.com/golang/snappy,https://github.com/golang/snappy/blob/v0.0.4/LICENSE,BSD-3-Clause
+github.com/gorilla/securecookie,https://github.com/gorilla/securecookie/blob/v1.1.1/LICENSE,BSD-3-Clause
+github.com/gorilla/sessions,https://github.com/gorilla/sessions/blob/v1.2.1/LICENSE,BSD-3-Clause
+github.com/gorilla/websocket,https://github.com/gorilla/websocket/blob/v1.5.0/LICENSE,BSD-2-Clause
+github.com/grandcat/zeroconf,https://github.com/grandcat/zeroconf/blob/v1.0.0/LICENSE,MIT
+github.com/hirochachacha/go-smb2,https://github.com/hirochachacha/go-smb2/blob/v1.1.0/LICENSE,BSD-2-Clause
+github.com/imdario/mergo,https://github.com/imdario/mergo/blob/v0.3.12/LICENSE,BSD-3-Clause
+github.com/jbenet/go-context/io,https://github.com/jbenet/go-context/blob/d14ea06fba99/LICENSE,MIT
+github.com/kevinburke/ssh_config,https://github.com/kevinburke/ssh_config/blob/v1.2.0/LICENSE,MIT
+github.com/klauspost/compress,https://github.com/klauspost/compress/blob/v1.15.4/LICENSE,Apache-2.0
+github.com/klauspost/compress/internal/snapref,https://github.com/klauspost/compress/blob/v1.15.4/internal\snapref\LICENSE,BSD-3-Clause
+github.com/klauspost/compress/zstd/internal/xxhash,https://github.com/klauspost/compress/blob/v1.15.4/zstd\internal\xxhash\LICENSE.txt,MIT
+github.com/klauspost/pgzip,https://github.com/klauspost/pgzip/blob/v1.2.5/LICENSE,MIT
+github.com/koron/go-ssdp,https://github.com/koron/go-ssdp/blob/v0.0.3/LICENSE,MIT
+github.com/mholt/archiver/v3,https://github.com/mholt/archiver/blob/v3.5.1/LICENSE,MIT
+github.com/miekg/dns,https://github.com/miekg/dns/blob/v1.1.49/LICENSE,BSD-3-Clause
+github.com/mitchellh/go-homedir,https://github.com/mitchellh/go-homedir/blob/v1.1.0/LICENSE,MIT
+github.com/nfnt/resize,https://github.com/nfnt/resize/blob/83c6a9932646/LICENSE,ISC
+github.com/nwaples/rardecode,https://github.com/nwaples/rardecode/blob/v1.1.3/LICENSE,BSD-2-Clause
+github.com/oliamb/cutter,https://github.com/oliamb/cutter/blob/v0.2.2/LICENSE,MIT
+github.com/oov/psd,https://github.com/oov/psd/blob/5db5eafcecbb/LICENSE,MIT
+github.com/pierrec/lz4/v4,https://github.com/pierrec/lz4/blob/v4.1.14/LICENSE,BSD-3-Clause
+github.com/robertkrimen/otto,https://github.com/robertkrimen/otto/blob/b87d35c0b86f/LICENSE,MIT
+github.com/satori/go.uuid,https://github.com/satori/go.uuid/blob/v1.2.0/LICENSE,MIT
+github.com/sergi/go-diff/diffmatchpatch,https://github.com/sergi/go-diff/blob/v1.2.0/LICENSE,MIT
+github.com/spf13/afero,https://github.com/spf13/afero/blob/v1.8.2/LICENSE.txt,Apache-2.0
+github.com/studio-b12/gowebdav,https://github.com/studio-b12/gowebdav/blob/c7b1ff8a5e62/LICENSE,BSD-3-Clause
+github.com/tidwall/pretty,https://github.com/tidwall/pretty/blob/v1.2.0/LICENSE,MIT
+github.com/ulikunitz/xz,https://github.com/ulikunitz/xz/blob/v0.5.10/LICENSE,BSD-3-Clause
+github.com/valyala/bytebufferpool,https://github.com/valyala/bytebufferpool/blob/v1.0.0/LICENSE,MIT
+github.com/valyala/fasttemplate,https://github.com/valyala/fasttemplate/blob/v1.2.1/LICENSE,MIT
+github.com/xanzy/ssh-agent,https://github.com/xanzy/ssh-agent/blob/v0.3.1/LICENSE,Apache-2.0
+github.com/xi2/xz,Unknown,Unknown
+gitlab.com/NebulousLabs/fastrand,https://gitlab.com/NebulousLabs/fastrand/blob/603482d69e40/LICENSE,MIT
+gitlab.com/NebulousLabs/go-upnp,https://gitlab.com/NebulousLabs/go-upnp/blob/11da932010b6/LICENSE,MIT
+gitlab.com/NebulousLabs/go-upnp/goupnp,https://gitlab.com/NebulousLabs/go-upnp/blob/11da932010b6/goupnp\LICENSE,BSD-2-Clause
+golang.org/x/crypto,https://cs.opensource.google/go/x/crypto/+/630584e8:LICENSE,BSD-3-Clause
+golang.org/x/image,https://cs.opensource.google/go/x/image/+/41969df7:LICENSE,BSD-3-Clause
+golang.org/x/net,https://cs.opensource.google/go/x/net/+/95641704:LICENSE,BSD-3-Clause
+golang.org/x/oauth2,https://cs.opensource.google/go/x/oauth2/+/97805856:LICENSE,BSD-3-Clause
+golang.org/x/sync/syncmap,https://cs.opensource.google/go/x/sync/+/0976fa68:LICENSE,BSD-3-Clause
+golang.org/x/sys,https://cs.opensource.google/go/x/sys/+/45d2b455:LICENSE,BSD-3-Clause
+golang.org/x/text,https://cs.opensource.google/go/x/text/+/v0.3.7:LICENSE,BSD-3-Clause
+gopkg.in/asn1-ber.v1,https://github.com/go-asn1-ber/asn1-ber/blob/f715ec2f112d/LICENSE,MIT
+gopkg.in/sourcemap.v1,https://github.com/go-sourcemap/sourcemap/blob/v1.0.5/LICENSE,BSD-2-Clause
+gopkg.in/warnings.v0,https://github.com/go-warnings/warnings/blob/v0.1.2/LICENSE,BSD-2-Clause
+imuslab.com/arozos,Unknown,Unknown
+imuslab.com/arozos/mod/agi,Unknown,Unknown
+imuslab.com/arozos/mod/apt,Unknown,Unknown
+imuslab.com/arozos/mod/auth,Unknown,Unknown
+imuslab.com/arozos/mod/auth/accesscontrol,Unknown,Unknown
+imuslab.com/arozos/mod/auth/accesscontrol/blacklist,Unknown,Unknown
+imuslab.com/arozos/mod/auth/accesscontrol/whitelist,Unknown,Unknown
+imuslab.com/arozos/mod/auth/authlogger,Unknown,Unknown
+imuslab.com/arozos/mod/auth/autologin,Unknown,Unknown
+imuslab.com/arozos/mod/auth/explogin,Unknown,Unknown
+imuslab.com/arozos/mod/auth/ldap,Unknown,Unknown
+imuslab.com/arozos/mod/auth/ldap/ldapreader,Unknown,Unknown
+imuslab.com/arozos/mod/auth/oauth2,Unknown,Unknown
+imuslab.com/arozos/mod/auth/oauth2/syncdb,Unknown,Unknown
+imuslab.com/arozos/mod/auth/register,Unknown,Unknown
+imuslab.com/arozos/mod/cluster/wakeonlan,Unknown,Unknown
+imuslab.com/arozos/mod/common,Unknown,Unknown
+imuslab.com/arozos/mod/compatibility,Unknown,Unknown
+imuslab.com/arozos/mod/console,Unknown,Unknown
+imuslab.com/arozos/mod/database,Unknown,Unknown
+imuslab.com/arozos/mod/disk/diskcapacity,Unknown,Unknown
+imuslab.com/arozos/mod/disk/diskcapacity/dftool,Unknown,Unknown
+imuslab.com/arozos/mod/disk/diskmg,Unknown,Unknown
+imuslab.com/arozos/mod/disk/diskspace,Unknown,Unknown
+imuslab.com/arozos/mod/disk/smart,Unknown,Unknown
+imuslab.com/arozos/mod/disk/sortfile,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/abstractions/localfs,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/abstractions/smbfs,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/abstractions/webdavfs,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/arozfs,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/fspermission,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/fssort,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/fuzzy,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/hidden,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/localversion,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/metadata,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/renderer,Unknown,Unknown
+imuslab.com/arozos/mod/filesystem/shortcut,Unknown,Unknown
+imuslab.com/arozos/mod/info/hardwareinfo,Unknown,Unknown
+imuslab.com/arozos/mod/info/logger,Unknown,Unknown
+imuslab.com/arozos/mod/info/usageinfo,Unknown,Unknown
+imuslab.com/arozos/mod/iot,Unknown,Unknown
+imuslab.com/arozos/mod/iot/hds,Unknown,Unknown
+imuslab.com/arozos/mod/iot/hdsv2,Unknown,Unknown
+imuslab.com/arozos/mod/iot/sonoff_s2x,Unknown,Unknown
+imuslab.com/arozos/mod/modules,Unknown,Unknown
+imuslab.com/arozos/mod/network,Unknown,Unknown
+imuslab.com/arozos/mod/network/gzipmiddleware,Unknown,Unknown
+imuslab.com/arozos/mod/network/mdns,Unknown,Unknown
+imuslab.com/arozos/mod/network/neighbour,Unknown,Unknown
+imuslab.com/arozos/mod/network/netstat,Unknown,Unknown
+imuslab.com/arozos/mod/network/reverseproxy,Unknown,MIT
+imuslab.com/arozos/mod/network/ssdp,Unknown,Unknown
+imuslab.com/arozos/mod/network/upnp,Unknown,Unknown
+imuslab.com/arozos/mod/network/webdav,Unknown,BSD-3-Clause
+imuslab.com/arozos/mod/network/websocket,Unknown,Unknown
+imuslab.com/arozos/mod/network/websocketproxy,Unknown,MIT
+imuslab.com/arozos/mod/network/wifi,Unknown,Unknown
+imuslab.com/arozos/mod/neuralnet,Unknown,Unknown
+imuslab.com/arozos/mod/notification,Unknown,Unknown
+imuslab.com/arozos/mod/notification/agents/smtpn,Unknown,Unknown
+imuslab.com/arozos/mod/permission,Unknown,Unknown
+imuslab.com/arozos/mod/prouter,Unknown,Unknown
+imuslab.com/arozos/mod/quota,Unknown,Unknown
+imuslab.com/arozos/mod/security/csrf,Unknown,Unknown
+imuslab.com/arozos/mod/share,Unknown,Unknown
+imuslab.com/arozos/mod/share/shareEntry,Unknown,Unknown
+imuslab.com/arozos/mod/storage,Unknown,Unknown
+imuslab.com/arozos/mod/storage/bridge,Unknown,Unknown
+imuslab.com/arozos/mod/storage/du,Unknown,Unknown
+imuslab.com/arozos/mod/storage/ftp,Unknown,Unknown
+imuslab.com/arozos/mod/storage/webdav,Unknown,Unknown
+imuslab.com/arozos/mod/subservice,Unknown,Unknown
+imuslab.com/arozos/mod/time/nightly,Unknown,Unknown
+imuslab.com/arozos/mod/time/scheduler,Unknown,Unknown
+imuslab.com/arozos/mod/updates,Unknown,Unknown
+imuslab.com/arozos/mod/user,Unknown,Unknown
+imuslab.com/arozos/mod/www,Unknown,Unknown