1 Star 0 Fork 2

安易科技(北京)有限公司/chameleon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
unixsock.go 571 Bytes
一键复制 编辑 原始数据 按行查看 历史
Derek Ray 提交于 2025-01-08 10:41 +08:00 . feat(plugin): add plugin system implementation
package utils
import (
"os"
"strings"
)
// IsUnixSockFile check if specified file is local unix socket file.
// Unlike named pipes which allow only unidirectional data flow, sockets are fully duplex-capable.
// A UNIX socket is marked with an s as the first letter of the mode string, e.g.
// srwxrwxrwx /tmp/.X11-unix/X0
func IsUnixSockFile(filename string) bool {
if strings.HasPrefix(filename, "unix://") {
filename = filename[len("unix://"):]
}
info, err := os.Stat(filename)
if err != nil {
return false
}
return (info.Mode() & os.ModeSocket) != 0
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/anesec/chameleon.git
git@gitee.com:anesec/chameleon.git
anesec
chameleon
chameleon
205da4a0ed50

搜索帮助