utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExecPath string
	LocalDir string
)

Functions

func AnyToFloat32 added in v0.1.1

func AnyToFloat32(value any) (float32, error)

AnyToFloat32 任意基础类型转为float32类型

func AnyToFloat64 added in v0.1.1

func AnyToFloat64(value any) (float64, error)

AnyToFloat64 任意基础类型转为float64类型

func AnyToInt added in v0.1.1

func AnyToInt(value any) (int, error)

AnyToInt 任意基础类型转为int类型

func AnyToInt64 added in v0.1.1

func AnyToInt64(value any) (int64, error)

AnyToInt64 任意基础类型转为int64类型

func AnyToString added in v0.1.1

func AnyToString(value any) (string, error)

AnyToString 任意基础类型转为string类型

func AnyToUInt added in v0.1.1

func AnyToUInt(value any) (uint, error)

AnyToUInt 任意基础类型转为uint类型

func AnyToUInt32 added in v0.1.1

func AnyToUInt32(value any) (uint32, error)

AnyToUInt32 任意基础类型转为uint32类型

func AnyToUInt64 added in v0.1.1

func AnyToUInt64(value any) (uint64, error)

AnyToUInt64 任意基础类型转为uint64类型

func Decrypt added in v0.1.1

func Decrypt(encryptedHex string, key []byte) (string, error)

Decrypt Aes解密

func Encrypt added in v0.1.1

func Encrypt(plaintext string, key []byte) (string, error)

Encrypt Aes加密

func GetVarName added in v0.1.1

func GetVarName(v any) string

GetVarName 获取变量名称

func IsValidIP added in v0.1.1

func IsValidIP(ipAddr string) bool

IsValidIP 检测IP地址是否合法

func IsValidPort added in v0.1.1

func IsValidPort(port string) (int, error)

IsValidPort 检测端口是否合法

func IsValidURL added in v0.1.1

func IsValidURL(u string) bool

IsValidURL 检测给定字符串是否是一个合法的URL。

func Ping added in v0.1.1

func Ping(ipAddr string, timeout time.Duration) bool

Ping 对目的地址发起ping检测icmp是否通畅(只支持ipv4)

func PrintNowTime

func PrintNowTime()

func RemoveItemsContainingSubstring added in v0.1.1

func RemoveItemsContainingSubstring(arr []string, substr string) []string

RemoveItemsContainingSubstring 从字符串数组里移除包含substr字符串的项并移除连续空格字符

func RemoveItemsNotContainingSubstring added in v0.1.1

func RemoveItemsNotContainingSubstring(arr []string, substr string) []string

RemoveItemsNotContainingSubstring 从字符串数组里移除不包含substr字符串的项并移除连续空格字符

func RemoveMultiSpaces added in v0.1.1

func RemoveMultiSpaces(input string) string

RemoveMultiSpaces 从字符串中移除多个连续空格字符

func RemoveTextWithinParens added in v0.1.1

func RemoveTextWithinParens(input string) string

RemoveTextWithinParens 从字符串中删除括号内的文本。

func Telnet added in v0.1.1

func Telnet(ip string, port int, timeout time.Duration) bool

Telnet 尝试与指定的 IP 和端口建立 TCP 连接

Types

This section is empty.

Jump to

Keyboard shortcuts

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