Documentation ¶
Index ¶
- Constants
- func GetEcmUserLoginIntegrationByUserLoginName(urlHost, secretKey string) (string, error)
- func GetEcmUserLoginIntegrationByUserLoginNameV(c *gin.Context) (string, error)
- func GetEcmUserLoginIntegrationByUserLoginNameV1(c *gin.Context, urlHost, secretKey string) (string, error)
- func GetPublicKey(r *http.Request) ([]byte, error)
- func GetPublicKeyV1(r *http.Request) ([]byte, error)
- func UploadPath2Ecm(fileByte []byte, uploadId, sessionID string) (string, string, string, error)
- func VerifyCallbackSignature(r *http.Request) error
- type CallbackPolicy
- type CheckAndCreateDocInfoData
- type CheckAndCreateDocInfoResp
- type CreateUploadSessionService
- 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) InitECMClient(forceUsePublicEndpoint bool, cuss CreateUploadSessionService) 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, url 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 EcmUploadResp
- type UploadPolicy
Constants ¶
View Source
const ( // MultiPartUploadThreshold 服务端使用分片上传的阈值 MultiPartUploadThreshold uint64 = 5 * (1 << 30) // 5GB // VersionID 文件版本标识 VersionID key = iota )
View Source
const RedisECMPre = "ecm_"
Variables ¶
This section is empty.
Functions ¶
func GetEcmUserLoginIntegrationByUserLoginNameV ¶ added in v1.2.6
func GetEcmUserLoginIntegrationByUserLoginNameV1 ¶
func GetEcmUserLoginIntegrationByUserLoginNameV1(c *gin.Context, urlHost, secretKey string) (string, error)
GetEcmToken
TODO: 获取 token,存在漏洞,当token在接口调试的过程中,通过接口获取token一定会被替换掉,则toke无法使用; 1、需要手动删除redis 中的token缓存才能生效 ⚠️:正式环境上线后,不允许手动调用token接口进行调试, 除非添加 token 校验策略: 用于判断token的有效性;
func GetPublicKey ¶
GetPublicKey 从回调请求或缓存中获取OSS的回调签名公钥
func GetPublicKeyV1 ¶
GetPublicKeyV1 从回调请求或缓存中获取OSS的回调签名公钥
func UploadPath2Ecm ¶
ECM 分片上传文件
func VerifyCallbackSignature ¶
VerifyCallbackSignature 验证OSS回调请求
Types ¶
type CallbackPolicy ¶
type CallbackPolicy struct { CallbackURL string `json:"callbackUrl"` CallbackBody string `json:"callbackBody"` CallbackBodyType string `json:"callbackBodyType"` }
CallbackPolicy 回调策略
type CheckAndCreateDocInfoData ¶ added in v1.2.2
type CheckAndCreateDocInfoData struct { FileId int `json:"FileId"` FileVerId int `json:"FileVerId"` IsSupportMultiTd bool `json:"IsSupportMultiTd"` OperaterId int `json:"OperaterId"` ParentFolderId int `json:"ParentFolderId"` RegionHash string `json:"RegionHash"` RegionId int `json:"RegionId"` RegionType int `json:"RegionType"` RegionUrl string `json:"RegionUrl"` StoragePlatform int `json:"StoragePlatform"` }
type CheckAndCreateDocInfoResp ¶ added in v1.2.2
type CheckAndCreateDocInfoResp struct { AvailableSizes int `json:"availableSizes"` Data CheckAndCreateDocInfoData `json:"data"` Reason string `json:"reason"` Result int `json:"result"` }
type CreateUploadSessionService ¶ added in v1.2.2
type CreateUploadSessionService struct { Path string `json:"path" binding:"required"` Size uint64 `json:"size" binding:"required"` Name string `json:"name" binding:"required"` Type string `json:"type" binding:"required"` Md5 string `json:"md5"` PublicRoot string `json:"public_root"` }
CreateUploadSessionService 获取上传凭证服务
type Driver ¶
type Driver struct { Policy *model.Policy HTTPClient request.Client UrlVal url.Values GinCtx *gin.Context ReqParm CreateUploadSessionService // contains filtered or unexported fields }
Driver ECM策略适配器
func (*Driver) CancelToken ¶
func (handler *Driver) CancelToken(ctx context.Context, uploadSession *serializer.UploadSession) error
取消上传凭证
func (*Driver) InitECMClient ¶
func (handler *Driver) InitECMClient(forceUsePublicEndpoint bool, cuss CreateUploadSessionService) error
InitECMClient 初始化ECM鉴权客户端
func (*Driver) List ¶
func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error)
List 列出ECM上的文件
func (*Driver) Token ¶
func (handler *Driver) Token(ctx context.Context, ttl int64, uploadSession *serializer.UploadSession, file fsctx.FileHeader) (*serializer.UploadCredential, error)
Token 获取上传策略和认证Token
type EcmUploadResp ¶ added in v1.2.2
type UploadPolicy ¶
type UploadPolicy struct { Expiration string `json:"expiration"` Conditions []interface{} `json:"conditions"` }
UploadPolicy ECM上传策略
Click to show internal directories.
Click to hide internal directories.