| 1 | |
| 2 | new file mode 100644 |
| 3 | |
| 4 | |
| 5 | @@ -0,0 +1,15 @@ |
| 6 | +package reversesshfs |
| 7 | + |
| 8 | +import "io" |
| 9 | + |
| 10 | +// ServeConfined serves only localPath over an already secured transport. It uses |
| 11 | +// the same root and metadata protections as builtin reverse-sshfs mounts. |
| 12 | +func ServeConfined(transport io.ReadWriteCloser, localPath string, readonly bool, readonlyNames []string) error { |
| 13 | + server, root, err := newRootedServer(transport, localPath, readonly, readonlyNames) |
| 14 | + if err != nil { |
| 15 | + return err |
| 16 | + } |
| 17 | + defer root.Close() |
| 18 | + defer server.Close() |
| 19 | + return server.Serve() |
| 20 | +} |