feat: 启动时输出监控的文件夹和网卡名

This commit is contained in:
imlonghao
2025-08-02 10:48:26 +08:00
parent 6df83ae84c
commit 547df7a40a
3 changed files with 62 additions and 0 deletions

View File

@@ -90,3 +90,27 @@ func isPhysicalDisk(part disk.PartitionStat) bool {
return true
}
func DiskList() ([]string, error) {
diskList := []string{}
if flags.IncludeMountpoints != "" {
includeMounts := strings.Split(flags.IncludeMountpoints, ";")
for _, mountpoint := range includeMounts {
mountpoint = strings.TrimSpace(mountpoint)
if mountpoint != "" {
diskList = append(diskList, mountpoint)
}
}
} else {
usage, err := disk.Partitions(false)
if err != nil {
return nil, err
}
for _, part := range usage {
if isPhysicalDisk(part) {
diskList = append(diskList, part.Mountpoint)
}
}
}
return diskList, nil
}