跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

serve.go

28 行 · 1013 B历史下载
1package reversesshfs
2
3import "io"
4
5// ServeConfined serves only localPath over an already secured transport. It uses
6// the same root and metadata protections as builtin reverse-sshfs mounts.
7func ServeConfined(transport io.ReadWriteCloser, localPath string, readonly bool, readonlyNames []string) error {
8 server, root, err := newRootedServer(transport, localPath, readonly, readonlyNames)
9 if err != nil {
10 return err
11 }
12 defer root.Close()
13 defer server.Close()
14 return server.Serve()
15}
16
17// ServeConfinedVirtual exposes the selected directory at / without disclosing
18// its host path. All reads, writes and Guard decisions use the same confined
19// root and metadata protections as ServeConfined.
20func ServeConfinedVirtual(transport io.ReadWriteCloser, localPath string, readonly bool, readonlyNames []string) error {
21 server, root, err := newRootedServerAt(transport, localPath, "/", readonly, readonlyNames)
22 if err != nil {
23 return err
24 }
25 defer root.Close()
26 defer server.Close()
27 return server.Serve()
28}