Documentation ¶
Index ¶
- Variables
- func BeginOfMonth() (firstDayOfMonth time.Time)
- func Cidr2Range(cidr string) (ipStart string, ipEnd string)
- func Combinations(list Replacer, selectNum int, repeatable bool, bufSize int) (c chan Replacer)
- func ConvertToStruct(in, out interface{}) (err error)
- func Crc32(str string) (hexValue string)
- func Date(format string, timestamps ...int64) (formatDate string)
- func Datetime2Ts(layout, timeString string) (timestamp int64, err error)
- func DiffDayNum(startDay string, endDay string) (dayNum int)
- func FakeIP(location string) (ip string)
- func FormatTime(t time.Duration) (formatTime string)
- func GetCidrHostNum(maskLen int) (ipNum uint)
- func GetResponseText(resp *http.Response) (string, error)
- func HTTPBuildQuery(queryArr map[string]string) (queryString string)
- func HTTPRawViaProxy(protocol, host, port, raw, proxy string, timeout int) (response *http.Response, err error)
- func HTTPViaProxy(method, url, data, proxy string, timeout int, headers *http.Header, ...) (response *http.Response, err error)
- func HmacSha1(key, str string) (hexValue string)
- func IP2Int(ip string) int64
- func InArray(obj interface{}, target interface{}) bool
- func Int2IP(ip int64) string
- func IntVal(val interface{}) (output int)
- func Md5(str string) (hexValue string)
- func NewRand() *rand.Rand
- func Now() time.Time
- func Permutations(list Replacer, selectNum int, repeatable bool, bufSize int) (c chan Replacer)
- func QueryStringToMap(query string) (ret map[string]string, err error)
- func RandIPInCidr(cidr string) (ip string)
- func RandIPInRange(minIP, maxIP string) (ip string)
- func RandString(letters string, n int) string
- func Round(num float64, precise int) (output float64)
- func Sha256(str string) (hexValue string)
- func Shuffle(vals []int) (randList *[]int)
- func SortToQS(data map[string]string) (sortedQueryString string)
- func Str2Time(str string) int64
- func StrLen(str string) int
- func StrVal(val interface{}) (output string)
- func Time() int64
- func Today() (zeroOclock time.Time)
- type Float64Replacer
- type IntReplacer
- type Replacer
- type RuneReplacer
- type StringReplacer
Constants ¶
This section is empty.
Variables ¶
var ChinaIP = map[string][]string{}/* 370 elements not displayed */
ChinaIP 表示中国各省市IP段(省全,市不全)
var CityCode = map[string]string{}/* 3508 elements not displayed */
CityCode 为城市编码和城市映射表
Functions ¶
func Cidr2Range ¶
Cidr2Range 将cidr类型的地址转换成IP地址段表示
func Combinations ¶
Combinations 组合数生成器 @list: 元素列表 @selectNum: 生成的组合数长度 @repeatable: 是否允许重复元素 @bufSize: 消息通道缓存大小
func ConvertToStruct ¶
func ConvertToStruct(in, out interface{}) (err error)
ConvertToStruct 通过json序列化反序列化的方式转换不同结构体 @in: 待转换的结构体 @out: 转换后的结构体
func Date ¶
Date 格式化字符串 @timestamp: 时间戳 例1:Y-m-d 返回2017-08-24 例2:y年m月d日 返回 17年08月24日 例3:H:i:s 返回 17:04:57
func Datetime2Ts ¶
Datetime2Ts 将时间格式字符串转换为时间戳 @layout: 参考 "2006-01-02 15:04:05" 这个值做格式变换 @timeString: 时间戳字符串
func DiffDayNum ¶
DiffDayNum 计算两个日期之间差多少天
func GetCidrHostNum ¶
GetCidrHostNum 计算得到CIDR地址范围内可拥有的主机数量
func GetResponseText ¶
GetResponseText 从响应结构体中获取文本字符串,包括自动处理gzip
func HTTPBuildQuery ¶
HTTPBuildQuery 将map转换为url查询参数形式
func HTTPRawViaProxy ¶
func HTTPRawViaProxy(protocol, host, port, raw, proxy string, timeout int) (response *http.Response, err error)
HTTPRawViaProxy 用于发送原始报文 @protocol: http 或 https @host: 主机IP或域名 @port: 端口 @raw: burpsuite之类的工具抓到的原始报文 @proxy: 指定代理,格式为 type://host:port, 例如: socks5://127.0.0.1:1080, 无代理则传入空字符串 @timeout: 超时时间,请求并发量较大时,timeout最好大一点
func HTTPViaProxy ¶
func HTTPViaProxy(method, url, data, proxy string, timeout int, headers *http.Header, cookie *http.Cookie) (response *http.Response, err error)
HTTPViaProxy 通过proxy发包,支持socks、http、https等类型的proxy @method: 值为 OPTIONS 或 GET 或 HEAD 或 POST 或 PUT 或 DELETE 或 TRACE 或 CONNECT @url: 请求URL @data: HTTP Body 中的数据 @proxy: 指定代理,格式为 type://host:port, 例如: socks5://127.0.0.1:1080, 无代理则传入空字符串 @timeout: 超时时间,请求并发量较大时,timeout最好大一点 @headers: http.Header类型指针,表示请求头 @cookie: http.Cookie类型指针,表示请求cookie
func InArray ¶
func InArray(obj interface{}, target interface{}) bool
InArray 判断某个值是否在数组中 @obj: 待查找的值 @target: 目标数组
func Permutations ¶
Permutations 生成排列数 @Replacer: 元素列表 @selectNum: 排列长度 @repeatable: 是否允许元素重复 @bufSize: 消息通道缓存大小
func QueryStringToMap ¶
QueryStringToMap 将url查询参数转换为map
func RandIPInRange ¶
RandIPInRange 在给定的IP地址范围内随机生成一个IP,minIP和maxIP可以是.分隔的IP表示,也可以是十进制数字IP表示
func RandString ¶
RandString 产生指定长度随机字符串, letters 默认为纯数字 "0123456789"
Types ¶
type Float64Replacer ¶
type Float64Replacer []string
func (Float64Replacer) Len ¶
func (fr Float64Replacer) Len() int
func (Float64Replacer) Replace ¶
func (fr Float64Replacer) Replace(indices []int) Replacer
func (Float64Replacer) ToString ¶
func (fr Float64Replacer) ToString() string
type RuneReplacer ¶
type RuneReplacer []rune
func (RuneReplacer) Len ¶
func (rr RuneReplacer) Len() int
func (RuneReplacer) Replace ¶
func (rr RuneReplacer) Replace(indices []int) Replacer
func (RuneReplacer) ToString ¶
func (rr RuneReplacer) ToString() string
type StringReplacer ¶
type StringReplacer []string
func (StringReplacer) Len ¶
func (sr StringReplacer) Len() int
func (StringReplacer) Replace ¶
func (sr StringReplacer) Replace(indices []int) Replacer
func (StringReplacer) ToString ¶
func (sr StringReplacer) ToString() string