util

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 26 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStrToMap added in v1.2.1

func AddStrToMap(str string, m map[string]struct{}, protocol string)

func AppendCreate

func AppendCreate(name string) (*os.File, error)

func DataRoot

func DataRoot(elem ...string) string

func ExtractHost

func ExtractHost(rawURL string) string

func ExtractURLs

func ExtractURLs(text string) []string

func FindOffset added in v1.4.0

func FindOffset(file *os.File, target string) (int64, error)

func FindStringInFile added in v1.2.1

func FindStringInFile(filepath string, target string) bool

func FindStringSubmatch

func FindStringSubmatch(reg, str string) []string

func GetCheckRedirectFunc

func GetCheckRedirectFunc(errUseLastResponse bool) func(req *defaultHttp.Request, via []*defaultHttp.Request) error

GetCheckRedirectFunc 辅助函数:获取 CheckRedirect 函数

func GetHash

func GetHash(body []byte, method string) ([]byte, error)

func GetMainDomain added in v1.4.0

func GetMainDomain(domain string) string

func GetMatchVersion added in v1.3.0

func GetMatchVersion(defaultMatchDir string) (string, error)

func GetPartString added in v1.4.2

func GetPartString(part string, data map[string]interface{}) (string, bool)

func GetProxyFunc

func GetProxyFunc(proxy, auth string) func(*defaultHttp.Request) (*url.URL, error)

GetProxyFunc 辅助函数:获取代理设置函数

func GetRequestPackage

func GetRequestPackage(request *http.Request) string

func GetResponsePackage

func GetResponsePackage(response *defaultHttp.Response, body []byte, getBody bool) string

func GetTrueUrl

func GetTrueUrl(text *url.URL) string

func IsSubdomainOrSameDomain

func IsSubdomainOrSameDomain(orl string, link string) bool

func JoinPath

func JoinPath(target, path string) string

func ListFilesWithExtension

func ListFilesWithExtension(rootPath, extension string) ([]string, error)

func MatchString

func MatchString(reg, str string) bool

func NewProxyDialer added in v1.3.0

func NewProxyDialer(proxyUrl, proxyAuth string) (proxy.Dialer, error)

func Nunzip

func Nunzip(p string, zipReader *zip.Reader) error

compareAndWriteTemplates compares and returns the stats of a template update operations.

func ParseProxyAuth

func ParseProxyAuth(auth string) (string, string, bool)

ParseProxyAuth 辅助函数:解析代理授权信息(格式为“username:password”)

func RandStr

func RandStr(length int) string

func ReadFile

func ReadFile(filename string) (string, error)

ReadFile 从指定文件中读取数据

func ReplaceStringsInFile

func ReplaceStringsInFile(templateFile, oldString, newString string) error

ReplaceStringsInFile 用于读取文件,替换其中的特定字符串,并在原文件上进行修改

func ToString added in v1.4.2

func ToString(data interface{}) string

ToString converts an interface to string in a quick way

func Unzip

func Unzip(p string, reader *bytes.Reader) error

Unzip 覆盖解压

func WriteFile

func WriteFile(filename string, string2 string) error

WriteFile 将数据写入指定文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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