Documentation ¶
Index ¶
- Variables
- func AES(byteKey, src []byte, isEncode bool) (rst []byte)
- func AESCBC(byteKey, src []byte, isEncode bool) (rst []byte)
- func AESCBCString(byteKey, src []byte, isEncode bool) (rst string)
- func AESCBCStringX(byteKey, src []byte, isEncode bool) (rst string)
- func AESString(byteKey, src []byte, isEncode bool) (rst string)
- func AESStringX(byteKey, src []byte, isEncode bool) (rst string)
- func BEStringUint64(src string) (v uint64)
- func Base62(src int64) (rst string)
- func Base62Url(mid string) (url string)
- func Catch(err ...*error)
- func CheckIP() (ip string, err error)
- func DeBase62(src string) (rst int64)
- func DeBase62Url(url string) (mid string)
- func DebugFlog(w io.Writer, args ...interface{})
- func DebugLog(args ...interface{})
- func DecodeJsHex(src string) []byte
- func DecodeJsUint64BE(src string) (uin uint64)
- func EncodeHexString(src []byte) string
- func EncodeHexStringX(src []byte) string
- func EncodeJsHex(src []byte) string
- func EncodeJsUint64BE(uin uint64) (src string)
- func FetchImageAsStream(url string) (r *bytes.Buffer)
- func FlushIP() string
- func GetIP() string
- func GetIPLocal() []string
- func HashCode(str string) (hash int)
- func IsArrayDuplicate(arr []string, arr2 []string) bool
- func IsArrayDuplicateOpt(arr []string, arr2 []string) bool
- func IsInArray(arr []string, sub string) bool
- func IsNumber(src string) bool
- func JsCurrentSecond() int64
- func JsCurrentTime() string
- func LineNumber() string
- func LineNumberAt(deep int) string
- func MD5(src string) (rst []byte)
- func MD5String(src string) (rst string)
- func MD5StringX(src string) (rst string)
- func MustParseUrl(rawurl string) *url.URL
- func MustReadAll(r io.Reader) []byte
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func ParseHost(host string) (ip net.IP, port int)
- func Random(n int) (result string)
- func RemoveBlock(src, perfix, suffix string) (rst string)
- func Sw(condition bool, a, b interface{}) interface{}
- func Throw(msg string)
- func ToInt(src string) (rst int)
- func ToInt64(src string) (rst int64)
- func ToJson(args ...interface{}) string
- func ToString(src ...interface{}) string
- func Try(err error)
- func Uint64BEString(v uint64) string
- type ArrayList
- type FuncPool
- type IPInfo
- type Key
- type Logger
- func (l *Logger) Enable() bool
- func (l *Logger) Err(s ...interface{})
- func (l *Logger) Errf(format string, s ...interface{})
- func (l *Logger) Log(s ...interface{})
- func (l *Logger) Logf(format string, s ...interface{})
- func (l *Logger) Output() io.Writer
- func (l *Logger) SetEnable(v bool)
- func (l *Logger) SetOutput(v io.Writer)
- type SafeMap
- func (this *SafeMap) Bool(key Key) (v bool)
- func (this *SafeMap) Byte(key Key) (v byte)
- func (this *SafeMap) ContainsKey(key Key) (v bool)
- func (this *SafeMap) ContainsKeys(keys []Key) (v bool)
- func (this *SafeMap) ContainsValue(val Value) (v bool)
- func (this *SafeMap) Delete(key Key)
- func (this *SafeMap) DirtyContainsKey(key Key) (v bool)
- func (this *SafeMap) DirtyContainsKeys(keys []Key) (v bool)
- func (this *SafeMap) DirtyDelete(key Key)
- func (this *SafeMap) DirtyGet(key Key) Value
- func (this *SafeMap) DirtyItems() map[Key]Value
- func (this *SafeMap) DirtyMakeReverseIndex()
- func (this *SafeMap) DirtyPut(key Key, v Value)
- func (this *SafeMap) Float32(key Key) (v float32)
- func (this *SafeMap) Float64(key Key) (v float64)
- func (this *SafeMap) Get(key Key) (v Value)
- func (this *SafeMap) HaveReverseIndex() bool
- func (this *SafeMap) Int(key Key) (v int)
- func (this *SafeMap) Int16(key Key) (v int16)
- func (this *SafeMap) Int32(key Key) (v int32)
- func (this *SafeMap) Int64(key Key) (v int64)
- func (this *SafeMap) Int8(key Key) (v int8)
- func (this *SafeMap) Items() (nv map[Key]Value)
- func (this *SafeMap) MakeReverseIndex()
- func (this *SafeMap) Put(key Key, v Value)
- func (this *SafeMap) String(key Key) (v string)
- func (this *SafeMap) UInt(key Key) (v uint)
- func (this *SafeMap) UInt16(key Key) (v uint16)
- func (this *SafeMap) UInt32(key Key) (v uint32)
- func (this *SafeMap) UInt64(key Key) (v uint64)
- func (this *SafeMap) UInt8(key Key) (v uint8)
- type SimpleCookieJar
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TRACE = NewLogger(os.Stderr, false, "[TRACE] ") DEBUG = NewLogger(os.Stderr, false, "[DEBUG] ") WARN = NewLogger(os.Stderr, true, "[WARN] ") ERROR = NewLogger(os.Stderr, true, "[ERROR] ") INFO = NewLogger(os.Stdout, true, "[INFO] ") CRITICAL = NewLogger(os.Stdout, true, "[CRITICAL] ") )
默认四个日志级别
View Source
var IP string
当前IP的缓存
Functions ¶
func AESCBCString ¶
AES-CBC 返回 hex结果
func AESCBCStringX ¶
AES-CBC 返回 hex结果大写
func Catch ¶
func Catch(err ...*error)
供给panic后恢复 (部分内部错误无法恢复) exmaple:
func xx() (err error){ defer util.Catch(&err) ... util.Try(err) }
func EncodeJsUint64BE ¶
返回JS风格的64位长整形 形如\x00\x00\x00\x00\x00\x00\x00\x01 (1)
func IsArrayDuplicateOpt ¶
检查数组元素是否重复 - 性能优化版(空间换时间)
func LineNumber ¶
func LineNumber() string
func LineNumberAt ¶
func PKCS5Padding ¶
func PKCS5UnPadding ¶
Types ¶
type IPInfo ¶
type IPInfo struct { IP string `json:"ip"` Pro string `json:"pro"` ProCode string `json:"proCode"` City string `json:"city"` CityCode string `json:"cityCode"` Region string `json:"region"` RegionCode string `json:"regionCode"` Addr string `json:"addr"` RegionNames string `json:"regionNames"` }
IP信息
type SafeMap ¶
Thread-safe map 线程安全的Map
func NewSafeMap ¶
func NewSafeMap() (m *SafeMap)
func (*SafeMap) ContainsValue ¶
无索引下是O(n)遍历 慎用
func (*SafeMap) DirtyContainsKeys ¶
检查是否存在某几个键
func (*SafeMap) DirtyItems ¶
全部返回 供range使用 在多线程下使用请手动进行 RLock(); defer RUnlock()
func (*SafeMap) DirtyMakeReverseIndex ¶
func (this *SafeMap) DirtyMakeReverseIndex()
[脏的]对Value建立索引 原理是建立一个反向 map[Value]Key 建立索引后ContainValue()效率将变为O(1)
func (*SafeMap) MakeReverseIndex ¶
func (this *SafeMap) MakeReverseIndex()
[线程安全的]对Value建立索引 原理是建立一个反向 map[Value]Key 建立索引后ContainValue()效率将变为O(1) 但索引不会自动变化(因为影响效率) 需要手动重建
type SimpleCookieJar ¶
type SimpleCookieJar struct {
// contains filtered or unexported fields
}
无域简单Jar
func (*SimpleCookieJar) Cookies ¶
func (this *SimpleCookieJar) Cookies(_ *url.URL) []*http.Cookie
实现接口 http.CookieJar.Cookies(u)
func (*SimpleCookieJar) SetCookies ¶
func (this *SimpleCookieJar) SetCookies(_ *url.URL, cookies []*http.Cookie)
实现接口 http.CookieJar.SetCookies(u, cookies)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.