Documentation ¶
Index ¶
- Constants
- func GetPublicKey(r *http.Request) ([]byte, error)
- func GetPublicKeyV1(r *http.Request) ([]byte, error)
- func VerifyCallbackSignature(r *http.Request) error
- type CallbackPolicy
- type Driver
- func (handler *Driver) CORS() error
- func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error
- func (handler *Driver) Delete(ctx context.Context, files []string) ([]string, error)
- func (handler *Driver) Get(ctx context.Context, path string) (response.RSCloser, error)
- func (handler *Driver) InitOSSClient(forceUsePublicEndpoint bool) error
- func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error)
- func (handler *Driver) Put(ctx context.Context, file fsctx.FileHeader) error
- func (handler *Driver) Source(ctx context.Context, path string, baseURL url.URL, ttl int64, isDownload bool, ...) (string, error)
- func (handler *Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error)
- func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, ...) (*serializer.UploadCredential, error)
- type UploadPolicy
Constants ¶
View Source
const ( // MultiPartUploadThreshold 服务端使用分片上传的阈值 MultiPartUploadThreshold uint64 = 5 * (1 << 30) // 5GB // VersionID 文件版本标识 VersionID key = iota )
Variables ¶
This section is empty.
Functions ¶
func GetPublicKey ¶
GetPublicKey 从回调请求或缓存中获取OSS的回调签名公钥
func GetPublicKeyV1 ¶
GetPublicKeyV1 从回调请求或缓存中获取OSS的回调签名公钥
func VerifyCallbackSignature ¶
VerifyCallbackSignature 验证OSS回调请求
Types ¶
type CallbackPolicy ¶
type CallbackPolicy struct { CallbackURL string `json:"callbackUrl"` CallbackBody string `json:"callbackBody"` CallbackBodyType string `json:"callbackBodyType"` }
CallbackPolicy 回调策略
type Driver ¶
type Driver struct { Policy *model.Policy HTTPClient request.Client // contains filtered or unexported fields }
Driver 阿里云OSS策略适配器
func (*Driver) CancelToken ¶
func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error
取消上传凭证
func (*Driver) InitOSSClient ¶
InitOSSClient 初始化OSS鉴权客户端
func (*Driver) List ¶
func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error)
List 列出OSS上的文件
func (*Driver) Source ¶
func (handler *Driver) Source( ctx context.Context, path string, baseURL url.URL, ttl int64, isDownload bool, speed int, ) (string, error)
Source 获取外链URL
func (*Driver) Token ¶
func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error)
Token 获取上传策略和认证Token
type UploadPolicy ¶
type UploadPolicy struct { Expiration string `json:"expiration"` Conditions []interface{} `json:"conditions"` }
UploadPolicy 阿里云OSS上传策略
Click to show internal directories.
Click to hide internal directories.