Documentation ¶
Overview ¶
Description : 启动一个HTTP&HTTPs代理并拦截HTTP的数据包 Author : ManGe
Description : 启动一个socket5代理 Author : ManGe
Index ¶
- Constants
- Variables
- func AbPathByCaller() string
- func AccountRational(str string) bool
- func Any2Arr(data interface{}) []interface{}
- func Any2Float64(data interface{}) float64
- func Any2Int(data interface{}) int
- func Any2Json(data interface{}) (string, error)
- func Any2Map(data interface{}) map[string]interface{}
- func Any2String(data interface{}) string
- func Any2Strings(data interface{}) []string
- func Any2int64(data interface{}) int64
- func BIG5To(dstCharset string, src string) (dst string, err error)
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func Base64UrlDecode(str string) (string, error)
- func Base64UrlEncode(str string) string
- func BeginDayUnix() int64
- func Bit2Byte(b []uint8) []byte
- func Bool2Byte(b bool) []byte
- func Byte2Bit(b []byte) []uint8
- func Byte2Bool(b []byte) bool
- func Byte2Float32(b []byte) float32
- func Byte2Float64(b []byte) float64
- func Byte2Int(b []byte) int
- func Byte2Int64(b []byte) int64
- func Byte2Str(b []byte) string
- func ByteToBinaryString(data byte) (str string)
- func ByteToGBK(strBuf []byte) []byte
- func ByteToUTF8(strBuf []byte) []byte
- func CPUMax()
- func Chdir(dir string) error
- func CleaningStr(str string) string
- func ConvertByte2String(byte []byte, charset Charset) string
- func ConvertGBK2Str(gbkStr string) string
- func ConvertStr2GBK(str string) string
- func CopySlice(s []interface{}) []interface{}
- func CopySliceInt(s []int) []int
- func CopySliceInt64(s []int64) []int64
- func CopySliceStr(s []string) []string
- func DayAgo(i int) int64
- func Daydiff(beginDay string, endDay string) int
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func DecodeByte(b []byte) (interface{}, error)
- func DeepCopy(dst, src interface{}) error
- func EncodeByte(v interface{}) []byte
- func EndDayUnix() int64
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Exists(path string) bool
- func FileMd5(path string) (string, error)
- func FileMd5sum(fileName string) string
- func FileSizeFormat(fileSize int64) (size string)
- func Float322Byte(f float32) []byte
- func Float322Uint32(f float32) uint32
- func Float642Byte(f float64) []byte
- func Float642Uint64(f float64) uint64
- func GB18030To(dstCharset string, src string) (dst string, err error)
- func GB2312To(dstCharset string, src string) (dst string, err error)
- func GDKTo(dstCharset string, src string) (dst string, err error)
- func GetAgent(agentType UserAgentType) string
- func GetNowPath() string
- func GetWD() string
- func GzipCompress(src []byte) []byte
- func GzipDecompress(src []byte) []byte
- func HZGB2312To(dstCharset string, src string) (dst string, err error)
- func Hex2Int(s string) int
- func Hex2Int64(s string) int64
- func HmacMD5(str, key string) string
- func HmacSHA1(str, key string) string
- func HmacSHA256(str, key string) string
- func HmacSHA512(str, key string) string
- func HourAgo(i int) int64
- func HumanFriendlyTraffic(bytes uint64) string
- func IF(condition bool, a, b interface{}) interface{}
- func Info(args ...interface{})
- func InfoTimes(times int, args ...interface{})
- func Infof(format string, args ...interface{})
- func InfofTimes(format string, times int, args ...interface{})
- func Int2Byte(i int) []byte
- func Int2Hex(i int64) string
- func Int642Byte(i int64) []byte
- func Int642Hex(i int64) string
- func IsAllCapital(str string) bool
- func IsAllLower(str string) bool
- func IsBase64(str string) bool
- func IsChinese(str string) bool
- func IsChineseAll(str string) bool
- func IsChineseMoney(str string) bool
- func IsChineseN(str string, number int) bool
- func IsChineseNumber(str string) bool
- func IsContainStr(items []string, item string) bool
- func IsDNSName(str string) bool
- func IsDir(path string) bool
- func IsDomain(str string) bool
- func IsElementStr(listData []string, element string) bool
- func IsEngAll(str string) bool
- func IsEngLen(str string, l int) bool
- func IsEngNumber(str string) bool
- func IsFile(path string) bool
- func IsFloat(str string) bool
- func IsFloat2Len(str string, l int) bool
- func IsFullWidth(str string) bool
- func IsHalfWidth(str string) bool
- func IsHaveCapital(str string) bool
- func IsHaveLower(str string) bool
- func IsIP(str string) bool
- func IsIPv4(str string) bool
- func IsInSlice(s []interface{}, v interface{}) bool
- func IsLandline(str string) bool
- func IsLatitude(str string) bool
- func IsLeastCapital(str string, n int) bool
- func IsLeastLower(str string, n int) bool
- func IsLeastNumber(str string, n int) bool
- func IsLeastSpecial(str string, n int) bool
- func IsLongitude(str string) bool
- func IsNumber(str string) bool
- func IsNumber2Heard(str string, n int) bool
- func IsNumber2Len(str string, l int) bool
- func IsPhone(str string) bool
- func IsRGB(str string) bool
- func IsURL(str string) bool
- func IsUUID3(str string) bool
- func IsUUID4(str string) bool
- func IsUUID5(str string) bool
- func IsUnixPath(str string) bool
- func IsUtf8(buf []byte) bool
- func IsWindowsPath(str string) bool
- func IsXMLFile(str string) bool
- func Json2Map(str string) map[string]interface{}
- func JwtDecrypt(tokenString, secret string) (data map[string]interface{}, err error)
- func JwtEncrypt(data map[string]interface{}, secret, method string) (string, error)
- func JwtEncrypt256(data map[string]interface{}, secret string) (string, error)
- func JwtEncrypt384(data map[string]interface{}, secret string) (string, error)
- func JwtEncrypt512(data map[string]interface{}, secret string) (string, error)
- func MD5(str string) string
- func Map2Json(m map[string]interface{}) (string, error)
- func Map2Slice(data interface{}) []interface{}
- func MapCopy(data map[string]interface{}) (copy map[string]interface{})
- func MapMergeCopy(src ...map[string]interface{}) (copy map[string]interface{})
- func MapStr2Any(m map[string]string) map[string]interface{}
- func MinuteAgo(i int) int64
- func MongoConn()
- func MongoConn1()
- func NewCookiePool() *cookiePool
- func NewGDMap() *gDMap
- func NewMysqlDB(host string, port int, user, password, database string) (err error)
- func OSLine() string
- func P2E()
- func PBKDF2(str, salt []byte, iterations, keySize int) []byte
- func PanicToError(fn func()) (err error)
- func PathExists(path string)
- func Ping(ip string)
- func Pwd() string
- func ReadCsvFile(filename string) [][]string
- func RedisDELKeys(rds *Rds, keys string, jobNumber int)
- func RegBase64(str string, property ...string) []string
- func RegDNSName(str string, property ...string) []string
- func RegDelHtml(str string) string
- func RegDelHtmlA(str string) string
- func RegDelHtmlButton(str string, property ...string) string
- func RegDelHtmlCanvas(str string, property ...string) string
- func RegDelHtmlCode(str string, property ...string) string
- func RegDelHtmlH(str, typeH string, property ...string) string
- func RegDelHtmlHref(str string, property ...string) string
- func RegDelHtmlImg(str string, property ...string) string
- func RegDelHtmlInput(str string, property ...string) string
- func RegDelHtmlLi(str string, property ...string) string
- func RegDelHtmlMeta(str string, property ...string) string
- func RegDelHtmlP(str string, property ...string) string
- func RegDelHtmlSelect(str string, property ...string) string
- func RegDelHtmlSpan(str string, property ...string) string
- func RegDelHtmlSrc(str string, property ...string) string
- func RegDelHtmlTable(str string, property ...string) string
- func RegDelHtmlTbody(str string, property ...string) string
- func RegDelHtmlTd(str string, property ...string) string
- func RegDelHtmlTitle(str string) string
- func RegDelHtmlTr(str string) string
- func RegDelHtmlUl(str string, property ...string) string
- func RegDelHtmlVideo(str string, property ...string) string
- func RegDelNumber(str string) string
- func RegEmail(str string, property ...string) []string
- func RegEmail2(str string, property ...string) []string
- func RegFindAll(regStr, rest string) [][]string
- func RegFloat(str string, property ...string) []string
- func RegFullURL(str string, property ...string) []string
- func RegFullWidth(str string, property ...string) []string
- func RegGUID(str string, property ...string) []string
- func RegHalfWidth(str string, property ...string) []string
- func RegHtmlA(str string, property ...string) []string
- func RegHtmlATxt(str string, property ...string) []string
- func RegHtmlButton(str string, property ...string) []string
- func RegHtmlButtonTxt(str string, property ...string) []string
- func RegHtmlCanvas(str string, property ...string) []string
- func RegHtmlCode(str string, property ...string) []string
- func RegHtmlCodeTxt(str string, property ...string) []string
- func RegHtmlH(str, typeH string, property ...string) []string
- func RegHtmlHTxt(str, typeH string, property ...string) []string
- func RegHtmlHref(str string, property ...string) []string
- func RegHtmlHrefTxt(str string, property ...string) []string
- func RegHtmlImg(str string, property ...string) []string
- func RegHtmlInput(str string, property ...string) []string
- func RegHtmlInputTxt(str string, property ...string) []string
- func RegHtmlLi(str string, property ...string) []string
- func RegHtmlLiTxt(str string, property ...string) []string
- func RegHtmlMeta(str string, property ...string) []string
- func RegHtmlP(str string, property ...string) []string
- func RegHtmlPTxt(str string, property ...string) []string
- func RegHtmlSelect(str string, property ...string) []string
- func RegHtmlSelectTxt(str string, property ...string) []string
- func RegHtmlSpan(str string, property ...string) []string
- func RegHtmlSpanTxt(str string, property ...string) []string
- func RegHtmlSrc(str string, property ...string) []string
- func RegHtmlSrcTxt(str string, property ...string) []string
- func RegHtmlTable(str string, property ...string) []string
- func RegHtmlTableOlny(str string, property ...string) []string
- func RegHtmlTableTxt(str string, property ...string) []string
- func RegHtmlTbody(str string, property ...string) []string
- func RegHtmlTd(str string, property ...string) []string
- func RegHtmlTdTxt(str string, property ...string) []string
- func RegHtmlTitle(str string, property ...string) []string
- func RegHtmlTitleTxt(str string, property ...string) []string
- func RegHtmlTr(str string, property ...string) []string
- func RegHtmlTrTxt(str string, property ...string) []string
- func RegHtmlUl(str string, property ...string) []string
- func RegHtmlUlTxt(str string, property ...string) []string
- func RegHtmlVideo(str string, property ...string) []string
- func RegIP(str string, property ...string) []string
- func RegIPv4(str string, property ...string) []string
- func RegIPv6(str string, property ...string) []string
- func RegInt(str string, property ...string) []string
- func RegLatitude(str string, property ...string) []string
- func RegLink(str string, property ...string) []string
- func RegLongitude(str string, property ...string) []string
- func RegMACAddress(str string, property ...string) []string
- func RegMD5Hex(str string, property ...string) []string
- func RegRGBColor(str string, property ...string) []string
- func RegSHA1Hex(str string, property ...string) []string
- func RegSHA256Hex(str string, property ...string) []string
- func RegTime(str string, property ...string) []string
- func RegURLIP(str string, property ...string) []string
- func RegURLPath(str string, property ...string) []string
- func RegURLPort(str string, property ...string) []string
- func RegURLSchema(str string, property ...string) []string
- func RegURLSubdomain(str string, property ...string) []string
- func RegURLUsername(str string, property ...string) []string
- func RegUUID(str string, property ...string) []string
- func RegUUID3(str string, property ...string) []string
- func RegUUID4(str string, property ...string) []string
- func RegUUID5(str string, property ...string) []string
- func RegUnixPath(str string, property ...string) []string
- func RegWinPath(str string, property ...string) []string
- func ReplaceAllToOne(str string, from []string, to string) string
- func SSHClient(user string, pass string, addr string) (*ssh.Client, error)
- func SearchBytesIndex(bSrc []byte, b byte) int
- func SearchDomain(ip string)
- func SearchPort(ipStr string, vs ...interface{})
- func SetAgent(agentType UserAgentType, agent string)
- func SetLogFile(name string)
- func SetStatusCodeFailEvent(code int)
- func SetStatusCodeRetryEvent(code int)
- func SetStatusCodeSuccessEvent(code int)
- func Slice2Map(slice interface{}) map[string]interface{}
- func SliceCopy(data []interface{}) []interface{}
- func SliceTool() *sliceTool
- func SockerProxy(addr string)
- func StartJob(jobNumber int, queue TodoQueue, f func(task *Task))
- func StartJobGet(jobNumber int, queue TodoQueue, vs ...interface{})
- func StartJobPost(jobNumber int, queue TodoQueue, vs ...interface{})
- func Str2Byte(s string) []byte
- func Str2Float32(str string) float32
- func Str2Float64(str string) float64
- func Str2Int(str string) int
- func Str2Int32(str string) int32
- func Str2Int64(str string) int64
- func StrDeleteSpace(str string) string
- func StrDuplicates(a []string) []string
- func StrToSize(sizeStr string) int64
- func StringValue(i interface{}) string
- func StringValueMysql(i interface{}) string
- func Struct2Map(obj interface{}, hasValue bool) (map[string]interface{}, error)
- func Struct2Map2(obj interface{}) map[string]interface{}
- func TickerRun(t time.Duration, runFirst bool, f func())
- func Timestamp() string
- func ToBIG5(srcCharset string, src string) (dst string, err error)
- func ToGB18030(srcCharset string, src string) (dst string, err error)
- func ToGB2312(srcCharset string, src string) (dst string, err error)
- func ToGDK(srcCharset string, src string) (dst string, err error)
- func ToHZGB2312(srcCharset string, src string) (dst string, err error)
- func ToUTF16(srcCharset string, src string) (dst string, err error)
- func ToUTF8(srcCharset string, src string) (dst string, err error)
- func UTF16To(dstCharset string, src string) (dst string, err error)
- func UTF8To(dstCharset string, src string) (dst string, err error)
- func Uint82Str(bs []uint8) string
- func UnescapeUnicode(raw []byte) ([]byte, error)
- func UnicodeDec(raw string) string
- func UnicodeDecByte(raw []byte) []byte
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type AES
- type Bar
- type Charset
- type Context
- func Delete(url string, vs ...interface{}) (*Context, error)
- func Get(url string, vs ...interface{}) (*Context, error)
- func NewDelete(url string, vs ...interface{}) *Context
- func NewGet(url string, vs ...interface{}) *Context
- func NewOptions(url string, vs ...interface{}) *Context
- func NewPost(url string, data []byte, contentType string, vs ...interface{}) *Context
- func NewPostForm(u string, data map[string]string, vs ...interface{}) *Context
- func NewPut(url string, data []byte, contentType string, vs ...interface{}) *Context
- func NewRequest(url, method string, data []byte, contentType string, vs ...interface{}) *Context
- func Options(url string, vs ...interface{}) (*Context, error)
- func Post(url string, data []byte, contentType string, vs ...interface{}) (*Context, error)
- func PostFile(url, paramName, filePath string, vs ...interface{}) *Context
- func PostForm(url string, data map[string]string, vs ...interface{}) (*Context, error)
- func PostJson(url string, jsonStr string, vs ...interface{}) (*Context, error)
- func Put(url string, data []byte, contentType string, vs ...interface{}) (*Context, error)
- func Req(request *http.Request, vs ...interface{}) *Context
- func Request(url, method string, data []byte, contentType string, vs ...interface{}) (*Context, error)
- func Upload(url, savePath string, vs ...interface{}) (*Context, error)
- func (c *Context) AddCookie(k, v string) *Context
- func (c *Context) AddHeader(k, v string) *Context
- func (c *Context) AddParam(key string, val interface{})
- func (c *Context) CheckMd5() string
- func (c *Context) CheckReqMd5() string
- func (c *Context) CloseLog()
- func (c *Context) CloseRetry()
- func (c *Context) CookieNext() error
- func (c *Context) DelParam(key string)
- func (c *Context) Do() func()
- func (c *Context) GetParam(key string) interface{}
- func (c *Context) GetRespHeader() string
- func (c *Context) GetRetryTimes() int
- func (c *Context) OpenErr2Retry()
- func (c *Context) RespBodyArr() []interface{}
- func (c *Context) RespBodyHtml() string
- func (c *Context) RespBodyMap() map[string]interface{}
- func (c *Context) RespBodyString() string
- func (c *Context) RespContentLength() int64
- func (c *Context) SetFailedFunc(failedFunc func(c *Context)) *Context
- func (c *Context) SetProxy(proxyUrl string) *Context
- func (c *Context) SetProxyFunc(f func() *http.Transport) *Context
- func (c *Context) SetProxyPool(pool *ProxyPool) *Context
- func (c *Context) SetRetryFunc(retryFunc func(c *Context)) *Context
- func (c *Context) SetRetryTimes(times int) *Context
- func (c *Context) SetSleep(i int) *Context
- func (c *Context) SetSleepRand(min, max int) *Context
- func (c *Context) SetSucceedFunc(successFunc func(c *Context)) *Context
- func (c *Context) Upload(filePath string) func()
- type Cookie
- type Csv
- type DES
- type EndFunc
- type Err2Retry
- type FailedFunc
- type FormData
- type GDMapApi
- type Header
- type HttpPackage
- type Intercept
- type IsLog
- type Level
- type Mongo
- type Mysql
- func (m *Mysql) CloseLog()
- func (m *Mysql) Conn() (err error)
- func (m *Mysql) Delete(sql string) error
- func (m *Mysql) DeleteTable(tableName string) error
- func (m *Mysql) Describe(table string) (*tableDescribe, error)
- func (m *Mysql) Exec(sql string) error
- func (m *Mysql) GetFieldList(table string) (fieldList []string)
- func (m *Mysql) HasTable(tableName string) bool
- func (m *Mysql) Insert(table string, fieldData map[string]interface{}) error
- func (m *Mysql) InsertAt(table string, fieldData map[string]interface{}) error
- func (m *Mysql) InsertAtGd(table string, fieldData *gDMap) error
- func (m *Mysql) InsertAtJson(table, jsonStr string) error
- func (m *Mysql) IsHaveTable(table string) bool
- func (m *Mysql) NewTable(table string, fields map[string]string) error
- func (m *Mysql) NewTableGd(table string, fields *gDMap) error
- func (m *Mysql) Query(sql string) ([]map[string]string, error)
- func (m *Mysql) Select(sql string) ([]map[string]string, error)
- func (m *Mysql) SetMaxIdleConn(number int)
- func (m *Mysql) SetMaxOpenConn(number int)
- func (m *Mysql) ToVarChar(data interface{}) string
- func (m *Mysql) ToXls(sql, outPath string)
- func (m *Mysql) Update(sql string) error
- type ProxyIP
- type ProxyPool
- type ProxyUrl
- type Queue
- type Rds
- type ReqTimeOut
- type ReqTimeOutMs
- type ReqUrl
- type RetryFunc
- type RetryTimes
- type SSHConnInfo
- type Set
- type Sleep
- type Stack
- type StartFunc
- type StressUrl
- type SucceedFunc
- type TableInfo
- type Task
- type TcpClient
- func (c *TcpClient) Addr() string
- func (c *TcpClient) Close()
- func (c *TcpClient) ReConn()
- func (c *TcpClient) Read(b []byte) (int, error)
- func (c *TcpClient) Run(serverHost string, r func(c *TcpClient, data []byte), w func(c *TcpClient))
- func (c *TcpClient) Send(b []byte) (int, error)
- func (c *TcpClient) Stop()
- type TodoQueue
- type UdpClient
- type UploadQueue
- type UserAgentType
- type WSClient
Constants ¶
const ( CBC = "CBC" ECB = "ECB" CFB = "CFB" CTR = "CTR" )
const ( POST = "POST" GET = "GET" HEAD = "HEAD" PUT = "PUT" DELETE = "DELETE" PATCH = "PATCH" OPTIONS = "OPTIONS" ANY = "" )
const ( UTF8 = Charset("UTF-8") GB18030 = Charset("GB18030") GBK = Charset("GBK") GB2312 = Charset("GB2312") )
const ( KiB = 1024 MiB = KiB * 1024 GiB = MiB * 1024 TiB = GiB * 1024 )
字节换算
Variables ¶
var ( SHOW_TABLES = "SHOW TABLES" TABLE_NAME_NULL = fmt.Errorf("table name is null.") TABLE_IS_NULL = fmt.Errorf("table is null.") )
var ( ChineseNumber = []string{"一", "二", "三", "四", "五", "六", "七", "八", "九", "零"} ChineseMoney = []string{"壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"} ChineseMoneyAll = []string{"壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾", "佰", "仟", "万", "亿", "元", "角", "分", "零", "整", "正", "貳", "陸", "億", "萬", "圓"} )
var ( UrlBad = errors.New("url is bad.") // 错误的url UrlNil = errors.New("url is null.") // 空的url )
var AgentType = map[UserAgentType][]int{ PCAgent: listPCAgent, WindowsAgent: listWindowsAgent, LinuxAgent: listLinuxAgent, MacAgent: listMacAgent, AndroidAgent: listAndroidAgent, IosAgent: listIosAgent, PhoneAgent: listPhoneAgent, WindowsPhoneAgent: listWindowsPhoneAgent, UCAgent: listUCAgent, }
var ContentType map[string]string = map[string]string{}/* 315 elements not displayed */
var CookiePool *cookiePool
var LevelMap = map[Level]string{
1: "Info ",
2: "Debug ",
3: "Warn ",
4: "Error ",
}
var MysqlDB = &Mysql{}
var StatusCodeMap map[int]string = map[int]string{
200: "success",
201: "success",
202: "success",
203: "success",
204: "fail",
300: "success",
301: "success",
302: "success",
400: "fail",
401: "retry",
402: "retry",
403: "retry",
404: "fail",
405: "retry",
406: "retry",
407: "retry",
408: "retry",
412: "success",
500: "fail",
501: "fail",
502: "retry",
503: "retry",
504: "retry",
}
StatusCodeMap 状态码处理映射 success 该状态码对应执行成功函数 fail 该状态码对应执行失败函数 retry 该状态码对应需要重试前执行的函数
var UserAgentMap map[int]string = map[int]string{
1: "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0",
2: "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36",
3: "Mozilla/5.0 (compatible; WOW64; MSIE 10.0; Windows NT 6.2)",
4: "Opera/9.80 (Windows NT 6.1; WOW64; U; en) Presto/2.10.229 Version/11.62",
5: "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
6: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20130331 Firefox/21.0",
7: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36",
8: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
9: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.9.168 Version/11.52",
10: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
11: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0",
12: "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",
13: "Mozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
14: "Mozilla/5.0 (Linux; U; Android 2.2; en-gb; GT-P1000 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
15: "Mozilla/5.0 (Android; Mobile; rv:14.0) Gecko/14.0 Firefox/14.0",
16: "Mozilla/5.0 (Android; Tablet; rv:14.0) Gecko/14.0 Firefox/14.0",
17: "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
18: "Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",
19: "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
20: "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
21: "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
22: "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
23: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_4 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/27.0.1453.10 Mobile/10B350 Safari/8536.25",
24: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
25: "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)",
26: "User-Agent, UCWEB7.0.2.37/28/999",
27: "User-Agent, NOKIA5700/ UCWEB7.0.2.37/28/999",
28: "User-Agent, Openwave/ UCWEB7.0.2.37/28/999",
29: "User-Agent, Mozilla/4.0 (compatible; MSIE 6.0; ) Opera/UCWEB7.0.2.37/28/999",
30: "Mozilla/5.0 (Windows; U; Windows NT 6.1; ) AppleWebKit/534.12 (KHTML, like Gecko) Maxthon/3.0 Safari/534.12",
31: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)",
32: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; SE 2.X MetaSr 1.0)",
33: "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.33 Safari/534.3 SE 2.X MetaSr 1.0",
34: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)",
35: "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1 QQBrowser/6.9.11079.201",
}
Functions ¶
func AbPathByCaller ¶ added in v0.3.5
func AbPathByCaller() string
AbPathByCaller 获取当前执行文件绝对路径(go run)
func Any2Arr ¶ added in v0.1.17
func Any2Arr(data interface{}) []interface{}
Any2Arr interface{} -> []interface{}
func Any2Float64 ¶ added in v0.0.10
func Any2Float64(data interface{}) float64
Any2Float64 interface{} -> float64
func Any2Map ¶ added in v0.0.10
func Any2Map(data interface{}) map[string]interface{}
Any2Map interface{} -> map[string]interface{}
func Any2String ¶ added in v0.0.10
func Any2String(data interface{}) string
Any2String interface{} -> string
func Any2Strings ¶ added in v0.0.10
func Any2Strings(data interface{}) []string
Any2Strings interface{} -> []string
func Any2int64 ¶ added in v0.0.10
func Any2int64(data interface{}) int64
Any2int64 interface{} -> int64
func Base64Decode ¶ added in v0.1.4
Base64Decode base64 解码
func Base64UrlDecode ¶ added in v0.1.4
Base64UrlDecode base64 url 解码
func Base64UrlEncode ¶ added in v0.1.4
Base64UrlEncode base64 url 编码
func Byte2Float32 ¶ added in v0.2.8
Byte2Float32 []byte -> float32
func Byte2Float64 ¶ added in v0.2.8
Byte2Float64 []byte -> float64
func ByteToBinaryString ¶ added in v0.1.4
ByteToBinaryString 字节 -> 二进制字符串
func ByteToUTF8 ¶ added in v0.3.5
ByteToUTF8 byte -> utf8 byte
func CleaningStr ¶ added in v0.0.11
CleaningStr 清理字符串前后空白 和回车 换行符号
func ConvertByte2String ¶ added in v0.1.4
ConvertByte2String 编码转换
func ConvertGBK2Str ¶ added in v0.3.5
ConvertGBK2Str 将GBK编码的字符串转换为utf-8编码
func ConvertStr2GBK ¶ added in v0.3.5
ConvertStr2GBK 将utf-8编码的字符串转换为GBK编码
func DecodeByte ¶ added in v0.2.8
DecodeByte decode byte
func FileSizeFormat ¶ added in v0.1.1
FileSizeFormat 字节的单位转换 保留两位小数
func Float322Byte ¶ added in v0.2.8
Float322Byte float32 -> []byte
func Float322Uint32 ¶ added in v0.2.8
Float322Uint32 float32 -> uint32
func Float642Byte ¶ added in v0.2.8
Float642Byte float64 -> []byte
func Float642Uint64 ¶ added in v0.2.8
Float642Uint64 float64 -> uint64
func GetAgent ¶ added in v0.0.4
func GetAgent(agentType UserAgentType) string
GetAgent 随机获取那种类型的 user-agent
func HZGB2312To ¶ added in v0.2.8
HZGB2312To
func HumanFriendlyTraffic ¶ added in v0.2.4
HumanFriendlyTraffic
func IF ¶ added in v0.1.12
func IF(condition bool, a, b interface{}) interface{}
IF 三元表达式 use: IF(a>b, a, b).(int)
func InfofTimes ¶ added in v0.3.1
func IsChineseMoney ¶ added in v0.2.4
IsChineseMoney 验证是否是中文钱大写
func IsChineseN ¶ added in v0.2.4
IsChineseN 验证是否含有number个汉字
func IsChineseNumber ¶ added in v0.2.4
IsChineseNumber 验证是否全是汉字数字
func IsContainStr ¶ added in v0.1.4
IsContainStr 字符串是否等于items中的某个元素
func IsElementStr ¶ added in v0.1.9
IsElementStr 判断字符串是否与数组里的某个字符串相同
func IsFloat2Len ¶ added in v0.2.4
IsFloat2Len 验证是否含有带不超过len个小数的小数
func IsIP ¶ added in v0.2.4
IsIP IP地址:((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
func IsLandline ¶ added in v0.2.4
IsLandline 验证电话号码("XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX):
func IsLeastCapital ¶ added in v0.2.4
IsLeastCapital 验证不低于n个大写字母
func IsLeastLower ¶ added in v0.2.4
IsLeastLower 验证不低于n个小写字母
func IsLeastNumber ¶ added in v0.2.4
IsLeastNumber 验证不低于n个数字
func IsLeastSpecial ¶ added in v0.2.4
IsLeastSpecial 验证不低于n特殊字符
func IsNumber2Heard ¶ added in v0.2.4
IsNumber2Heard 验证是否含有n开头的number
func IsNumber2Len ¶ added in v0.2.4
IsNumber2Len 验证是否含有连续长度不超过长度l的number
func JwtDecrypt ¶ added in v0.2.7
JwtDecrypt
func JwtEncrypt ¶ added in v0.2.7
JwtEncrypt
func JwtEncrypt256 ¶ added in v0.2.7
JwtEncrypt256
func JwtEncrypt384 ¶ added in v0.2.7
JwtEncrypt384
func JwtEncrypt512 ¶ added in v0.2.7
JwtEncrypt512
func Map2Slice ¶ added in v0.2.8
func Map2Slice(data interface{}) []interface{}
Map2Slice Eg: {"K1": "v1", "K2": "v2"} => ["K1", "v1", "K2", "v2"]
func MapMergeCopy ¶ added in v0.2.8
func MapStr2Any ¶ added in v0.2.4
MapStr2Any map[string]string -> map[string]interface{}
func MongoConn1 ¶ added in v0.1.4
func MongoConn1()
func NewCookiePool ¶ added in v0.2.4
func NewCookiePool() *cookiePool
func NewMysqlDB ¶ added in v0.0.11
NewMysqlDB 给mysql对象进行连接
func PanicToError ¶ added in v0.1.3
func PanicToError(fn func()) (err error)
PanicToError panic -> error
func ReadCsvFile ¶ added in v0.1.4
ReadCsvFile csv file -> [][]string 行列
func RegDNSName ¶ added in v0.3.4
RegDNSName 提取dns
func RegDelHtmlA ¶ added in v0.2.7
func RegDelHtmlButton ¶ added in v0.2.7
func RegDelHtmlCanvas ¶ added in v0.2.7
func RegDelHtmlCode ¶ added in v0.2.7
func RegDelHtmlH ¶ added in v0.2.7
func RegDelHtmlHref ¶ added in v0.2.7
func RegDelHtmlImg ¶ added in v0.2.7
func RegDelHtmlInput ¶ added in v0.2.7
func RegDelHtmlLi ¶ added in v0.2.7
func RegDelHtmlMeta ¶ added in v0.2.7
func RegDelHtmlP ¶ added in v0.2.7
func RegDelHtmlSelect ¶ added in v0.2.7
func RegDelHtmlSpan ¶ added in v0.2.7
func RegDelHtmlSrc ¶ added in v0.2.7
func RegDelHtmlTable ¶ added in v0.2.7
func RegDelHtmlTbody ¶ added in v0.2.7
func RegDelHtmlTd ¶ added in v0.2.7
func RegDelHtmlTitle ¶ added in v0.2.7
func RegDelHtmlTr ¶ added in v0.2.7
func RegDelHtmlUl ¶ added in v0.2.7
func RegDelHtmlVideo ¶ added in v0.2.7
func RegFindAll ¶ added in v0.1.1
func RegFullURL ¶ added in v0.3.4
RegFullURL 提取url
func RegFullWidth ¶ added in v0.3.4
RegFullWidth 提取全角字符
func RegHalfWidth ¶ added in v0.3.4
RegHalfWidth 提取半角字符
func RegHtmlATxt ¶ added in v0.1.4
func RegHtmlButton ¶ added in v0.2.1
func RegHtmlButtonTxt ¶ added in v0.2.1
func RegHtmlCanvas ¶ added in v0.2.1
func RegHtmlCode ¶ added in v0.2.1
func RegHtmlCodeTxt ¶ added in v0.2.1
func RegHtmlHTxt ¶ added in v0.1.4
func RegHtmlHref ¶ added in v0.1.4
func RegHtmlHrefTxt ¶ added in v0.1.4
func RegHtmlImg ¶ added in v0.2.1
func RegHtmlInput ¶ added in v0.1.1
func RegHtmlInputTxt ¶ added in v0.1.4
func RegHtmlLiTxt ¶ added in v0.2.1
func RegHtmlMeta ¶ added in v0.2.1
func RegHtmlPTxt ¶ added in v0.1.4
func RegHtmlSelect ¶ added in v0.2.1
func RegHtmlSelectTxt ¶ added in v0.2.1
func RegHtmlSpan ¶ added in v0.1.1
func RegHtmlSpanTxt ¶ added in v0.1.4
func RegHtmlSrc ¶ added in v0.1.4
func RegHtmlSrcTxt ¶ added in v0.1.4
func RegHtmlTable ¶ added in v0.2.1
func RegHtmlTableOlny ¶ added in v0.3.5
func RegHtmlTableTxt ¶ added in v0.2.1
func RegHtmlTbody ¶ added in v0.1.9
func RegHtmlTdTxt ¶ added in v0.1.4
func RegHtmlTitle ¶ added in v0.1.1
func RegHtmlTitleTxt ¶ added in v0.1.4
func RegHtmlTrTxt ¶ added in v0.1.4
func RegHtmlUlTxt ¶ added in v0.2.1
func RegHtmlVideo ¶ added in v0.2.1
func RegLatitude ¶ added in v0.3.4
RegLatitude 提取纬度
func RegLongitude ¶ added in v0.3.4
RegLongitude 提取经度
func RegMACAddress ¶ added in v0.2.4
RegMACAddress 提取MACAddress
func RegRGBColor ¶ added in v0.3.4
RegRGBColor 提取RGB值
func RegSHA1Hex ¶ added in v0.2.4
RegSHA1Hex 提取sha1
func RegSHA256Hex ¶ added in v0.2.4
RegSHA256Hex 提取sha256
func RegURLPath ¶ added in v0.3.4
RegURLPath 提取url path
func RegURLPort ¶ added in v0.3.4
RegURLPort 提取url port
func RegURLSchema ¶ added in v0.3.4
RegURLSchema 提取url schema
func RegURLSubdomain ¶ added in v0.3.4
RegURLSubdomain 提取 url sub domain
func RegURLUsername ¶ added in v0.3.4
RegURLUsername 提取url username
func RegUnixPath ¶ added in v0.3.4
RegUnixPath 提取 unix路径
func RegWinPath ¶ added in v0.3.4
RegWinPath 提取 windows路径
func ReplaceAllToOne ¶ added in v0.2.1
ReplaceAllToOne 批量统一替换字符串
func SSHClient ¶ added in v0.1.1
SSHClient 连接ssh addr : 主机地址, 如: 127.0.0.1:22 user : 用户 pass : 密码 返回 ssh连接
func SearchBytesIndex ¶ added in v0.1.18
SearchBytesIndex []byte 字节切片 循环查找
func SearchDomain ¶ added in v0.1.4
func SearchDomain(ip string)
func SetAgent ¶ added in v0.1.9
func SetAgent(agentType UserAgentType, agent string)
func SetLogFile ¶ added in v0.2.8
func SetLogFile(name string)
func SetStatusCodeRetryEvent ¶ added in v0.1.5
func SetStatusCodeRetryEvent(code int)
将指定状态码设置为执行重试事件
func SetStatusCodeSuccessEvent ¶ added in v0.1.5
func SetStatusCodeSuccessEvent(code int)
将指定状态码设置为执行成功事件
func Slice2Map ¶ added in v0.2.8
func Slice2Map(slice interface{}) map[string]interface{}
Slice2Map ["K1", "v1", "K2", "v2"] => {"K1": "v1", "K2": "v2"} ["K1", "v1", "K2"] => nil
func SockerProxy ¶ added in v0.3.5
func SockerProxy(addr string)
func StartJobGet ¶ added in v0.0.7
StartJobGet 并发执行Get,直到队列任务为空 jobNumber 并发数, queue 全局队列,
func StartJobPost ¶ added in v0.0.7
StartJobPost 开始运行并发Post
func Str2Float32 ¶ added in v0.2.9
Str2Float32 string -> float32
func Str2Float64 ¶ added in v0.1.1
Str2Float64 string -> float64
func StrDeleteSpace ¶ added in v0.0.11
StrDeleteSpace 删除字符串前后的空格
func StrDuplicates ¶ added in v0.2.4
StrDuplicates 数组,切片去重和去空串
func StringValueMysql ¶ added in v0.1.12
func StringValueMysql(i interface{}) string
StringValueMysql 用于mysql字符拼接使用
func Struct2Map ¶ added in v0.1.3
Struct2Map Struct -> map hasValue=true表示字段值不管是否存在都转换成map hasValue=false表示字段为空或者不为0则转换成map
func Struct2Map2 ¶ added in v0.3.5
func Struct2Map2(obj interface{}) map[string]interface{}
Struct2Map2 struct -> map
func ToHZGB2312 ¶ added in v0.2.8
ToHZGB2312
func UnescapeUnicode ¶ added in v0.1.4
UnescapeUnicode Unicode 转码
Types ¶
type AES ¶ added in v0.1.18
type Bar ¶ added in v0.2.9
type Bar struct {
// contains filtered or unexported fields
}
cli 进度条
func (*Bar) NewOptionWithGraph ¶ added in v0.2.9
type Charset ¶ added in v0.1.4
type Charset string
============================================ 转码 Charset 字符集类型
type Context ¶ added in v0.0.7
type Context struct { // Token Token string // http client Client *http.Client // http Request Req *http.Request // http Response Resp *http.Response // Error Err error // Ctx context.Context Ctx context.Context // 最大允许重试次数 MaxTimes RetryTimes // 请求成功了需要处理的事件 SucceedFunc SucceedFunc // 请求失败了需要做的事 FailedFunc FailedFunc // 请求状态码设置了重试,在重试前的事件 RetryFunc RetryFunc // 请求开始前的方法 StartFunc StartFunc // 请求完成后的方法 EndFunc EndFunc // 本次请求的任务 // 用于有步骤的请求和并发执行请求 Task *Task // 请求返回的结果 RespBody []byte // job编号 // 在执行多并发执行抓取任务,每个并发都有一个编号 // 这个编号是递增分配的 JobNumber int // 请求的响应时间 单位ms Ms time.Duration // 是否显示日志, 默认是显示的 IsLog IsLog // 输出字符串 Text string // 输出Json Json string // 输出xml Xml string // 输出HTML Html string // 请求上下文参数 Param map[string]interface{} // contains filtered or unexported fields }
Context 请求上下文
func NewOptions ¶ added in v0.1.9
func NewPostForm ¶ added in v0.2.7
func NewRequest ¶ added in v0.1.9
NewRequest 请求
func Request ¶ added in v0.0.7
func Request(url, method string, data []byte, contentType string, vs ...interface{}) (*Context, error)
Request 请求
func (*Context) CheckReqMd5 ¶ added in v0.1.9
CheckReqMd5 check req Md5
func (*Context) GetRespHeader ¶ added in v0.2.9
GetRespHeader
func (*Context) GetRetryTimes ¶ added in v0.3.4
GetRetryTimes 获取当前重试次数
func (*Context) OpenErr2Retry ¶ added in v0.1.6
func (c *Context) OpenErr2Retry()
OpenErr2Retry 开启请求失败都执行retry
func (*Context) RespBodyArr ¶ added in v0.1.12
func (c *Context) RespBodyArr() []interface{}
RespBodyArr Body -> Arr
func (*Context) RespBodyHtml ¶ added in v0.2.8
RespBodyHtml Body -> html string
func (*Context) RespBodyMap ¶ added in v0.1.12
RespBodyMap Body -> Map
func (*Context) RespBodyString ¶ added in v0.1.9
RespBodyString Body -> String
func (*Context) RespContentLength ¶ added in v0.2.9
RespContentLength
func (*Context) SetFailedFunc ¶ added in v0.0.7
SetFailedFunc 设置错误后的方法
func (*Context) SetProxyFunc ¶ added in v0.1.14
SetProxyFunc set proxy func
func (*Context) SetProxyPool ¶ added in v0.3.1
SetProxy set proxy
func (*Context) SetRetryFunc ¶ added in v0.0.7
SetRetryFunc 设置重试,在重试前的方法
func (*Context) SetRetryTimes ¶ added in v0.0.7
SetRetryTimes 设置重试次数
func (*Context) SetSleepRand ¶ added in v0.3.4
SetSleepRand 设置延迟随机时间
func (*Context) SetSucceedFunc ¶ added in v0.0.7
SetSucceedFunc 设置成功后的方法
type DES ¶ added in v0.1.18
type GDMapApi ¶ added in v0.2.4
type GDMapApi interface { Add(key string, value interface{}) *gDMap Get(key string) interface{} Del(key string) *gDMap Len() int KeyList() []string AddMap(data map[string]interface{}) *gDMap Range(f func(k string, v interface{})) *gDMap RangeAt(f func(id int, k string, v interface{})) *gDMap CheckValue(value interface{}) bool // 检查是否存在某个值 Reverse() //反序 }
GDMapApi 固定顺序 Map 接口
type HttpPackage ¶ added in v0.3.4
func (*HttpPackage) Html ¶ added in v0.3.4
func (pack *HttpPackage) Html() string
func (*HttpPackage) Img2Base64 ¶ added in v0.3.4
func (pack *HttpPackage) Img2Base64() string
如果数据类型是image 就转换成base64的图片输出
func (*HttpPackage) Json ¶ added in v0.3.4
func (pack *HttpPackage) Json() string
func (*HttpPackage) SaveImage ¶ added in v0.3.4
func (pack *HttpPackage) SaveImage(path string) error
func (*HttpPackage) ToFile ¶ added in v0.3.5
func (pack *HttpPackage) ToFile(path string) error
func (*HttpPackage) Txt ¶ added in v0.3.5
func (pack *HttpPackage) Txt() string
type Intercept ¶ added in v0.3.4
type Intercept struct { Ip string HttpPackageFunc func(pack *HttpPackage) }
func (*Intercept) RunHttpIntercept ¶ added in v0.3.4
func (ipt *Intercept) RunHttpIntercept()
type Mongo ¶ added in v0.1.4
type Mongo struct { User string Password string Host string Port string Conn *mongo.Client Database *mongo.Database Collection *mongo.Collection MaxPoolSize int TimeOut time.Duration }
func (*Mongo) GetCollection ¶ added in v0.1.4
连接mongodb 的db的集合 dbname:DB名; name:集合名
type Mysql ¶ added in v0.0.9
func GetMysqlDBConn ¶ added in v0.1.3
GetMysqlDBConn 获取mysql 连接
func (*Mysql) DeleteTable ¶ added in v0.2.9
DeleteTable 删除表
func (*Mysql) GetFieldList ¶ added in v0.3.4
GetFieldList 获取表字段
func (*Mysql) InsertAtGd ¶ added in v0.2.7
InsertAtGd 固定顺序map写入
func (*Mysql) InsertAtJson ¶ added in v0.3.4
InsertAtJson json字符串存入数据库
func (*Mysql) IsHaveTable ¶ added in v0.1.17
IsHaveTable 表是否存在
func (*Mysql) NewTableGd ¶ added in v0.2.7
NewTableGd 创建新的固定map顺序为字段的表
func (*Mysql) SetMaxIdleConn ¶ added in v0.1.11
SetMaxIdleConn
func (*Mysql) SetMaxOpenConn ¶ added in v0.1.11
SetMaxOpenConn
type ProxyPool ¶ added in v0.3.1
type ProxyPool struct {
// contains filtered or unexported fields
}
代理池
func NewProxyPool ¶ added in v0.3.1
func NewProxyPool() *ProxyPool
type Rds ¶ added in v0.1.2
type Rds struct { SSHUser string SSHPassword string SSHAddr string RedisHost string RedisPost string RedisPassword string // redis DB RedisDB int // 单个连接 Conn redis.Conn // 最大闲置数,用于redis连接池 RedisMaxIdle int // 最大连接数 RedisMaxActive int // 单条连接Timeout RedisIdleTimeoutSec int // 连接池 Pool *redis.Pool }
func NewRedisPool ¶ added in v0.1.2
type ReqTimeOut ¶ added in v0.0.7
type ReqTimeOut int
type ReqTimeOutMs ¶ added in v0.0.7
type ReqTimeOutMs int
type SSHConnInfo ¶ added in v0.1.2
func NewSSHInfo ¶ added in v0.1.2
func NewSSHInfo(addr, user, password string) *SSHConnInfo
type Set ¶ added in v0.1.4
type Set map[string]struct{}
================================================ Set 集合 可以用于去重
type Sleep ¶ added in v0.2.4
func SetSleepMs ¶ added in v0.2.4
type Stack ¶ added in v0.1.4
type Stack struct {
// contains filtered or unexported fields
}
================================================ Stack 栈
type StressUrl ¶ added in v0.0.7
type StressUrl struct { Url string Method string Sum int64 Total int TQueue TodoQueue // 接口传入的json JsonData string // 接口传入类型 ContentType string // contains filtered or unexported fields }
StressUrl 压力测试一个url
func NewTestUrl ¶ added in v0.0.7
NewTestUrl 实例化一个新的url压测
type TableInfo ¶ added in v0.0.9
type TableInfo struct { Field string Type string Null string Key string Default interface{} Extra string }
表信息
type Task ¶ added in v0.0.5
type Task struct { Url string JsonParam string HeaderMap *http.Header Data map[string]interface{} // 上下文传递的数据 Urls []*ReqUrl // 多步骤使用 Type string // "", "upload", "do" SavePath string SaveDir string FileName string // contains filtered or unexported fields }
任务对象
func CrawlerTask ¶ added in v0.1.3
CrawlerTask
func (Task) GetDataStr ¶ added in v0.1.12
type TcpClient ¶ added in v0.2.9
type TcpClient struct { Connection *net.TCPConn HawkServer *net.TCPAddr StopChan chan struct{} CmdChan chan string Token string RConn chan struct{} }
TcpClient Tcp客户端
func NewTcpClient ¶ added in v0.2.9
func NewTcpClient() *TcpClient
type TodoQueue ¶ added in v0.0.4
type UdpClient ¶ added in v0.2.9
UdpClient Udp客户端
func NewUdpClient ¶ added in v0.2.9
func NewUdpClient() *UdpClient
type UploadQueue ¶ added in v0.1.1
type UploadQueue struct {
// contains filtered or unexported fields
}
下载队列
func (*UploadQueue) Clear ¶ added in v0.1.1
func (q *UploadQueue) Clear() bool
func (*UploadQueue) IsEmpty ¶ added in v0.1.1
func (q *UploadQueue) IsEmpty() bool
func (*UploadQueue) Print ¶ added in v0.1.1
func (q *UploadQueue) Print()
func (*UploadQueue) Size ¶ added in v0.1.1
func (q *UploadQueue) Size() int
type UserAgentType ¶ added in v0.0.4
type UserAgentType int
const ( PCAgent UserAgentType = iota + 1 WindowsAgent LinuxAgent MacAgent AndroidAgent IosAgent PhoneAgent WindowsPhoneAgent UCAgent )