utils

package
v0.0.0-...-479da69 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const KEY = "fakeKeyChangeMe!"

KEY 密钥

Variables

This section is empty.

Functions

func AesDecode

func AesDecode(encryptedString string) (string, error)

AesDecode aes解密

使用CFB

func AesEncode

func AesEncode(rawString string) (string, error)

AesEncode aes加密

使用CFB

func Base64Decode

func Base64Decode(encodedString string) ([]byte, error)

Base64Decode base64解码

func Base64Encode

func Base64Encode(rawBytes []byte) string

Base64Encode base64编码

func FileExists

func FileExists(dst string) bool

FileExists 检查文件上是否存在

dst string 目标地址

func FileExistsWithError

func FileExistsWithError(dst string) (bool, error)

FileExistsWithError 检查文件上是否存在(会返回错误信息)

dst string 目标地址

func FileExt

func FileExt(filename string) string

FileExt 获取文件扩展名

根据文件名最后一个.分隔来切分获取

func FileGetContents

func FileGetContents(filename string) ([]byte, error)

FileGetContents 获取文件内容

filename string 文件地址

func FilePutContents

func FilePutContents(content []byte, dst string) error

FilePutContents 将内容写入文件(覆盖写)

content []byte 写入的内容

dst string 写入的目标地址

func ListeningExitSignal

func ListeningExitSignal(logger *zap.Logger, wg *sync.WaitGroup)

ListeningExitSignal 监听系统退出信号

func MD5Encrypt

func MD5Encrypt(rawString string) string

MD5Encrypt md5加密

func RSADecrypt

func RSADecrypt(encodedString string, privateKey []byte) (string, error)

RSADecrypt rsa解密

func RSAEncrypt

func RSAEncrypt(rawString string, publicKey []byte) (string, error)

RSAEncrypt rsa加密

func RSASign

func RSASign(rawStringBytes, privateKey []byte) (string, error)

RSASign rsa加签

func RSAVerifySign

func RSAVerifySign(rawStringBytes, sign, publicKey []byte) (bool, error)

RSAVerifySign rsa验签

func SaveFile2Dst

func SaveFile2Dst(file *multipart.FileHeader, dst string) error

SaveFile2Dst 将文件保存到目标地址(拷贝文件)

file *multipart.FileHeader 文件

dst string 拷贝到的目标地址

Types

This section is empty.

Jump to

Keyboard shortcuts

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