common

package
v0.0.0-...-299e692 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize128KIB = 128 * 1024
	BlockSize256KIB = 256 * 1024
	BlockSize512KIB = 512 * 1024
	BlockSize1MIB   = 1 * 1024 * 1024
	BlockSize2MIB   = 2 * 1024 * 1024
	BlockSize4MIB   = 4 * 1024 * 1024
	BlockSize8MIB   = 8 * 1024 * 1024
	BlockSize16MIB  = 16 * 1024 * 1024
	BlockSize32MIB  = 32 * 1024 * 1024
)

Variables

View Source
var (
	ErrNoFindDriver     = errors.New("不存在驱动")
	ErrNoSuperEncoder   = errors.New("不支持编码器")
	ErrLoginFail        = errors.New("登陆失败")
	ErrNoSuperBlockSize = errors.New("分块大小不支持")
)
View Source
var (
	ErrImageCorrupted error = errors.New("图片损坏")
	ErrImageFormat          = errors.New("图片格式错误")
	ErrImageDecode          = errors.New("图片解析错误")
	ErrNotFindEncoder       = errors.New("无法找到编码器")
)
View Source
var (
	ErrParam         = errors.New("参数错误")
	ErrNotFindCrypto = errors.New("无法找到加密器")
)

Functions

This section is empty.

Types

type CryptoPlugin

type CryptoPlugin interface {
	Name() string
	Encrypt(in []byte) (out []byte)
	Decrypt(in []byte) (out []byte)
}

* * 加密插件

type DriverLoginPlugin

type DriverLoginPlugin interface {
	IsLogin() bool
	SetAuthorization(auto string) error // 设置授权
}

type DriverPlugin

* * 驱动的插件

type DriverPluginAction

type DriverPluginAction interface {
	Upload(data []byte) (metaurl string, err error)   //上传数据
	Download(metaurl string) (data []byte, err error) //下载数据
	CheckUrl(metaurl string) bool                     // 检查链接是否失效
}

type DriverPluginInfo

type DriverPluginInfo interface {
	Name() string           //名称
	MaxSize() int           //支持最大大小
	SuperEncoder() []string //支持的编码方式
}

type DriverPluginSet

type DriverPluginSet interface {
	SetContext(ctx context.Context) DriverPlugin
	SetTimeOut(time time.Duration) DriverPlugin   //设置超时
	SetAttempt(t uint) DriverPlugin               //设置重试次数
	SetEncoder(name string) error                 //设置数据编码
	SetCrypto(name string, param ...string) error // 设置加密
}

type DriverPluginUsable

type DriverPluginUsable interface {
	UploadUsable() bool   //是否可以上传
	DownloadUsable() bool //是否可以下载
}

type EncoderPlugin

type EncoderPlugin interface {
	Name() string
	Encoded(in []byte) (out []byte, err error) //编码
	Decode(in []byte) (out []byte, err error)  //解码

}

* * 编码插件

Jump to

Keyboard shortcuts

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