utils

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0, BSD-3-Clause, MIT, + 2 more Imports: 16 Imported by: 0

Documentation

Overview

Package utils favicon相关工具

Package utils 工具集合

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(version1, version2 string) int

CompareVersions 比较两个版本号字符串 version1, version2: 待比较的版本号 返回值: 1 表示 version1 大于 version2

-1 表示 version1 小于 version2
 0 表示两个版本号相等

func Duration2String

func Duration2String(t time.Duration) string

Duration2String 将时间段转换为可读的字符串格式 如果时间超过60秒则返回分钟,否则返回秒

func FaviconHash

func FaviconHash(data []byte) int32

FaviconHash 计算网站图标的哈希值 将数据进行base64编码后使用murmur3哈希算法计算

func GetFaviconBytes

func GetFaviconBytes(hp *httpx.HTTPX, domain string, resp []byte) ([]byte, error)

GetFaviconBytes retrieves the favicon bytes from a website 这个函数用于获取网站的favicon图标数据

func GetMiddleText

func GetMiddleText(left, right, html string) string

GetMiddleText 获取两个字符串之间的文本内容 left: 左边界字符串 right: 右边界字符串 html: 源文本 返回左右边界之间的文本,如果未找到则返回空字符串

func InsertInto

func InsertInto(s string, interval int, sep rune) string

InsertInto 在字符串中每隔指定间隔插入分隔符 s: 源字符串 interval: 插入间隔 sep: 分隔符

func IsCIDR

func IsCIDR(cidr string) bool

IsCIDR 检查给定的字符串是否为有效的CIDR格式

func IsDir

func IsDir(path string) bool

IsDir 判断给定路径是否为目录 path: 待检查的路径 返回布尔值表示是否为目录

func IsFileExists

func IsFileExists(path string) bool

IsFileExists 检查文件是否存在 path: 文件路径 返回布尔值表示文件是否存在

func ScanDir

func ScanDir(path string) ([]string, error)

ScanDir 递归扫描目录,返回所有文件的完整路径 path: 要扫描的目录路径 返回文件路径列表和可能的错误

func TrimProtocol

func TrimProtocol(targetURL string) string

TrimProtocol 移除URL中的HTTP/HTTPS协议前缀 targetURL: 目标URL 返回去除协议前缀后的URL

Types

type PortInfo added in v0.0.4

type PortInfo struct {
	Port    int
	Address string
}

PortInfo 存储端口和地址信息

func GetLocalOpenPorts added in v0.0.4

func GetLocalOpenPorts() ([]PortInfo, error)

GetLocalOpenPorts 获取本地开放的端口及其地址信息

Jump to

Keyboard shortcuts

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