utils

package module
v0.0.0-...-9eb71bc Latest Latest
Warning

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

Go to latest
Published: Dec 19, 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

func AnyToFloat32(value any) (float32, error)

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

func AnyToFloat64

func AnyToFloat64(value any) (float64, error)

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

func AnyToInt

func AnyToInt(value any) (int, error)

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

func AnyToInt64

func AnyToInt64(value any) (int64, error)

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

func AnyToString

func AnyToString(value any) (string, error)

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

func AnyToUInt

func AnyToUInt(value any) (uint, error)

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

func AnyToUInt32

func AnyToUInt32(value any) (uint32, error)

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

func AnyToUInt64

func AnyToUInt64(value any) (uint64, error)

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

func Decrypt

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

Decrypt Aes解密

func Encrypt

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

Encrypt Aes加密

func GetVarName

func GetVarName(v any) string

GetVarName 获取变量名称

func IsValidIP

func IsValidIP(ipAddr string) bool

IsValidIP 检测IP地址是否合法

func IsValidPort

func IsValidPort(port string) (int, error)

IsValidPort 检测端口是否合法

func IsValidURL

func IsValidURL(u string) bool

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

func Ping

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

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

func RemoveItemsContainingSubstring

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

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

func RemoveItemsNotContainingSubstring

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

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

func RemoveMultiSpaces

func RemoveMultiSpaces(input string) string

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

func RemoveTextWithinParens

func RemoveTextWithinParens(input string) string

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

func Telnet

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