tools

package
v0.0.0-...-f5b5f1e Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsUrl

func AbsUrl(base, uri string) string

func Base64Dec

func Base64Dec(origin string) ([]byte, error)

func Base64Enc

func Base64Enc(originBytes []byte) string

func Cp

func Cp(src, dst string) error

func Decrypt

func Decrypt(ciphertext string, key, iv []byte) (string, error)

解密

func Encrypt

func Encrypt(plaintext, key, iv []byte) (string, error)

加密

func GenQueryParams

func GenQueryParams(p any) string

func GetHttpClient

func GetHttpClient() *resty.Client

func GetPtr

func GetPtr[T any](t T) *T

func Jp2Utf8

func Jp2Utf8(originBytes []byte) (string, error)

func Keys

func Keys[K comparable, V any](m map[K]V) []K

func Move

func Move(src, dst string) error

func NewSet

func NewSet[T comparable](items ...T) *set[T]

func PropertiesCopy

func PropertiesCopy(target, source any) error

func Req

func Req(method, url string, body any, options ...Option) (*resty.Response, error)

func ReqWithProxy

func ReqWithProxy(method, url string, body any, proxy string, options ...Option) (*resty.Response, error)

func SaveFileWithMd5Name

func SaveFileWithMd5Name(data io.Reader, dir string, ext string) (string, error)

func Socks5Proxy

func Socks5Proxy(p string, username, password string) (proxy.Dialer, error)

func Str2Time

func Str2Time(str string) (t time.Time)

func TrimBlankChar

func TrimBlankChar(str string) string

func UrlDec

func UrlDec(origin string) (string, error)

func UrlEnc

func UrlEnc(origin string) string

func Utf82Jp

func Utf82Jp(originBytes []byte) (string, error)

Types

type Option

type Option func(*resty.Request) error

func SetCookiesWithOption

func SetCookiesWithOption(cookies ...*http.Cookie) Option

func SetFromWithOption

func SetFromWithOption(data map[string]string) Option

func SetHeadersWithOption

func SetHeadersWithOption(headers map[string]string) Option

func SetMultiFileWithOption

func SetMultiFileWithOption(params map[string]string, files map[string][]string) Option

func SetMultipartFormWithOption

func SetMultipartFormWithOption(params map[string]string) Option

func SetMultipartWithOption

func SetMultipartWithOption(fields ...*resty.MultipartField) Option

func SetQueryParamsWithOption

func SetQueryParamsWithOption(params map[string]string) Option

Jump to

Keyboard shortcuts

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