tool

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const UserAgent = "" /* 129-byte string literal not displayed */

Variables

This section is empty.

Functions

func Base64DecodeByte

func Base64DecodeByte(s string) ([]byte, error)

func Base64DecodeString

func Base64DecodeString(s string) (string, error)

func Base64EncodeString

func Base64EncodeString(str string) string

func Contains

func Contains(arr []string, key string) bool

func GetFileFullPath

func GetFileFullPath(path string) string

func GetJSONPropertyValue added in v0.1.1

func GetJSONPropertyValue(jsonStr, path string) (string, error)

getJSONStringPropertyValue 根据 JSON 字符串和属性路径获取对应的字符串属性值

func GetUrlArg

func GetUrlArg(args string, key string) string

func HttpGetViaProxy

func HttpGetViaProxy(clashProxy C.Proxy, url string, t time.Duration) ([]byte, error)

func HttpSpeedViaProxy added in v0.0.2

func HttpSpeedViaProxy(clashProxy C.Proxy, url string, t time.Duration) (int64, float64, string, error)

func IsLocalFile

func IsLocalFile(path string) bool

func ReadFile

func ReadFile(path string) ([]byte, error)

从本地文件或者http链接读取配置文件内容

func SafeAsBool

func SafeAsBool(m map[string]interface{}, keys ...string) bool

func SafeAsString

func SafeAsString(m map[string]interface{}, keys ...string) string

Types

type CountryEmoji added in v0.1.0

type CountryEmoji struct {
	Code  string `json:"code"`
	Emoji string `json:"emoji"`
}

type EmojiMap added in v0.1.0

type EmojiMap map[string]string

func InitEmojiData added in v0.1.0

func InitEmojiData() EmojiMap

func (EmojiMap) GetEmoji added in v0.1.0

func (e EmojiMap) GetEmoji(country string) string

type HttpClient

type HttpClient struct {
	*http.Client
}

func GetHttpClient

func GetHttpClient() *HttpClient

func (*HttpClient) Get

func (c *HttpClient) Get(url string) (resp *http.Response, err error)

func (*HttpClient) Post

func (c *HttpClient) Post(url string, body io.Reader) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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