util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeACKRstStreamHeader

func EncodeACKRstStreamHeader(dst []byte) (header []byte)

func EncodeFINRstStreamHeader

func EncodeFINRstStreamHeader(dst []byte) (header []byte)

func EncodeHTTP2DataFrameHeader

func EncodeHTTP2DataFrameHeader(datalen int, dst []byte) (header []byte)

func FileExists

func FileExists(path string) (bool, error)

func GetCurrentDir

func GetCurrentDir() string

func GetLogFileName

func GetLogFileName() string

func GetLogFilePath

func GetLogFilePath() string

func GetLogFileWriter

func GetLogFileWriter(maxAge time.Duration, rotationTime time.Duration) (io.Writer, error)

func IsIP

func IsIP(ip string) bool

func IsPrivateIP

func IsPrivateIP(ip string) bool

func IsTypeAIP

func IsTypeAIP(ip string) bool

A类ip: 10.0.0.0 - 10.255.255.255

func IsTypeBIP

func IsTypeBIP(ip string) bool

B类ip: 172.16.0.0 - 172.31.255.255

func IsTypeCIP

func IsTypeCIP(ip string) bool

C类ip: 192.168.0.0-192.168.255.255

func SysPowershellMajorVersion

func SysPowershellMajorVersion() int

func SysSupportPowershell

func SysSupportPowershell() bool

Types

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

Bytes is a pool of byte slices that can be re-used. Slices in this pool will not be garbage collected when not in use.

func NewBytes

func NewBytes(max int) *Bytes

NewBytes returns a Bytes pool with capacity for max byte slices to be pool.

func (*Bytes) Get

func (p *Bytes) Get(sz int) []byte

Get returns a byte slice size with at least sz capacity. Items returned may not be in the zero state and should be reset by the caller.

func (*Bytes) Put

func (p *Bytes) Put(c []byte)

Put returns a slice back to the pool. If the pool is full, the byte slice is discarded.

Jump to

Keyboard shortcuts

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