Documentation ¶
Index ¶
- Constants
- Variables
- func CeilUnixTime(seconds int) int64
- func CleanPath(path string) string
- func CopyWithFilter(writer io.Writer, reader io.Reader, buf []byte, filter func(p []byte) []byte) (written int64, err error)
- func DumpResponse(resp *http.Response) (header []byte, body []byte, err error)
- func EqualStrings(s1 []string, s2 []string) bool
- func Exit()
- func FloorUnixTime(seconds int) int64
- func FormatAddress(addr string) string
- func FormatAddressList(addrList []string) []string
- func GMTTime(t time.Time) time.Time
- func GMTUnixTime(timestamp int64) int64
- func Get(object interface{}, keys []string) interface{}
- func IP2Long(ip string) uint64
- func IsIPv4(ip string) bool
- func IsIPv6(ip string) bool
- func IsLocalIP(ipString string) bool
- func ListenReuseAddr(network string, addr string) (net.Listener, error)
- func LookupCNAME(host string) (string, error)
- func MaxInt(min1 int, min2 int) int
- func MergePorts(ports []int) [][2]int
- func MinInt(min1 int, min2 int) int
- func NewHTTPClient(timeout time.Duration) *http.Client
- func NextMinuteUnixTime() int64
- func ParseAddrHost(addr string) string
- func PrintError(err error)
- func RemoveWorkspace(path string) string
- func SetRLimit(limit uint64) error
- func SetSuitableRLimit() error
- func SharedHttpClient(timeout time.Duration) *http.Client
- func SimpleDecrypt(data []byte) []byte
- func SimpleDecryptMap(base64String string) (maps.Map, error)
- func SimpleEncrypt(data []byte) []byte
- func SimpleEncryptMap(m maps.Map) (base64String string, err error)
- func SystemMemoryGB() int
- func ToValidUTF8string(v string) string
- func UnixTime() int64
- func UnixTimeMilli() int64
- func UnixTimeMilliString() (int64, string)
- func UnsafeBytesToString(bs []byte) string
- func UnsafeStringToBytes(s string) []byte
- func VersionToLong(version string) uint32
- type AES256CFBMethod
- type BufferPool
- type BytePool
- type FreeHoursManager
- type ServiceManager
- func (this *ServiceManager) Close() error
- func (this *ServiceManager) Install(exePath string, args []string) error
- func (this *ServiceManager) Log(msg string)
- func (this *ServiceManager) LogError(msg string)
- func (this *ServiceManager) PauseWindow()
- func (this *ServiceManager) Start() error
- func (this *ServiceManager) Uninstall() error
- type Ticker
- type Unzip
Constants ¶
View Source
const SO_REUSEPORT = 15
Variables ¶
View Source
var BytePool16k = NewBytePool(16 * 1024)
View Source
var BytePool1k = NewBytePool(1024)
View Source
var BytePool32k = NewBytePool(32 * 1024)
View Source
var BytePool4k = NewBytePool(4 * 1024)
View Source
var RegexpDigitNumber = regexp.MustCompile("^\\d+$")
Functions ¶
func CopyWithFilter ¶
func DumpResponse ¶
DumpResponse 导出响应
func EqualStrings ¶ added in v0.5.8
EqualStrings 检查两个字符串slice内容是否一致
func FormatAddressList ¶
FormatAddressList format address list
func ListenReuseAddr ¶
ListenReuseAddr 监听可重用的端口
func MergePorts ¶ added in v0.4.10
MergePorts 聚合端口 返回 [ [fromPort, toPort], ... ]
func NewHTTPClient ¶
NewHTTPClient 获取一个新的Client
func ParseAddrHost ¶ added in v0.4.9
ParseAddrHost 分析地址中的主机名部分
func PrintError ¶
func PrintError(err error)
func RemoveWorkspace ¶
func SetSuitableRLimit ¶
func SetSuitableRLimit() error
SetSuitableRLimit set best resource limit value
func SharedHttpClient ¶
SharedHttpClient 获取一个公用的Client
func SystemMemoryGB ¶
func SystemMemoryGB() int
func UnixTimeMilliString ¶ added in v0.5.0
func UnsafeBytesToString ¶
UnsafeBytesToString convert bytes to string
func UnsafeStringToBytes ¶
UnsafeStringToBytes convert string to bytes
Types ¶
type AES256CFBMethod ¶
type AES256CFBMethod struct {
// contains filtered or unexported fields
}
func (*AES256CFBMethod) Decrypt ¶
func (this *AES256CFBMethod) Decrypt(dst []byte) (src []byte, err error)
func (*AES256CFBMethod) Encrypt ¶
func (this *AES256CFBMethod) Encrypt(src []byte) (dst []byte, err error)
func (*AES256CFBMethod) Init ¶
func (this *AES256CFBMethod) Init(key, iv []byte) error
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool pool for get byte slice
type BytePool ¶
type BytePool struct {
// contains filtered or unexported fields
}
BytePool pool for get byte slice
type FreeHoursManager ¶
type FreeHoursManager struct {
// contains filtered or unexported fields
}
FreeHoursManager 计算节点空闲时间 以便于我们在空闲时间执行高强度的任务,如清理缓存等
func NewFreeHoursManager ¶
func NewFreeHoursManager() *FreeHoursManager
func (*FreeHoursManager) IsFreeHour ¶
func (this *FreeHoursManager) IsFreeHour() bool
func (*FreeHoursManager) Start ¶
func (this *FreeHoursManager) Start()
func (*FreeHoursManager) Stop ¶
func (this *FreeHoursManager) Stop()
func (*FreeHoursManager) Update ¶
func (this *FreeHoursManager) Update(bytes uint64)
type ServiceManager ¶
type ServiceManager struct { Name string Description string // contains filtered or unexported fields }
服务管理器
Source Files ¶
- buffer_pool.go
- byte_pool.go
- encrypt.go
- errors.go
- exit.go
- free_hours_manager.go
- get.go
- http.go
- ip.go
- lookup.go
- net.go
- net_linux.go
- net_utils.go
- number.go
- path.go
- reader_utils.go
- rlimit_linux.go
- service.go
- service_linux.go
- string.go
- system.go
- ticker.go
- ticker_utils.go
- time.go
- unzip.go
- version.go
- workspace.go
Click to show internal directories.
Click to hide internal directories.