utils

package
v0.0.0-...-8d6dda1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte) ([]byte, error)

AesDecrypt Aes 解密

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

AesEncrypt Aes 加密

func GenWeChatPaySign

func GenWeChatPaySign(m map[string]string, payKey string) (string, error)

GenWeChatPaySign 生成微信签名

func GetBillNo

func GetBillNo(prefix string, length int) string

GetBillNo 生成订单号,指定位数

func GetTradeNO

func GetTradeNO(prefix string) string

GetTradeNO 生成订单号,不推荐直接使用

func NewRequest

func NewRequest(method, url string, data []byte) (body []byte, err error)

NewRequest 请求包装

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding Aes 加密 PKCS7填充

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

PKCS7UnPadding Aes 解密去除PKCS7填充

func RandomLenNum

func RandomLenNum(length int) string

RandomLenNum 指定随机数字字符串

func RandomNum

func RandomNum(min int64, max int64) int64

RandomNum 随机数

func RandomNumString

func RandomNumString(min int64, max int64) string

RandomNumString 随机数字字符串

func RandomString

func RandomString(length int) string

RandomString 随机字符串

func Struct2Map

func Struct2Map(r interface{}) (s map[string]string, err error)

Struct2Map struct to map,依赖 json tab

func ToStringE

func ToStringE(i interface{}) (string, error)

ToStringE interface to string

Types

type Request

type Request struct {
	Client *http.Client
}

Request 请求包装体

func NewCertRequest

func NewCertRequest(certFile, keyFile, rootCaFile string) (*Request, error)

NewCertRequest 双向安全证书请求

func (*Request) NewRequest

func (m *Request) NewRequest(method, url string, data []byte) (body []byte, err error)

NewRequest 发送请求

Jump to

Keyboard shortcuts

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