跳到主要内容

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

浏览文件

limit.go

30 行 · 826 B历史下载
1package vmname
2
3import (
4 "path/filepath"
5
6 "github.com/lima-vm/lima/v2/pkg/limatype/filenames"
7 "github.com/lima-vm/lima/v2/pkg/osutil"
8)
9
10// HomeLimit fits the longest Lima socket in this profile's UNIX socket path.
11// A Cage-managed storage link keeps the original logical home after migration.
12func HomeLimit(home string, logical bool) Limit {
13 real, rest := home, ""
14 for !logical {
15 if p, err := filepath.EvalSymlinks(real); err == nil {
16 real = filepath.Join(p, rest)
17 break
18 }
19 parent := filepath.Dir(real)
20 if parent == real {
21 real = home
22 break
23 }
24 rest = filepath.Join(filepath.Base(real), rest)
25 real = parent
26 }
27 // <home>/<name>/<socket>, shorter than UnixPathMax (its NUL).
28 n := osutil.UnixPathMax - 1 - len(real) - len("/") - len("/"+filenames.LongestSock)
29 return Limit(max(1, min(n, 76)))
30}