part

package
v0.28.20240917115209 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 20 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyUrl         = errors.New("ErrEmptyUrl")
	ErrCantRetry        = errors.New("ErrCantRetry")
	ErrNewRequest       = errors.New("ErrNewRequest")
	ErrClientDo         = errors.New("ErrClientDo")
	ErrResponFileCreate = errors.New("ErrResponFileCreate")
	ErrWriteRes         = errors.New("ErrWriteRes")
	ErrReadRes          = errors.New("ErrReadRes")
	ErrPostStrOrRawPipe = errors.New("ErrPostStrOrRawPipe")
	ErrNoDate           = errors.New("ErrNoDate")
)

Functions

func Cookies_List_2_Map

func Cookies_List_2_Map(Cookies []*http.Cookie) (o map[string]string)

func Cookies_List_2_String added in v0.28.20240419182528

func Cookies_List_2_String(Cookies []*http.Cookie) (o string)

func Cookies_Map_2_List added in v0.28.20240418171545

func Cookies_Map_2_List(Cookies map[string]string) (o []*http.Cookie)

func Cookies_String_2_List added in v0.28.20240418171545

func Cookies_String_2_List(Cookies string) (o []*http.Cookie)

func Cookies_String_2_Map

func Cookies_String_2_Map(Cookies string) (o map[string]string)

func IsCancel

func IsCancel(e error) bool

func IsTimeout

func IsTimeout(e error) bool

func Map_2_Cookies_String

func Map_2_Cookies_String(Cookies map[string]string) (o string)

func ResDate added in v0.28.20240806162427

func ResDate(res *http.Response) (time.Time, error)

func ToForm added in v0.9.12

func ToForm(m map[string]string) (postStr string, contentType string)

Types

type CookieJson added in v0.6.0

type CookieJson struct {
	Name  string `json:"Name"`
	Value string `json:"Value"`

	Path       string `json:"Path"`       // optional
	Domain     string `json:"Domain"`     // optional
	Expires    string `json:"Expires"`    // time.Time in RFC1123
	RawExpires string `json:"RawExpires"` // for reading cookies only

	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
	// MaxAge>0 means Max-Age attribute present and given in seconds
	MaxAge   int           `json:"MaxAge"`
	Secure   bool          `json:"Secure"`
	HttpOnly bool          `json:"HttpOnly"`
	SameSite http.SameSite `json:"SameSite"` // Go 1.11
	Raw      string        `json:"Raw"`
	Unparsed []string      `json:"Unparsed"` // Raw text of unparsed attribute-value pairs
}

func (*CookieJson) FromCookie added in v0.6.0

func (t *CookieJson) FromCookie(cookie *http.Cookie)

func (*CookieJson) FromJson added in v0.6.0

func (t *CookieJson) FromJson(cookie_in_json []byte) error

func (*CookieJson) ToCookie added in v0.6.0

func (t *CookieJson) ToCookie() (http.Cookie, error)

func (*CookieJson) ToJson added in v0.6.0

func (t *CookieJson) ToJson() ([]byte, error)

type RawReqRes added in v0.28.1

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

func NewRawReqRes added in v0.28.1

func NewRawReqRes() *RawReqRes

func (RawReqRes) Read added in v0.28.1

func (t RawReqRes) Read(p []byte) (n int, err error)

func (RawReqRes) ReqClose added in v0.28.1

func (t RawReqRes) ReqClose() error

func (RawReqRes) ReqCloseWithError added in v0.28.1

func (t RawReqRes) ReqCloseWithError(e error) error

func (RawReqRes) ReqWrite added in v0.28.1

func (t RawReqRes) ReqWrite(p []byte) (n int, err error)

func (RawReqRes) ResClose added in v0.28.1

func (t RawReqRes) ResClose() error

func (RawReqRes) ResCloseWithError added in v0.28.1

func (t RawReqRes) ResCloseWithError(e error) error

func (RawReqRes) ResRead added in v0.28.1

func (t RawReqRes) ResRead(p []byte) (n int, err error)

func (RawReqRes) Write added in v0.28.1

func (t RawReqRes) Write(p []byte) (n int, err error)

type Req

type Req struct {
	// 当Async为true时,必须在Wait()之后读取,否则有DATA RACE可能
	Respon []byte
	// 当Async为true时,必须在Wait()之后读取,否则有DATA RACE可能
	Response *http.Response
	UsedTime time.Duration
	// contains filtered or unexported fields
}

func New

func New() *Req

func (*Req) Cancel

func (t *Req) Cancel()

func (*Req) Close

func (t *Req) Close()

func (*Req) IsLive added in v0.23.2

func (t *Req) IsLive() bool

func (*Req) Reqf

func (t *Req) Reqf(val Rval) error

func (*Req) Wait added in v0.19.0

func (t *Req) Wait() (err error)

type Rval

type Rval struct {
	Method  string
	Url     string
	PostStr string
	Proxy   string
	Retry   int
	// Millisecond
	Timeout int
	// Millisecond
	SleepTime int
	// Millisecond
	WriteLoopTO      int
	JustResponseCode bool
	NoResponse       bool
	// 当Async为true时,Respon、Response必须在Wait()之后读取,否则有DATA RACE可能
	Async   bool
	Cookies []*http.Cookie
	Ctx     context.Context

	SaveToPath string
	// 为避免write阻塞导致panic,请使用此项目io包中的NewPipe(),或在ctx done时,自行关闭pipe writer reader
	SaveToPipe *pio.IOpipe

	RawPipe *RawReqRes

	Header map[string]string
}

Jump to

Keyboard shortcuts

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