- 公网反代:Nginx 状态卡片(版本 / 运行状态 / 配置校验 / 端口监听) - 部署设置第一、二梯队(HTTPS 开关、安全头、限流、连接数、仅中国大陆 IP) - 隧道检测兼容 frps v0.68 / v0.71(V2 与旧版端点) - 恢复被清空的 internal/frp/store.go、internal/api/ddns_handler.go、web/src/views/DdnsView.vue
26 lines
625 B
Go
26 lines
625 B
Go
//go:build linux || darwin || freebsd
|
|
|
|
package frp
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
func probeProcess(pid int) (bool, string) {
|
|
if pid <= 0 {
|
|
return false, ""
|
|
}
|
|
if data, err := os.ReadFile("/proc/" + strconv.Itoa(pid) + "/cmdline"); err == nil {
|
|
commandLine := strings.ReplaceAll(string(data), "\x00", " ")
|
|
return strings.TrimSpace(commandLine) != "", strings.TrimSpace(commandLine)
|
|
}
|
|
output, err := exec.Command("ps", "-p", strconv.Itoa(pid), "-o", "command=").Output()
|
|
if err != nil {
|
|
return false, ""
|
|
}
|
|
return strings.TrimSpace(string(output)) != "", strings.TrimSpace(string(output))
|
|
}
|