package oss import ( "eta_gn/eta_obs/global" ) const ( STORAGESOURCE_OSS_NAME = "oss" STORAGESOURCE_MINIO_NAME = "minio" STORAGESOURCE_S3_NAME = "s3" ) type OssClient interface { UploadFile(string, string, string) (string, error) GetUploadToken() (OssToken, error) } func NewOssClient() OssClient { switch global.CONFIG.Oss.ObjectStorageClient { case STORAGESOURCE_MINIO_NAME: return new(MinioOss) case STORAGESOURCE_S3_NAME: return new(S3Oss) default: // 默认使用阿里云OSS return new(AliOss) } } // OssToken 此处为了兼容前端那边所以有重复的 type OssToken struct { AccessKeyId string SecretKeyId string RegionId string Bucketname string Endpoint string ImgHost string UseSSL string Port string //AccessKeyId string AccessKeySecret string SecurityToken string ExpiredTime string //RegionId string //Bucketname string //Endpoint string Imghost string S3ForceStyle bool S3Protocol string }