internal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeName = "Content-Type"
	ContentTypeJSON = "application/json;charset=utf-8"
)
View Source
const DemoProfile = `` /* 1399-byte string literal not displayed */

Variables

View Source
var Valuer jj.Substitute = &valuer{Map: make(map[Keep]interface{})}

Functions

func DealUploadFilePath

func DealUploadFilePath(ctx context.Context, uploadFilepath string, postFileCh chan string)

func ErrorIf

func ErrorIf(b bool, err1, err2 error) error

func Gen

func Gen(s string, mode StringMode) string

func NetworkWrap

func NetworkWrap(network string) networkWrapper

func OpenFile

func OpenFile(f string) *os.File

OpenFile opens file successfully or panic.

func ParseBodyArg

func ParseBodyArg(body string, stream bool) (streamFileName string, bodyBytes []byte)

func Quoted

func Quoted(s, open, close string) (string, bool)

func ReadFileFromPos

func ReadFileFromPos(f *os.File, pos int64) ([]byte, error)

func ReadMultipartFile

func ReadMultipartFile(nocache bool, fieldName, filePath string) (data []byte, contentType string, err error)

ReadMultipartFile read file filePath for upload in multipart, return multipart content, form data content type and error.

func SetHeader

func SetHeader(r *fasthttp.Request, header, value string)

SetHeader set request header if value is not empty.

func ThroughputStatDial

func ThroughputStatDial(wrap networkWrapper, dial fasthttp.DialFunc, r *int64, w *int64) fasthttp.DialFunc

Types

type Closers

type Closers []io.Closer

func (Closers) Close

func (closers Closers) Close() (err error)

type Keep

type Keep struct {
	Keep string
	Name string
}

type LogFile

type LogFile struct {
	File *os.File
	Pos  int64
	sync.Mutex
}

func CreateLogFile

func CreateLogFile(verbose int, printOption uint8) *LogFile

func (*LogFile) Close

func (f *LogFile) Close() error

func (*LogFile) GetLastLog

func (f *LogFile) GetLastLog() string

func (*LogFile) MarkPos

func (f *LogFile) MarkPos()

func (*LogFile) Write

func (f *LogFile) Write(b *bytes.Buffer)

func (*LogFile) WriteString

func (f *LogFile) WriteString(s string)

type MyConn

type MyConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewMyConn

func NewMyConn(conn net.Conn, r, w *int64) (*MyConn, error)

func (*MyConn) Read

func (c *MyConn) Read(b []byte) (n int, err error)

func (*MyConn) Write

func (c *MyConn) Write(b []byte) (n int, err error)

type Option

type Option struct {
	Tag      string
	Eval     bool
	JsonBody bool
}

type Profile

type Profile struct {
	Method  string
	URL     string
	Query   map[string]string
	RawJSON map[string]string
	Form    map[string]string
	Header  map[string]string
	Body    string
	Option
	Comments []string
	// contains filtered or unexported fields
}

func ParseProfileArg

func ParseProfileArg(profileArg []string) []*Profile

func ParseProfileFile

func ParseProfileFile(baseUrl string, fileName string) ([]*Profile, error)

func ParseProfiles

func ParseProfiles(baseUrl string, r io.Reader) ([]*Profile, error)

func (*Profile) CreateReq

func (p *Profile) CreateReq(isTLS bool, req *fasthttp.Request, enableGzip bool) (Closers, error)

type RangeValue

type RangeValue struct {
	From string
	To   string

	IsInt   bool
	FromInt int
	ToInt   int
}

func (*RangeValue) Contains

func (r *RangeValue) Contains(s string) bool

type SingleValue

type SingleValue struct {
	Value string
}

func (SingleValue) Contains

func (v SingleValue) Contains(s string) bool

type StringMode

type StringMode int
const (
	MayJSON StringMode = iota
	NotJSON
	SureJSON
)

type Tag

type Tag struct {
	Values []TagValue
	Raw    string
}

func ParseTag

func ParseTag(s string) *Tag

func (*Tag) Contains

func (t *Tag) Contains(s string) bool

func (Tag) String

func (t Tag) String() string

type TagValue

type TagValue interface {
	Contains(s string) bool
}

func NewRangeValue

func NewRangeValue(a, b string) TagValue

Jump to

Keyboard shortcuts

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