package main import ( "fmt" "net" "os" "github.com/willscott/memphis" nfs "git.kmsign.ru/royalcat/tstor/pkg/go-nfs" "git.kmsign.ru/royalcat/tstor/pkg/go-nfs/helpers" nfshelper "git.kmsign.ru/royalcat/tstor/pkg/go-nfs/helpers" ) func main() { port := "" if len(os.Args) < 2 { fmt.Printf("Usage: osview [port]\n") return } else if len(os.Args) == 3 { port = os.Args[2] } listener, err := net.Listen("tcp", ":"+port) if err != nil { fmt.Printf("Failed to listen: %v\n", err) return } fmt.Printf("Server running at %s\n", listener.Addr()) fs := memphis.FromOS(os.Args[1]) bfs := helpers.WrapBillyFS(fs.AsBillyFS(0, 0)) handler := nfshelper.NewNullAuthHandler(bfs) cacheHelper := nfshelper.NewCachingHandler(handler, 1024) fmt.Printf("%v", nfs.Serve(listener, cacheHelper)) }