util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt

func BytesToInt(b []byte) uint64

BytesToInt 字节转换成整形

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to string without a memory allocation.

func Generate2048RSAKey

func Generate2048RSAKey() (pri, pub []byte, err error)

Generate2048RSAKey 生成RSA私钥和公钥(2048位)

func GenerateRSAKey

func GenerateRSAKey(bits int) (pri, pub []byte, err error)

GenerateRSAKey 生成RSA私钥和公钥

func GetClientIp

func GetClientIp(ctx *gin.Context) string

GetClientIp 获取远程客户端IP

func GetLocalIp

func GetLocalIp() string

GetLocalIp 获取本机ip

func IntToBytes

func IntToBytes(n uint64) []byte

IntToBytes 整形转换成字节

func IsFileExists

func IsFileExists(filePath string) bool

func JSONBytesToStruct

func JSONBytesToStruct(jsonByte []byte, s interface{}) error

func JSONStrToStruct

func JSONStrToStruct(jsonStr string, s interface{}) error

func Join

func Join(sep string, elems []uint64) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

func LoadConf

func LoadConf(configPath string, s interface{}) error

func MD5

func MD5(content string) string

func MapToStruct

func MapToStruct(mp map[string]string, s interface{}) error

func RandomID

func RandomID() string

RandomID 随机ID

func RsaDecrypt

func RsaDecrypt(ciphertext, privateKey []byte) ([]byte, error)

RsaDecrypt 私钥解密

func RsaEncrypt

func RsaEncrypt(origData, publicKey []byte) ([]byte, error)

RsaEncrypt 公钥加密

func StringToBytes

func StringToBytes(s string) (b []byte)

StringToBytes converts string to byte slice without a memory allocation.

func Substr

func Substr(str string, start int, length int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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