util

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogMaxAge     = 1  // one day
	LogMaxBackups = 1  // one backup
	LogMaxSize    = 10 // 10Mb
	LogFileName   = "easyss.log"
)
View Source
const (
	Http2HeaderLen = 9
	PaddingSize    = 64
	MaxPaddingSize = 255
	MinPaddingSize = 64
)
View Source
const (
	FlagTCP uint8 = 1 << iota
	FlagUDP
	FlagICMP
	FlagPad
	FlagNeedACK
	FlagFIN
	FlagACK
)
View Source
const FlagDefault uint8 = 0

Variables

This section is empty.

Functions

func Command

func Command(name string, arg ...string) (string, error)

func CommandContext

func CommandContext(ctx context.Context, name string, arg ...string) (string, error)

func CurrentDir

func CurrentDir() string

func DirFileList

func DirFileList(dir string) ([]string, error)

func EncodeHTTP2Header

func EncodeHTTP2Header(frameType FrameType, flag uint8, rawDataLen int, dst []byte) (header []byte, padSize byte)

func FileExists

func FileExists(path string) (bool, error)

func HasPad

func HasPad(header []byte) bool

HasPad returns true if http2 header frame has pad field, panic if header's length not equals Http2HeaderLen

func IsDataFrame

func IsDataFrame(header []byte) bool

func IsIP

func IsIP(ip string) bool

func IsIPV6

func IsIPV6(ip string) bool

func IsLoopbackIP

func IsLoopbackIP(ip string) bool

func IsNeedACK

func IsNeedACK(header []byte) bool

func IsPingFrame

func IsPingFrame(header []byte) bool

func IsPrivateIP

func IsPrivateIP(ip string) bool

func IsRSTACKFrame

func IsRSTACKFrame(header []byte) bool

func IsRSTFINFrame

func IsRSTFINFrame(header []byte) bool

func IsTCPProto

func IsTCPProto(header []byte) bool

func IsUDPProto

func IsUDPProto(header []byte) bool

func LogFilePath

func LogFilePath() string

func PayloadLen

func PayloadLen(header []byte) int

PayloadLen returns payload length in http2 header frame, panic if header's length not equals Http2HeaderLen

func RandomBetween

func RandomBetween(min, max int64) int64

func ReadFileLines

func ReadFileLines(file string) ([]string, error)

func ReadFileLinesMap

func ReadFileLinesMap(file string) (map[string]struct{}, error)

func SetLogFileHook

func SetLogFileHook(logDir string)

func SetSysDNS

func SetSysDNS(v []string) error

func SysDNS

func SysDNS() ([]string, error)

func SysGatewayAndDevice

func SysGatewayAndDevice() (gw string, dev string, err error)

func SysPowershellMajorVersion

func SysPowershellMajorVersion() int

func SysSupportPowershell

func SysSupportPowershell() bool

func WriteToTemp

func WriteToTemp(filename string, content []byte) (namePath string, err error)

Types

type FrameType

type FrameType uint8
const (
	FrameTypeData    FrameType = 0x0
	FrameTypeRST     FrameType = 0x3
	FrameTypePing    FrameType = 0x6
	FrameTypeUnknown FrameType = 0xff
)

func FrameTypeFromHeader

func FrameTypeFromHeader(header []byte) FrameType

func ParseFrameTypeFrom

func ParseFrameTypeFrom(i uint8) FrameType

func (FrameType) String

func (ft FrameType) String() string

func (FrameType) ToUint8

func (ft FrameType) ToUint8() uint8

Directories

Path Synopsis
Package bytespool provides a pool of []byte.
Package bytespool provides a pool of []byte.

Jump to

Keyboard shortcuts

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