Documentation
¶
Index ¶
- Constants
- Variables
- func Base64UrlDecode(seg string) ([]byte, error)
- func Base64UrlEncode(seg []byte) string
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func GetBaseUrl(url string) string
- func GetDomainByUrl(url string) string
- func GetFileSha256(path string) (hash string, err error)
- func GetJwtBySecret(keyBytes []byte, bodyInfo map[string]interface{}) (string, error)
- func GetKeywordByDomain(domain string) string
- func GetMapStringValue(key string, dictMap map[string]interface{}) string
- func GetPidByPort(portNumber int) int
- func GetRandString(l int) string
- func GetSha256(s string) string
- func GetSha256BySecret(secret string, keyBytes []byte) []byte
- func GetUrl(url, base string) string
- func GetUrlQueryValue(key, url string) string
- func IsPathExists(path string) bool
- func JsonDecodeUseNumber(infoBytes []byte, result interface{}) error
- func KillPid(pid string) error
- func Md5(s string) string
- func Mkdir(path string) error
- func ReadDir(path string, callback func(fileinfo fs.FileInfo)) error
- func ReadFileToString(path string) (string, error)
- func ReplaceAllString(originalstr, oldstr, newstr string) string
- func StartBrowserByUrl(url string) error
- type JsonWebToken
- type LogLevel
- type Logger
- type Strfind
Constants ¶
const ( LOG_LEVEL_DEBUG = 0 LOG_LEVEL_INFO = 1 LOG_LEVEL_WARN = 2 LOG_LEVEL_ERROR = 3 )
Variables ¶
Functions ¶
func Base64UrlDecode ¶
Base64UrlDecode Decode JWT specific base64url encoding with padding stripped
func Base64UrlEncode ¶
Base64UrlEncode Encode JWT specific base64url encoding with padding stripped
func GetBaseUrl ¶ added in v1.0.3
GetBaseUrl. GetBaseUrl("https://www.baidu.com/hello?word=hiiii") -> "https://www.baidu.com" url must starwith http; return like: https://www.baidu.com
func GetDomainByUrl ¶ added in v1.0.3
GetDomainByUrl. 获取url网址的域名。 the arg url startwith http, //, / ; return like: "www.baidu.com", "baidu.com", ""
func GetFileSha256 ¶
GetFileSha256 get SHA256 hash of file.
func GetJwtBySecret ¶
func GetKeywordByDomain ¶ added in v1.0.3
GetKeywordByDomain GetKeywordByDomain("www.baidu.com") -> baidu
func GetMapStringValue ¶ added in v1.0.3
func GetPidByPort ¶ added in v1.0.2
GetPidByPort. 查找端口所属进程的PID。 返回端口号对应的进程PID,若没有找到相关进程,返回-1
func GetRandString ¶
func GetSha256BySecret ¶
GetSha256BySecret get SHA256 hash by Key
func GetUrl ¶ added in v1.0.3
GetUrl. 获取Url链接全路径。常用于爬虫链接格式化。例: Get("/product?id=90", "https://www.site.com") url: startwith http, /, // ; base must startwith http
func GetUrlQueryValue ¶ added in v1.0.3
GetUrlQueryValue 提取网址的查询字符串。即问号之后的部分。
func JsonDecodeUseNumber ¶
func ReadFileToString ¶ added in v1.0.2
ReadFileString 读取文件内容
func ReplaceAllString ¶ added in v1.0.3
func StartBrowserByUrl ¶ added in v1.0.2
StartBrowserByUrl 打开系统默认浏览器
Types ¶
type JsonWebToken ¶
type JsonWebToken struct {
TokenString string
// contains filtered or unexported fields
}
func (*JsonWebToken) Create ¶
func (j *JsonWebToken) Create(claims map[string]interface{}, expiresin time.Duration) (token string, err error)
Create JsonWebToken string Create(map[string]interface{}{"id": 123456789, "username": "Harvey"}, time.Second*time.Duration(3600))
type Logger ¶ added in v1.0.2
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) CloseLogFile ¶ added in v1.0.2
func (l *Logger) CloseLogFile()