toolx

package
v0.0.0-...-7c465ed Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateJwtToken

func CreateJwtToken(secret, issuer string, audience []string, subject string, expired time.Time) (string, error)

生成 JWT Token

func DecodeId

func DecodeId(id, alphabet, salt string, length int) int

对id进行解码

func DecodeIdArray

func DecodeIdArray(ids []string, alphabet, salt string, length int) []int

转换id数组

func DecryptAES

func DecryptAES(cipherText, key, iv string) (string, error)

AES解密

func EncodeId

func EncodeId(id int, alphabet, salt string, length int) string

对id进行编码

func EncryptAES

func EncryptAES(plainText, key, iv string) (string, error)

AES加密

func GetValueByTag

func GetValueByTag(entity any, tagName, tagValue string) (any, error)

根据tag信息获取值

func LoadConfig

func LoadConfig(path string, cfgPtr any) error

加载配置文件

func MD5

func MD5(plainText string) string

MD5简单加密

func MD5Mix

func MD5Mix(plainText string, first, last int) string

MD5加密后混淆

func ParseJwtToken

func ParseJwtToken(token, secret, issuer string, audience []string) (string, error)

解析 JWT Token

Types

type KodoClient

type KodoClient struct {
	// contains filtered or unexported fields
}

kodo云存储客户端

func NewKodoClient

func NewKodoClient(accessKey, secretKey, region, bucket string) *KodoClient

创建kodo客户端

func (*KodoClient) Download

func (k *KodoClient) Download()

下载文件

func (*KodoClient) Upload

func (k *KodoClient) Upload(filePath, key string) error

上传文件

type KodoConfig

type KodoConfig struct {
	AccessKey string `mapstructure:"accessKey"`
	SecretKey string `mapstructure:"secretKey"`
	Region    string `mapstructure:"region"`
	Bucket    string `mapstructure:"bucket"`
}

七牛云配置

type SftpClient

type SftpClient struct {
	// contains filtered or unexported fields
}

sftp客户端

func NewSftpClient

func NewSftpClient(host string, port int64, username, password string) (*SftpClient, error)

创建sftp客户端

func (*SftpClient) Delete

func (cli *SftpClient) Delete(dir string) error

删除空目录or文件

func (*SftpClient) Disconnect

func (cli *SftpClient) Disconnect() error

断开连接

func (*SftpClient) Download

func (cli *SftpClient) Download(srcPath, dstPath string) error

下载文件

func (*SftpClient) ListDirs

func (cli *SftpClient) ListDirs(path, suffix string) ([]string, error)

列举目录中的文件夹

func (*SftpClient) ListFiles

func (cli *SftpClient) ListFiles(path, suffix string) ([]string, error)

列举目录中的文件

func (*SftpClient) MakeDirs

func (cli *SftpClient) MakeDirs(dir string) error

创建目录

func (*SftpClient) Rename

func (cli *SftpClient) Rename(oldname, newname string) error

重命名or移动目录

func (*SftpClient) Upload

func (cli *SftpClient) Upload(srcPath, dstPath string) error

上传文件

type SftpConfig

type SftpConfig struct {
	Host string `mapstructure:"host"`
	Port int64  `mapstructure:"port"`
	User string `mapstructure:"user"`
	Pass string `mapstructure:"pass"`
}

SFTP服务器配置

Jump to

Keyboard shortcuts

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