mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	support for Kodo
This commit is contained in:
		
							parent
							
								
									877abfe7ce
								
							
						
					
					
						commit
						b14a541603
					
				@ -30,3 +30,11 @@ object:
 | 
			
		||||
    accessKeySecret: ''
 | 
			
		||||
    sessionToken: ''
 | 
			
		||||
    publicRead: false
 | 
			
		||||
  kodo:
 | 
			
		||||
    endpoint: "http://s3.cn-south-1.qiniucs.com"
 | 
			
		||||
    bucket: "kodo-bucket-test"
 | 
			
		||||
    bucketURL: "http://kodo-bucket-test-oetobfb.qiniudns.com"
 | 
			
		||||
    accessKeyID: ''
 | 
			
		||||
    accessKeySecret: ''
 | 
			
		||||
    sessionToken: ''
 | 
			
		||||
    publicRead: false
 | 
			
		||||
							
								
								
									
										21
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								go.mod
									
									
									
									
									
								
							@ -54,6 +54,24 @@ require (
 | 
			
		||||
	cloud.google.com/go/longrunning v0.5.4 // indirect
 | 
			
		||||
	cloud.google.com/go/storage v1.36.0 // indirect
 | 
			
		||||
	github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2 v1.23.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/config v1.25.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/credentials v1.16.3 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.5 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.4 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/s3 v1.43.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/sso v1.17.3 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.1 // indirect
 | 
			
		||||
	github.com/aws/aws-sdk-go-v2/service/sts v1.25.4 // indirect
 | 
			
		||||
	github.com/aws/smithy-go v1.17.0 // indirect
 | 
			
		||||
	github.com/beorn7/perks v1.0.1 // indirect
 | 
			
		||||
	github.com/bytedance/sonic v1.9.1 // indirect
 | 
			
		||||
	github.com/cespare/xxhash/v2 v2.2.0 // indirect
 | 
			
		||||
@ -119,6 +137,7 @@ require (
 | 
			
		||||
	github.com/prometheus/client_model v0.5.0 // indirect
 | 
			
		||||
	github.com/prometheus/common v0.45.0 // indirect
 | 
			
		||||
	github.com/prometheus/procfs v0.12.0 // indirect
 | 
			
		||||
	github.com/qiniu/go-sdk/v7 v7.18.2 // indirect
 | 
			
		||||
	github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
 | 
			
		||||
	github.com/rs/xid v1.5.0 // indirect
 | 
			
		||||
	github.com/sagikazarmark/locafero v0.4.0 // indirect
 | 
			
		||||
@ -176,3 +195,5 @@ require (
 | 
			
		||||
	golang.org/x/crypto v0.21.0 // indirect
 | 
			
		||||
	gopkg.in/ini.v1 v1.67.0 // indirect
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
replace github.com/openimsdk/tools => /mnt/fork/open-im-tools
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,7 @@ import (
 | 
			
		||||
	"github.com/openimsdk/tools/s3/cos"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/minio"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/oss"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/kodo"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -81,6 +82,8 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
 | 
			
		||||
		o, err = cos.NewCos(*config.RpcConfig.Object.Cos.Build())
 | 
			
		||||
	case "oss":
 | 
			
		||||
		o, err = oss.NewOSS(*config.RpcConfig.Object.Oss.Build())
 | 
			
		||||
	case "kodo":
 | 
			
		||||
		o, err = kodo.NewKodo(*config.RpcConfig.Object.Kodo.Build())
 | 
			
		||||
	default:
 | 
			
		||||
		err = fmt.Errorf("invalid object enable: %s", enable)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ import (
 | 
			
		||||
	"github.com/openimsdk/tools/s3/cos"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/minio"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/oss"
 | 
			
		||||
	"github.com/openimsdk/tools/s3/kodo"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
@ -278,15 +279,7 @@ type Third struct {
 | 
			
		||||
		Enable string `mapstructure:"enable"`
 | 
			
		||||
		Cos    Cos    `mapstructure:"cos"`
 | 
			
		||||
		Oss    Oss    `mapstructure:"oss"`
 | 
			
		||||
		Kodo   struct {
 | 
			
		||||
			Endpoint        string `mapstructure:"endpoint"`
 | 
			
		||||
			Bucket          string `mapstructure:"bucket"`
 | 
			
		||||
			BucketURL       string `mapstructure:"bucketURL"`
 | 
			
		||||
			AccessKeyID     string `mapstructure:"accessKeyID"`
 | 
			
		||||
			AccessKeySecret string `mapstructure:"accessKeySecret"`
 | 
			
		||||
			SessionToken    string `mapstructure:"sessionToken"`
 | 
			
		||||
			PublicRead      bool   `mapstructure:"publicRead"`
 | 
			
		||||
		} `mapstructure:"kodo"`
 | 
			
		||||
		Kodo   Kodo   `mapstructure:"kodo"`
 | 
			
		||||
		Aws struct {
 | 
			
		||||
			Endpoint        string `mapstructure:"endpoint"`
 | 
			
		||||
			Region          string `mapstructure:"region"`
 | 
			
		||||
@ -314,6 +307,16 @@ type Oss struct {
 | 
			
		||||
	PublicRead      bool   `mapstructure:"publicRead"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Kodo struct {
 | 
			
		||||
	Endpoint        string `mapstructure:"endpoint"`
 | 
			
		||||
	Bucket          string `mapstructure:"bucket"`
 | 
			
		||||
	BucketURL       string `mapstructure:"bucketURL"`
 | 
			
		||||
	AccessKeyID     string `mapstructure:"accessKeyID"`
 | 
			
		||||
	AccessKeySecret string `mapstructure:"accessKeySecret"`
 | 
			
		||||
	SessionToken    string `mapstructure:"sessionToken"`
 | 
			
		||||
	PublicRead      bool   `mapstructure:"publicRead"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type User struct {
 | 
			
		||||
	RPC struct {
 | 
			
		||||
		RegisterIP string `mapstructure:"registerIP"`
 | 
			
		||||
@ -524,6 +527,18 @@ func (o *Oss) Build() *oss.Config {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *Kodo) Build() *kodo.Config {
 | 
			
		||||
	return &kodo.Config{
 | 
			
		||||
		Endpoint:        o.Endpoint,
 | 
			
		||||
		Bucket:          o.Bucket,
 | 
			
		||||
		BucketURL:       o.BucketURL,
 | 
			
		||||
		AccessKeyID:     o.AccessKeyID,
 | 
			
		||||
		AccessKeySecret: o.AccessKeySecret,
 | 
			
		||||
		SessionToken:    o.SessionToken,
 | 
			
		||||
		PublicRead:      o.PublicRead,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (l *CacheConfig) Failed() time.Duration {
 | 
			
		||||
	return time.Second * time.Duration(l.FailedExpire)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user