tools

package
v3.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package tools 存放辅助方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectLocalNames added in v3.2.0

func CollectLocalNames() []string

CollectLocalNames 收集本机所有 IP 地址

func CollectTopProcesses

func CollectTopProcesses() types.TopProcesses

CollectTopProcesses 采集各指标 Top 5 进程

func CurrentInfo

func CurrentInfo(nets, disks []string) types.CurrentInfo

CurrentInfo 获取监控数据

func FormatBytes

func FormatBytes(size float64) string

FormatBytes 格式化bytes

func GetLocalIPv4

func GetLocalIPv4() (string, error)

GetLocalIPv4 获取本地IPv4

func GetLocalIPv6

func GetLocalIPv6() (string, error)

GetLocalIPv6 获取本地IPv6

func GetPublicIPv4

func GetPublicIPv4() (string, error)

GetPublicIPv4 获取公网IPv4

func GetPublicIPv6

func GetPublicIPv6() (string, error)

GetPublicIPv6 获取公网IPv6

func IsChina

func IsChina() bool

IsChina 是否中国大陆

func IsIPv6 added in v3.2.6

func IsIPv6(host string) bool

IsIPv6 判断 host 是否为 IPv6 地址(裸地址,不含方括号)

func RestartPanel

func RestartPanel()

RestartPanel 重启面板

func RestartServer

func RestartServer()

RestartServer 重启服务器

func StopPanel

func StopPanel()

StopPanel 停止面板

func UnwrapIPv6 added in v3.2.6

func UnwrapIPv6(host string) string

UnwrapIPv6 去除 IPv6 地址的方括号(如 [::1] → ::1),非此形式则原样返回

func WrapIPv6 added in v3.2.6

func WrapIPv6(host string) string

WrapIPv6 为裸 IPv6 地址套上方括号(如 ::1 → [::1]),用于 nginx server_name、URL 等语境 非 IPv6 或已带方括号则原样返回

Types

type NoopLogger

type NoopLogger struct{}

NoopLogger 给 go-resty 使用的空日志

func (NoopLogger) Debugf

func (NoopLogger) Debugf(format string, v ...any)

func (NoopLogger) Errorf

func (NoopLogger) Errorf(format string, v ...any)

func (NoopLogger) Warnf

func (NoopLogger) Warnf(format string, v ...any)

Jump to

Keyboard shortcuts

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