xhttpclient

package
v0.0.0-...-b4442d7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

README

用于 定时并发 发送HTTP数据

Documentation

Index

Constants

View Source
const (
	MaxIdleConns        int = 300
	MaxIdleConnsPerHost int = 300
	IdleConnTimeout     int = 90
)

计算理论距离时间

Variables

This section is empty.

Functions

func CacheDNS

func CacheDNS(domain string)

func CreateHTTPClient

func CreateHTTPClient() *http.Client

创建特定的 HTTP Client var testClient *http.Client

func CreateHttpTrace

func CreateHttpTrace(req *http.Request, client *http.Client) (time.Duration, time.Duration, error, []*http.Cookie)

func GetHttpRespBody

func GetHttpRespBody(initResp *http.Response, err error) ([]byte, error)

func ReadSetCookies

func ReadSetCookies(h http.Header) []*http.Cookie

Types

type ConnectManager

type ConnectManager struct {
	PreConnect          int   //15s 开始生成密钥
	TcpConnectTimeTotal int64 //15ms 计算常规往返时间 = meth not find 5次
	TcpGatewayTimeTotal int64
	TcpConnectTimeAvg   int64
	TcpGatewayTimeAvg   int64
	KeyAry              []string //密钥
	ClientNum           int
	CodeRunTime         int64
	CodeRunTimeSuccess  int64
	CodeRunTimeAvg      int64
	ClientAry           []*http.Client //for bill
	ClientTcp           []*http.Client
	Cookies             map[string]http.Cookie
	TlsCon              []*tls.Conn
	TlsMux              *sync.Mutex
	TlsUsed             int
	Ip                  string
	Yz_log_seqn         int
	ConnectIp           map[string]int
	// Client2             *http.Client
	// Client3             *http.Client
	// Client4             *http.Client
	// Client5             *http.Client
	// PreCalcTimeTotal int //5s 计算未开售时间1次 同时产生预处理连接
	// PreCalcCodeTimes int //计算成功次数
	// Cookie 目前待定
	Mux *sync.Mutex
}

func GetConnectManager

func GetConnectManager(PreNum int) ConnectManager

func (ConnectManager) CreateWaitRealTimeNano

func (cm ConnectManager) CreateWaitRealTimeNano(StartSoldTimeNano int64) (int64, int64)

func (ConnectManager) CreateWaitTimeNano

func (cm ConnectManager) CreateWaitTimeNano(StartSoldTimeNano int64) (int64, int64)

func (*ConnectManager) GetCookieString

func (cm *ConnectManager) GetCookieString() string

func (*ConnectManager) GetCookieStringForNewTime

func (cm *ConnectManager) GetCookieStringForNewTime() string

func (ConnectManager) GetCookieValue

func (cm ConnectManager) GetCookieValue(name string) string

func (*ConnectManager) GetTcpTime

func (cm *ConnectManager) GetTcpTime(url string) int64

计算出TCP连接耗时 nana

func (*ConnectManager) HttpSendAndRecv

func (cm *ConnectManager) HttpSendAndRecv(req *http.Request) ([]byte, time.Duration, string)

func (*ConnectManager) HttpSendAndRecvNewTcp

func (cm *ConnectManager) HttpSendAndRecvNewTcp(req *http.Request) ([]byte, time.Duration)

func (*ConnectManager) InitTcpSocket

func (cm *ConnectManager) InitTcpSocket(urlstr string, num int)

type GetCookie

type GetCookie struct {
	Name         string `json:"name"`
	Value        string `json:"value"`
	Domain       string `json:"domain"`
	Path         string `json:"path"`
	Expires      int    `json:"expires"`
	Size         int    `json:"size"`
	HTTPOnly     bool   `json:"httpOnly"`
	Secure       bool   `json:"secure"`
	Session      bool   `json:"session"`
	SameParty    bool   `json:"sameParty"`
	SourceScheme string `json:"sourceScheme"`
	SourcePort   int    `json:"sourcePort"`
}

To system Cookie?

func (GetCookie) GetCookieToCookie

func (c GetCookie) GetCookieToCookie() http.Cookie

Jump to

Keyboard shortcuts

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