system

package
v1.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Reset  = "\033[0m"  // 重置颜色
	Red    = "\033[31m" // 红色
	Green  = "\033[32m" // 绿色
	Yellow = "\033[33m" // 黄色
	Blue   = "\033[34m" // 蓝色
)

Variables

This section is empty.

Functions

func Abs

func Abs(path string) (string, error)

Abs 获取绝对目录 与 filepath.Abs 的区别是,这个以可执行文件目录为工作目录

func CleanOldFiles

func CleanOldFiles(files []FileInfo, count int) (int, error)

func CompareVersionFunc

func CompareVersionFunc(a, b string, f func(a, b string) bool) bool

CompareVersionFunc 比较 ip 或 版本号是否一致

func ErrPrintf

func ErrPrintf(format string, a ...any)

ErrPrintf error output

func Executable

func Executable() string

Executable 获取可执行文件绝对路径

func ExternalIP

func ExternalIP() (string, error)

ExternalIP 获取公网 IP

func GetDirSize

func GetDirSize(path string) (int64, error)

GetDirSize 获取目录大小,单位 Bit

func Getwd

func Getwd() string

Getwd 获取工作目录

func LocalIP

func LocalIP() string

LocalIP 获取本地IP地址

func PortUsed

func PortUsed(mode string, port int) bool

PortUsed 检测端口 true:已使用;false:未使用

func RemoveEmptyDirs

func RemoveEmptyDirs(ctx context.Context, rootDir string, start, end time.Time) error

RemoveEmptyDirs 删除空目录,性能优化版,增加时间范围过滤

func WarnPrintf

func WarnPrintf(format string, a ...any)

WarnPrintf warn output

Types

type ExternalData added in v1.3.11

type ExternalData struct {
	Addr      string `json:"addr"`
	Country   string `json:"country"`
	Province  string `json:"province"`
	City      string `json:"city"`
	ISP       string `json:"isp"`
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
}

type FileBackup

type FileBackup struct {
	// contains filtered or unexported fields
}

func NewFileBackup

func NewFileBackup(file string) *FileBackup

func (*FileBackup) Close

func (f *FileBackup) Close()

func (*FileBackup) Write

func (f *FileBackup) Write(data []byte)

type FileInfo

type FileInfo struct {
	os.FileInfo
	Path string
}

func GlobFiles

func GlobFiles(path string) ([]FileInfo, error)

GlobFiles 按照升序排列所有文件

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL