Documentation ¶
Index ¶
- Constants
- Variables
- func Base64Decode(b64Str string) (string, error)
- func Base64Encode(str string) string
- func Contanis(slice []string, value string) bool
- func GenerateMD5(s []byte) [16]byte
- func GenerateMD5ToHex(s []byte) string
- func GenerateRandomKey(length int) string
- func GenerateRandomTaskID(time time.Time) string
- func GenerateRandomTaskName(name string) string
- func GetDayInterval(millis int64) (startOfDay, endOfDay time.Time)
- func GetProtocolMap() map[Protocol]string
- func GetSplit(input string) []string
- func GetSplitD(input string) []string
- func GetTimeMillis(tstr string) int64
- func If[T IfTrue](b bool, trueVal, falseVal T) T
- func IsIPv4(ipStr string) (flag bool)
- func IsIPv6(ipStr string) (flag bool)
- func IsItemInSlice(s []any, k any) bool
- func MakeJSONOutput(data interface{}) string
- func Marshal(v interface{}) ([]byte, error)
- func MatchRootDomain(rawURL string) (string, error)
- func MillisToTime(millis int64) time.Time
- func ParseTime(layout, timeStr string) (t time.Time)
- func ReadToBase64(reader io.Reader) (string, error)
- func ReadToBytes(reader io.Reader) (data []byte, err error)
- func SafeToString(b []byte) string
- func SetProtocol(host string, p Protocol) string
- func SliceSepByStep[T interface{}](originalSlice []T, step int) [][]T
- func TrimProtocol(host string) string
- func Unmarshal(data []byte, v interface{}) error
- func UnsafeToString(b []byte) string
- func WithProtocol(domain string) bool
- type ConcurrentPool
- type IfTrue
- type NetProtocol
- type Protocol
- type ResolveType
- type StringSet
- func (s *StringSet) Add(items ...string)
- func (s *StringSet) Clear()
- func (s *StringSet) Complement(full *StringSet) *StringSet
- func (s *StringSet) Count() int
- func (s *StringSet) Empty() bool
- func (s *StringSet) Has(items ...string) bool
- func (s *StringSet) Intersect(sets ...*StringSet) *StringSet
- func (s *StringSet) List() []string
- func (s *StringSet) Minus(sets ...*StringSet) *StringSet
- func (s *StringSet) PopN(n int) []string
- func (s *StringSet) Remove(items ...string)
- func (s *StringSet) SortList() []string
- func (s *StringSet) Union(sets ...*StringSet) *StringSet
Constants ¶
View Source
const ( LogTimeFormatMill = "2006-01-02 15:04:05.9999" LogTimeFormatSecond = "2006-01-02 15:04:05" LogTimeFormat = "2006-01-02 15:04" StrTimeFormat = "20060102150405" StrTimeFormatMill = "200601021504059999" YYYYMMDDHHmmSSTimeFormat = "2006年01月02日 15:04:05" YYYYMMDDTimeDotFormat = "2006.01.02" MonthFormat = "2006-01" ZreoS = "0s" YYYYMMDDFormat = "2006-01-02" EarlyTime = 1019101055000 LateTime = 4111702655000 )
View Source
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
Variables ¶
View Source
var WithExpiryDuration = ants.WithExpiryDuration
WithExpiryDuration 设置清理协程的时间间隔
View Source
var WithLogger = ants.WithLogger
WithLogger 自定义logger
View Source
var WithPanicHandler = ants.WithPanicHandler
WithPanicHandler 自定义panic处理逻辑
Functions ¶
func GenerateMD5ToHex ¶
func GenerateRandomKey ¶
func GenerateRandomTaskID ¶
func GenerateRandomTaskName ¶
func GetDayInterval ¶
GetDayInterval 获取当前毫秒时间戳所在天的开始和结束shike
func GetProtocolMap ¶
func IsItemInSlice ¶
func MakeJSONOutput ¶
func MakeJSONOutput(data interface{}) string
func SafeToString ¶
func SliceSepByStep ¶
func SliceSepByStep[T interface{}](originalSlice []T, step int) [][]T
Types ¶
type ConcurrentPool ¶
type ConcurrentPool struct {
// contains filtered or unexported fields
}
func NewPool ¶
func NewPool(num int, opts ...ants.Option) (*ConcurrentPool, error)
NewPool 实例化预分配协程池
func (*ConcurrentPool) WaitAndRunNum ¶
func (c *ConcurrentPool) WaitAndRunNum() (int, int)
WaitNum 等待执行的任务数
type NetProtocol ¶
type NetProtocol int
NetProtocol
const ( Invalid NetProtocol = iota // 0. 无法解析 IPv4 // 1. IPv4 IPv6 // 2.IPv6 )
func (NetProtocol) String ¶
func (np NetProtocol) String() string
type ResolveType ¶
type ResolveType string
域名解析类型
const ( DefaultType ResolveType = "" // 默认空值 Atype ResolveType = "A" // IPv4 AAAAtype ResolveType = "AAAA" // IPv6 CNAMEtype ResolveType = "CNAME" MXtype ResolveType = "MX" NStype ResolveType = "NS" PTRtype ResolveType = "PTR" SOAtype ResolveType = "SOA" )
type StringSet ¶
type StringSet struct {
// contains filtered or unexported fields
}
StringSet 定义一个string的set 用来做字符串的"交并补"操作
func (*StringSet) Complement ¶
Complement 两个stringSet补集
Click to show internal directories.
Click to hide internal directories.