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 ( ErrApiFailure = errors.New("api失效") ErrQRCodeGetFail = errors.New("二维码获取失败") ErrQRCodeFailure = errors.New("二维码失效") )
View Source
var (
ErrMetaUrlFailure = errors.New("metaUrl失效")
)
Functions ¶
This section is empty.
Types ¶
type DriverOption ¶
type DriverOption struct { Timeout time.Duration // 超时时间 Attempt int // 重试次数 WaitTime time.Duration // 重试等待时间 MaxWaitTime time.Duration // 重试最长等待时间 Encoder encodercommon.EncoderPlugin // 编码器 Crypto cryptocommon.CryptoPlugin // 加密器 }
func (*DriverOption) SetOption ¶
func (b *DriverOption) SetOption(options ...Option) error
type DriverPlugin ¶
type DriverPlugin interface { DriverPluginInfo // driver信息 SetOption(options ...Option) error // 设置配置 DriverPluginAction }
* * 驱动的插件
type DriverPluginAction ¶
type DriverPluginAction interface { Upload(ctx context.Context, data []byte) (metaurl string, err error) //上传数据 Download(ctx context.Context, metaurl string) (data []byte, err error) //下载数据 CheckUrl(ctx context.Context, metaurl string) bool // 检查链接是否失效 UploadUsable() bool //是否可以上传 DownloadUsable() bool //是否可以下载 }
type DriverPluginInfo ¶
type DriverPluginInfo interface { Name() string //名称 MaxSize() int //支持最大大小 SuperEncoder() []string //支持的编码方式 SpaceSize() SpaceSize // [0]总空间 [1]使用空间 }
驱动信息
type DriverPluginLogin ¶
type EmailLogin ¶
type EmailLogin interface { DriverPluginLogin EmailLogin(ctx context.Context, show func(ctx context.Context, image image.Image) (string, error)) (auto string, err error) }
邮箱登陆
type Option ¶
type Option interface {
Apply(*DriverOption) error
}
func WithAttempt ¶
func WithCrypto ¶
func WithCrypto(t cryptocommon.CryptoPlugin) Option
func WithEncoder ¶
func WithEncoder(t encodercommon.EncoderPlugin) Option
func WithMaxWaitTime ¶
func WithTimeout ¶
func WithWaitTime ¶
Click to show internal directories.
Click to hide internal directories.