sreq

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Check bool

Check = True to stop workerpool

View Source
var CheckWs = false //Check if all request is done -> stop process send request

Functions

func BodyFileUpload

func BodyFileUpload(fileUpload FileParam, Params ...ParamInUploadFile) (*bytes.Buffer, string)

Process Upload file body in Post request

func ConnectWS

func ConnectWS(urlStr string, ft func(input string) string, f func(conn *websocket.Conn))

Use this for input from command line to send data

func ParseReqFile

func ParseReqFile(filename string, url string) *http.Request

Parse request from file raw

url have http:// or https://

func SendWS added in v0.0.5

func SendWS(urlStr string, queueWs []Socket, workers int, proxy string, f func(handle HandleWs))

Send websocket request with workerpool

func Sends

func Sends(req []*Request, proxy string, worker int, f func(c DataHandler))

Multi worker to send request

func SetCookie

func SetCookie(req *http.Request, cookies []*http.Cookie) *http.Request

Set cookie for request

func UnzipResp

func UnzipResp(resp *http.Response) string

read body response

Types

type CustomTransport

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

func NewTransport

func NewTransport(proxy string) *CustomTransport

NewTransport return CustomTransport

func (*CustomTransport) ConnDuration

func (tr *CustomTransport) ConnDuration() time.Duration

func (*CustomTransport) Dial

func (tr *CustomTransport) Dial(network, addr string) (net.Conn, error)

func (*CustomTransport) Duration

func (tr *CustomTransport) Duration() time.Duration

func (*CustomTransport) ReqDuration

func (tr *CustomTransport) ReqDuration() time.Duration

func (*CustomTransport) RoundTrip

func (tr *CustomTransport) RoundTrip(r *http.Request) (*http.Response, error)

Handle Time in request

type DataHandler

type DataHandler struct {
	Resp    *http.Response
	Req     *http.Request
	Time    time.Duration
	DataRet []rune
	// contains filtered or unexported fields
}

Data of response store

func Append

func Append(data []DataHandler, temp DataHandler) []DataHandler

Insert new node to array and sort by Index

func Send

func Send(req *Request, proxy string) DataHandler

One worker send request

type FileParam

type FileParam struct {
	NameOfParam string //param of filename
	FileName    string //filename to open
}

Process Upload File with file

type HandleWs added in v0.0.5

type HandleWs struct {
	Resp      string
	Data2Send string
	DataRet   []rune
	TimeRes   time.Duration
	// contains filtered or unexported fields
}

func AppendWs added in v0.0.5

func AppendWs(data []HandleWs, temp HandleWs) []HandleWs

Insert new node to array and sort by Index

type ParamInUploadFile

type ParamInUploadFile struct {
	ParamName  string
	ParamValue string
}

Process Upload File with more param

type Request

type Request struct {
	Req      *http.Request
	Redirect bool   // default false
	DataRet  []rune // default nil
}

Create Request to worker

func AddQueue

func AddQueue(req []*Request, tempreq *Request) []*Request

Add queue to run workerpool

type Socket added in v0.0.5

type Socket struct {
	Data2Send string
	DataRet   []rune //Default nil
	TimeConn  int    //Default 1s
}

func AddqueueWs added in v0.0.5

func AddqueueWs(socket []Socket, tempsock Socket) []Socket

Add queue to send websocket request

type TransportWs added in v0.0.5

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

func (*TransportWs) ConnDuration added in v0.0.5

func (tr *TransportWs) ConnDuration() time.Duration

func (*TransportWs) Connect added in v0.0.5

func (tr *TransportWs) Connect(urlStr string, proxy string) *TransportWs

func (*TransportWs) Duration added in v0.0.5

func (tr *TransportWs) Duration() time.Duration

func (*TransportWs) ReadMessage added in v0.0.5

func (tr *TransportWs) ReadMessage(messageChan chan respChan, timeConn int)

func (*TransportWs) ReqDuration added in v0.0.5

func (tr *TransportWs) ReqDuration() time.Duration

func (*TransportWs) SendMessage added in v0.0.5

func (tr *TransportWs) SendMessage(message string) error

Jump to

Keyboard shortcuts

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