aliyundrive

package
v4.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePrivateKey added in v4.2.0

func GeneratePrivateKey() (*ecdsa.PrivateKey, error)

GeneratePrivateKey 生成新的ECDSA私钥

func PrivateKeyFromBytes added in v4.2.0

func PrivateKeyFromBytes(priv []byte) *ecdsa.PrivateKey

PrivateKeyFromBytes 从字节数组创建私钥

func PrivateKeyFromHex added in v4.2.0

func PrivateKeyFromHex(hexStr string) (*ecdsa.PrivateKey, error)

PrivateKeyFromHex 从十六进制字符串创建私钥

func PrivateKeyToBytes

func PrivateKeyToBytes(private *ecdsa.PrivateKey) []byte

PrivateKeyToBytes 将私钥转换为字节数组

func PrivateKeyToHex

func PrivateKeyToHex(private *ecdsa.PrivateKey) string

PrivateKeyToHex 将私钥转换为十六进制字符串

func PublicKeyToBytes

func PublicKeyToBytes(public *ecdsa.PublicKey) []byte

PublicKeyToBytes 将公钥转换为字节数组

func PublicKeyToHex

func PublicKeyToHex(public *ecdsa.PublicKey) string

PublicKeyToHex 将公钥转换为十六进制字符串

Types

type Addition

type Addition struct {
	driver.RootID
	RefreshToken string `json:"refresh_token" required:"true"`
	// DeviceID       string `json:"device_id" required:"true"`
	OrderBy        string `json:"order_by" type:"select" options:"name,size,updated_at,created_at"`
	OrderDirection string `json:"order_direction" type:"select" options:"ASC,DESC"`
	RapidUpload    bool   `json:"rapid_upload"`
	InternalUpload bool   `json:"internal_upload"`
}

Addition 存储阿里云盘所需的额外配置信息

type AliDrive

type AliDrive struct {
	model.Storage
	Addition
	AccessToken string

	DriveID string
	UserID  string
	// contains filtered or unexported fields
}

AliDrive 阿里云盘驱动实现

func (*AliDrive) Config

func (d *AliDrive) Config() driver.Config

Config 返回驱动配置

func (*AliDrive) Copy

func (d *AliDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error

Copy 复制文件/目录

func (*AliDrive) Drop

func (d *AliDrive) Drop(ctx context.Context) error

Drop 释放驱动资源

func (*AliDrive) GetAddition

func (d *AliDrive) GetAddition() driver.Additional

GetAddition 返回额外配置

func (*AliDrive) Init

func (d *AliDrive) Init(ctx context.Context) error

Init 初始化驱动

func (d *AliDrive) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

Link 获取文件下载链接

func (*AliDrive) List

func (d *AliDrive) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

List 列出目录内容

func (*AliDrive) MakeDir

func (d *AliDrive) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error

MakeDir 创建目录

func (*AliDrive) Move

func (d *AliDrive) Move(ctx context.Context, srcObj, dstDir model.Obj) error

Move 移动文件/目录

func (*AliDrive) Other

func (d *AliDrive) Other(ctx context.Context, args model.OtherArgs) (any, error)

Other 处理其他操作

func (*AliDrive) Put

func (d *AliDrive) Put(ctx context.Context, dstDir model.Obj, streamer model.FileStreamer, up driver.UpdateProgress) error

Put 上传文件

func (*AliDrive) Remove

func (d *AliDrive) Remove(ctx context.Context, obj model.Obj) error

Remove 删除文件/目录

func (*AliDrive) Rename

func (d *AliDrive) Rename(ctx context.Context, srcObj model.Obj, newName string) error

Rename 重命名文件/目录

type File

type File struct {
	DriveID       string    `json:"drive_id"`       // 驱动ID
	CreatedAt     time.Time `json:"created_at"`     // 创建时间
	FileExtension string    `json:"file_extension"` // 文件扩展名
	FileID        string    `json:"file_id"`        // 文件ID
	Type          string    `json:"type"`           // 类型
	Name          string    `json:"name"`           // 名称
	Category      string    `json:"category"`       // 分类
	ParentFileID  string    `json:"parent_file_id"` // 父文件ID
	UpdatedAt     time.Time `json:"updated_at"`     // 更新时间
	Size          int64     `json:"size"`           // 大小
	Thumbnail     string    `json:"thumbnail"`      // 缩略图
	URL           string    `json:"url"`            // URL
}

File 表示阿里云盘文件信息

type Files

type Files struct {
	Items      []File `json:"items"`       // 文件列表
	NextMarker string `json:"next_marker"` // 下一页标记
}

Files 表示文件列表响应

type RespErr

type RespErr struct {
	Code    string `json:"code"`    // 错误码
	Message string `json:"message"` // 错误信息
}

RespErr 表示API响应的错误信息

type State

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

State 存储用户状态信息

type UploadResp

type UploadResp struct {
	FileID       string `json:"file_id"`   // 文件ID
	UploadID     string `json:"upload_id"` // 上传ID
	PartInfoList []struct {
		UploadURL         string `json:"upload_url"`          // 上传URL
		InternalUploadURL string `json:"internal_upload_url"` // 内部上传URL
	} `json:"part_info_list"`

	RapidUpload bool `json:"rapid_upload"` // 是否秒传
}

UploadResp 表示上传响应

Jump to

Keyboard shortcuts

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