util

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(src, key, iv []byte, mode string) ([]byte, error)

func AesEncrypt

func AesEncrypt(src, key, iv []byte, mode string) ([]byte, error)

func DoReq

func DoReq(method, URL string, data *map[string]interface{}, options *map[string]interface{}) (*et.Result, error)

func Eapi

func Eapi(URL string, obj interface{}) (url.Values, error)

func GenerateKey

func GenerateKey(size int) (*rsa.PrivateKey, *rsa.PublicKey, error)

func GenerateKey64

func GenerateKey64(size int) (pri64, pub64 string, err error)

GenerateKey64 uses key sizes of 1024, 2048 or 4096

func GenerateKeyBytes

func GenerateKeyBytes(size int) (privateBytes, publicBytes []byte, err error)

func GetWithHeaders

func GetWithHeaders(url string, data url.Values, headers url.Values) (resp *http.Response, err error)

func LinuxApi

func LinuxApi(obj interface{}) (url.Values, error)

func Md5String

func Md5String(pass string) string

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

func PKCS7Padding

func PKCS7Padding(ciphertext []byte) []byte

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte) []byte

func PostFormWithHeaders

func PostFormWithHeaders(url string, data url.Values, headers url.Values) (resp *http.Response, err error)

func PrivateDecrypt

func PrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)

func PrivateKeyFrom

func PrivateKeyFrom(key []byte) (*rsa.PrivateKey, error)

func PrivateKeyFrom64

func PrivateKeyFrom64(key string) (*rsa.PrivateKey, error)

func PrivateSign

func PrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)

func PrivateVerify

func PrivateVerify(key *rsa.PrivateKey, sign, data []byte) error

func PublicEncrypt

func PublicEncrypt(key *rsa.PublicKey, data []byte) ([]byte, error)

func PublicEncryptNoPadding

func PublicEncryptNoPadding(pub *rsa.PublicKey, data []byte) ([]byte, error)

func PublicKeyFrom

func PublicKeyFrom(key []byte) (*rsa.PublicKey, error)

func PublicKeyFrom64

func PublicKeyFrom64(key string) (*rsa.PublicKey, error)

func PublicSign

func PublicSign(key *rsa.PublicKey, data []byte) ([]byte, error)

func PublicVerify

func PublicVerify(key *rsa.PublicKey, sign, data []byte) error

func ReadSetCookies

func ReadSetCookies(h http.Header) []*http.Cookie

func ReplaceAllWithReg

func ReplaceAllWithReg(reg string, src []string, repl string) []string

func ReplaceWithReg

func ReplaceWithReg(reg, src, repl string) string

func RsaEncrypt

func RsaEncrypt(src, key []byte) ([]byte, error)
 func encrypt_RSA(pub *rsa.PublicKey, data []byte) []byte {
	encrypted := new(big.Int)
	e := big.NewInt(int64(pub.E))
	payload := new(big.Int).SetBytes(data)
	encrypted.Exp(payload, e, pub.N)
	return encrypted.Bytes()
}

func ToBase64

func ToBase64(src []byte) []byte

func ToBase64String

func ToBase64String(src []byte) string

func Weapi

func Weapi(obj interface{}) (url.Values, error)

Types

type RequestOptions

type RequestOptions map[string]interface{}

func DefaultEmptyRequestOpts

func DefaultEmptyRequestOpts() *RequestOptions

func DefaultRequestOpts

func DefaultRequestOpts() *RequestOptions

func (*RequestOptions) Cookie

func (opt *RequestOptions) Cookie(cookie interface{}) *RequestOptions

func (*RequestOptions) CookieString

func (opt *RequestOptions) CookieString(cookie string) *RequestOptions

func (*RequestOptions) CryptoEapi

func (opt *RequestOptions) CryptoEapi() *RequestOptions

func (*RequestOptions) CryptoLinux

func (opt *RequestOptions) CryptoLinux() *RequestOptions

func (*RequestOptions) Raw

func (opt *RequestOptions) Raw() *map[string]interface{}

func (*RequestOptions) RealIP

func (opt *RequestOptions) RealIP(ip string) *RequestOptions

func (*RequestOptions) SetOption

func (opt *RequestOptions) SetOption(key string, value interface{})

safe to use in multiple goroutines

func (*RequestOptions) UA

func (opt *RequestOptions) UA(ua string) *RequestOptions

func (*RequestOptions) URL

func (opt *RequestOptions) URL(url string) *RequestOptions

type URL

type URL string

Jump to

Keyboard shortcuts

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