This commit is contained in:
withchao 2023-03-14 19:33:44 +08:00
parent 9bb30406ee
commit 6a95025e41
10 changed files with 334 additions and 90 deletions

View File

@ -92,6 +92,11 @@ sdk:
#对象存储服务以下配置二选一目前支持两种腾讯云和minio二者配置好其中一种即可如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器
credential: #腾讯cos发送图片、视频、文件时需要请自行申请后替换必须修改
object:
enable: minio
apiURL: http://127.0.0.1:10002/api/third/object?name=
tencent:
appID:
region:
@ -103,7 +108,7 @@ credential: #腾讯cos发送图片、视频、文件时需要请自行申
appBucket: app # 存储app的桶
location: us-east-1
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
# endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化IM server连接minio走内网地址访问
accessKeyID: root
secretAccessKey: openIM123
@ -129,7 +134,6 @@ credential: #腾讯cos发送图片、视频、文件时需要请自行申
externalId: #角色扩展Id
roleSessionName: #角色SESSION名称
rpcport: #rpc服务端口 默认即可
openImUserPort: [ 10110 ]
openImFriendPort: [ 10120 ]

View File

@ -111,6 +111,9 @@ func NewGinRouter(zk discoveryregistry.SvcDiscoveryRegistry) *gin.Engine {
thirdGroup.POST("/apply_put", t.ApplyPut)
thirdGroup.POST("/get_put", t.GetPut)
thirdGroup.POST("/confirm_put", t.ConfirmPut)
thirdGroup.GET("/get_url", t.GetURL)
thirdGroup.GET("/object", t.GetURL)
}
////Message
chatGroup := r.Group("/msg")

View File

@ -4,10 +4,11 @@ import (
"OpenIM/internal/api/a2r"
"OpenIM/pkg/common/config"
"OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/errs"
"OpenIM/pkg/proto/third"
"context"
"github.com/gin-gonic/gin"
"net/http"
)
var _ context.Context // 解决goland编辑器bug
@ -55,3 +56,34 @@ func (o *Third) FcmUpdateToken(c *gin.Context) {
func (o *Third) SetAppBadge(c *gin.Context) {
a2r.Call(third.ThirdClient.SetAppBadge, o.client, c)
}
func (o *Third) GetURL(c *gin.Context) {
if c.Request.Method == http.MethodPost {
a2r.Call(third.ThirdClient.GetUrl, o.client, c)
return
}
name := c.Query("name")
if name == "" {
c.String(http.StatusBadRequest, "name is empty")
return
}
client, err := o.client()
if err != nil {
c.String(http.StatusInternalServerError, err.Error())
return
}
resp, err := client.GetUrl(c, &third.GetUrlReq{Name: name})
if err != nil {
if errs.ErrArgs.Is(err) {
c.String(http.StatusBadRequest, err.Error())
return
}
if errs.ErrRecordNotFound.Is(err) {
c.String(http.StatusNotFound, err.Error())
return
}
c.String(http.StatusInternalServerError, err.Error())
return
}
c.Redirect(http.StatusTemporaryRedirect, resp.Url)
}

View File

@ -18,6 +18,10 @@ func (t *thirdServer) ConfirmPut(ctx context.Context, req *third.ConfirmPutReq)
return t.s3dataBase.ConfirmPut(ctx, req)
}
func (t *thirdServer) GetUrl(ctx context.Context, req *third.GetUrlReq) (*third.GetUrlResp, error) {
return t.s3dataBase.GetUrl(ctx, req)
}
func (t *thirdServer) CleanObject(ctx context.Context, now time.Time) {
t.s3dataBase.CleanExpirationObject(ctx, now)
}

View File

@ -68,6 +68,11 @@ type config struct {
DataDir []string `yaml:"dataDir"`
}
Credential struct {
}
Object struct {
Enable string `yaml:"enable"`
ApiURL string `yaml:"apiURL"`
Tencent struct {
AppID string `yaml:"appID"`
Region string `yaml:"region"`

View File

@ -2,9 +2,11 @@ package controller
import "C"
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/db/obj"
"OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/errs"
"OpenIM/pkg/proto/third"
"OpenIM/pkg/utils"
"context"
@ -22,6 +24,7 @@ type S3Database interface {
ApplyPut(ctx context.Context, req *third.ApplyPutReq) (*third.ApplyPutResp, error)
GetPut(ctx context.Context, req *third.GetPutReq) (*third.GetPutResp, error)
ConfirmPut(ctx context.Context, req *third.ConfirmPutReq) (*third.ConfirmPutResp, error)
GetUrl(ctx context.Context, req *third.GetUrlReq) (*third.GetUrlResp, error)
CleanExpirationObject(ctx context.Context, t time.Time)
}
@ -82,10 +85,12 @@ func (c *s3Database) CheckHash(hash string) error {
}
func (c *s3Database) urlName(name string) string {
if name[0] != '/' {
name = "/" + name
}
return "http://127.0.0.1:8080" + name
//if name[0] != '/' {
// name = "/" + name
//}
//config.Config.Credential.ObjectURL + name
//return "http://127.0.0.1:8080" + name
return config.Config.Credential.ObjectURL + name
}
func (c *s3Database) UUID() string {
@ -356,6 +361,25 @@ func (c *s3Database) ConfirmPut(ctx context.Context, req *third.ConfirmPutReq) (
}, nil
}
func (c *s3Database) GetUrl(ctx context.Context, req *third.GetUrlReq) (*third.GetUrlResp, error) {
info, err := c.info.Take(ctx, req.Name)
if err != nil {
return nil, err
}
if info.ExpirationTime != nil && info.ExpirationTime.Before(time.Now()) {
return nil, errs.ErrRecordNotFound.Wrap("object expired")
}
hash, err := c.hash.Take(ctx, info.Hash, c.obj.Name())
if err != nil {
return nil, err
}
return &third.GetUrlResp{
Url: c.obj.GetURL(hash.Bucket, hash.Name),
Size: hash.Size,
Hash: hash.Hash,
}, nil
}
func (c *s3Database) CleanExpirationObject(ctx context.Context, t time.Time) {
// 清理上传产生的临时文件
c.cleanPutTemp(ctx, t, 10)

View File

@ -1,12 +1,15 @@
package obj
import (
"OpenIM/pkg/common/config"
"context"
"errors"
"fmt"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7/pkg/s3utils"
"net/http"
"net/url"
"time"
)
@ -15,12 +18,29 @@ func NewMinioClient() {
}
func NewMinioInterface() (Interface, error) {
//client, err := minio.New("127.0.0.1:9000", &minio.Options{
// Creds: credentials.NewStaticV4("minioadmin", "minioadmin", ""),
// Secure: false,
//})
if true {
return &minioImpl{}, nil // todo
}
conf := config.Config.Object.Minio
u, err := url.Parse(conf.Endpoint)
if err != nil {
return nil, fmt.Errorf("minio endpoint parse %w", err)
}
if u.Scheme != "http" && u.Scheme != "https" {
return nil, fmt.Errorf("invalid minio endpoint scheme %s", u.Scheme)
}
client, err := minio.New(u.Host, &minio.Options{
Creds: credentials.NewStaticV4(conf.AccessKeyID, conf.SecretAccessKey, ""),
Secure: false,
})
if err != nil {
return nil, fmt.Errorf("minio new client %w", err)
}
// todo 初始化连接和桶
return &minioImpl{}, nil
return &minioImpl{
client: client,
//tempBucket: conf.Bucket,
}, nil
}
type minioImpl struct {

View File

@ -9,6 +9,7 @@ import (
type CodeError interface {
Code() int
Msg() string
Is(err error) bool
Wrap(msg ...string) error
error
}
@ -38,6 +39,17 @@ func (e *codeError) Wrap(w ...string) error {
return errors.Wrap(e, strings.Join(w, ", "))
}
func (e *codeError) Is(err error) bool {
if err == nil {
return false
}
codeErr, ok := Unwrap(err).(CodeError)
if ok {
return codeErr.Code() == e.code
}
return false
}
func (e *codeError) Error() string {
return fmt.Sprintf("[%d]%s", e.code, e.msg)
}

View File

@ -39,7 +39,7 @@ func (m *ApplyPutReq) Reset() { *m = ApplyPutReq{} }
func (m *ApplyPutReq) String() string { return proto.CompactTextString(m) }
func (*ApplyPutReq) ProtoMessage() {}
func (*ApplyPutReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{0}
return fileDescriptor_third_85db3e967ff9b8c1, []int{0}
}
func (m *ApplyPutReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ApplyPutReq.Unmarshal(m, b)
@ -109,7 +109,7 @@ func (m *ApplyPutResp) Reset() { *m = ApplyPutResp{} }
func (m *ApplyPutResp) String() string { return proto.CompactTextString(m) }
func (*ApplyPutResp) ProtoMessage() {}
func (*ApplyPutResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{1}
return fileDescriptor_third_85db3e967ff9b8c1, []int{1}
}
func (m *ApplyPutResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ApplyPutResp.Unmarshal(m, b)
@ -168,7 +168,7 @@ func (m *ConfirmPutReq) Reset() { *m = ConfirmPutReq{} }
func (m *ConfirmPutReq) String() string { return proto.CompactTextString(m) }
func (*ConfirmPutReq) ProtoMessage() {}
func (*ConfirmPutReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{2}
return fileDescriptor_third_85db3e967ff9b8c1, []int{2}
}
func (m *ConfirmPutReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ConfirmPutReq.Unmarshal(m, b)
@ -206,7 +206,7 @@ func (m *ConfirmPutResp) Reset() { *m = ConfirmPutResp{} }
func (m *ConfirmPutResp) String() string { return proto.CompactTextString(m) }
func (*ConfirmPutResp) ProtoMessage() {}
func (*ConfirmPutResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{3}
return fileDescriptor_third_85db3e967ff9b8c1, []int{3}
}
func (m *ConfirmPutResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ConfirmPutResp.Unmarshal(m, b)
@ -233,6 +233,98 @@ func (m *ConfirmPutResp) GetUrl() string {
return ""
}
type GetUrlReq struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUrlReq) Reset() { *m = GetUrlReq{} }
func (m *GetUrlReq) String() string { return proto.CompactTextString(m) }
func (*GetUrlReq) ProtoMessage() {}
func (*GetUrlReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_85db3e967ff9b8c1, []int{4}
}
func (m *GetUrlReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUrlReq.Unmarshal(m, b)
}
func (m *GetUrlReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUrlReq.Marshal(b, m, deterministic)
}
func (dst *GetUrlReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUrlReq.Merge(dst, src)
}
func (m *GetUrlReq) XXX_Size() int {
return xxx_messageInfo_GetUrlReq.Size(m)
}
func (m *GetUrlReq) XXX_DiscardUnknown() {
xxx_messageInfo_GetUrlReq.DiscardUnknown(m)
}
var xxx_messageInfo_GetUrlReq proto.InternalMessageInfo
func (m *GetUrlReq) GetName() string {
if m != nil {
return m.Name
}
return ""
}
type GetUrlResp struct {
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
Hash string `protobuf:"bytes,3,opt,name=hash" json:"hash,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUrlResp) Reset() { *m = GetUrlResp{} }
func (m *GetUrlResp) String() string { return proto.CompactTextString(m) }
func (*GetUrlResp) ProtoMessage() {}
func (*GetUrlResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_85db3e967ff9b8c1, []int{5}
}
func (m *GetUrlResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUrlResp.Unmarshal(m, b)
}
func (m *GetUrlResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUrlResp.Marshal(b, m, deterministic)
}
func (dst *GetUrlResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUrlResp.Merge(dst, src)
}
func (m *GetUrlResp) XXX_Size() int {
return xxx_messageInfo_GetUrlResp.Size(m)
}
func (m *GetUrlResp) XXX_DiscardUnknown() {
xxx_messageInfo_GetUrlResp.DiscardUnknown(m)
}
var xxx_messageInfo_GetUrlResp proto.InternalMessageInfo
func (m *GetUrlResp) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *GetUrlResp) GetSize() int64 {
if m != nil {
return m.Size
}
return 0
}
func (m *GetUrlResp) GetHash() string {
if m != nil {
return m.Hash
}
return ""
}
type GetPutReq struct {
PutID string `protobuf:"bytes,1,opt,name=putID" json:"putID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -244,7 +336,7 @@ func (m *GetPutReq) Reset() { *m = GetPutReq{} }
func (m *GetPutReq) String() string { return proto.CompactTextString(m) }
func (*GetPutReq) ProtoMessage() {}
func (*GetPutReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{4}
return fileDescriptor_third_85db3e967ff9b8c1, []int{6}
}
func (m *GetPutReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetPutReq.Unmarshal(m, b)
@ -283,7 +375,7 @@ func (m *GetPutFragment) Reset() { *m = GetPutFragment{} }
func (m *GetPutFragment) String() string { return proto.CompactTextString(m) }
func (*GetPutFragment) ProtoMessage() {}
func (*GetPutFragment) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{5}
return fileDescriptor_third_85db3e967ff9b8c1, []int{7}
}
func (m *GetPutFragment) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetPutFragment.Unmarshal(m, b)
@ -333,7 +425,7 @@ func (m *GetPutResp) Reset() { *m = GetPutResp{} }
func (m *GetPutResp) String() string { return proto.CompactTextString(m) }
func (*GetPutResp) ProtoMessage() {}
func (*GetPutResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{6}
return fileDescriptor_third_85db3e967ff9b8c1, []int{8}
}
func (m *GetPutResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetPutResp.Unmarshal(m, b)
@ -406,7 +498,7 @@ func (m *GetSignalInvitationInfoReq) Reset() { *m = GetSignalInvitationI
func (m *GetSignalInvitationInfoReq) String() string { return proto.CompactTextString(m) }
func (*GetSignalInvitationInfoReq) ProtoMessage() {}
func (*GetSignalInvitationInfoReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{7}
return fileDescriptor_third_85db3e967ff9b8c1, []int{9}
}
func (m *GetSignalInvitationInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSignalInvitationInfoReq.Unmarshal(m, b)
@ -445,7 +537,7 @@ func (m *GetSignalInvitationInfoResp) Reset() { *m = GetSignalInvitation
func (m *GetSignalInvitationInfoResp) String() string { return proto.CompactTextString(m) }
func (*GetSignalInvitationInfoResp) ProtoMessage() {}
func (*GetSignalInvitationInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{8}
return fileDescriptor_third_85db3e967ff9b8c1, []int{10}
}
func (m *GetSignalInvitationInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSignalInvitationInfoResp.Unmarshal(m, b)
@ -490,7 +582,7 @@ func (m *GetSignalInvitationInfoStartAppReq) Reset() { *m = GetSignalInv
func (m *GetSignalInvitationInfoStartAppReq) String() string { return proto.CompactTextString(m) }
func (*GetSignalInvitationInfoStartAppReq) ProtoMessage() {}
func (*GetSignalInvitationInfoStartAppReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{9}
return fileDescriptor_third_85db3e967ff9b8c1, []int{11}
}
func (m *GetSignalInvitationInfoStartAppReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSignalInvitationInfoStartAppReq.Unmarshal(m, b)
@ -529,7 +621,7 @@ func (m *GetSignalInvitationInfoStartAppResp) Reset() { *m = GetSignalIn
func (m *GetSignalInvitationInfoStartAppResp) String() string { return proto.CompactTextString(m) }
func (*GetSignalInvitationInfoStartAppResp) ProtoMessage() {}
func (*GetSignalInvitationInfoStartAppResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{10}
return fileDescriptor_third_85db3e967ff9b8c1, []int{12}
}
func (m *GetSignalInvitationInfoStartAppResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSignalInvitationInfoStartAppResp.Unmarshal(m, b)
@ -577,7 +669,7 @@ func (m *FcmUpdateTokenReq) Reset() { *m = FcmUpdateTokenReq{} }
func (m *FcmUpdateTokenReq) String() string { return proto.CompactTextString(m) }
func (*FcmUpdateTokenReq) ProtoMessage() {}
func (*FcmUpdateTokenReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{11}
return fileDescriptor_third_85db3e967ff9b8c1, []int{13}
}
func (m *FcmUpdateTokenReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FcmUpdateTokenReq.Unmarshal(m, b)
@ -635,7 +727,7 @@ func (m *FcmUpdateTokenResp) Reset() { *m = FcmUpdateTokenResp{} }
func (m *FcmUpdateTokenResp) String() string { return proto.CompactTextString(m) }
func (*FcmUpdateTokenResp) ProtoMessage() {}
func (*FcmUpdateTokenResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{12}
return fileDescriptor_third_85db3e967ff9b8c1, []int{14}
}
func (m *FcmUpdateTokenResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FcmUpdateTokenResp.Unmarshal(m, b)
@ -667,7 +759,7 @@ func (m *SetAppBadgeReq) Reset() { *m = SetAppBadgeReq{} }
func (m *SetAppBadgeReq) String() string { return proto.CompactTextString(m) }
func (*SetAppBadgeReq) ProtoMessage() {}
func (*SetAppBadgeReq) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{13}
return fileDescriptor_third_85db3e967ff9b8c1, []int{15}
}
func (m *SetAppBadgeReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetAppBadgeReq.Unmarshal(m, b)
@ -711,7 +803,7 @@ func (m *SetAppBadgeResp) Reset() { *m = SetAppBadgeResp{} }
func (m *SetAppBadgeResp) String() string { return proto.CompactTextString(m) }
func (*SetAppBadgeResp) ProtoMessage() {}
func (*SetAppBadgeResp) Descriptor() ([]byte, []int) {
return fileDescriptor_third_ed6a664e4920a6b2, []int{14}
return fileDescriptor_third_85db3e967ff9b8c1, []int{16}
}
func (m *SetAppBadgeResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetAppBadgeResp.Unmarshal(m, b)
@ -736,6 +828,8 @@ func init() {
proto.RegisterType((*ApplyPutResp)(nil), "OpenIMServer.third.ApplyPutResp")
proto.RegisterType((*ConfirmPutReq)(nil), "OpenIMServer.third.ConfirmPutReq")
proto.RegisterType((*ConfirmPutResp)(nil), "OpenIMServer.third.ConfirmPutResp")
proto.RegisterType((*GetUrlReq)(nil), "OpenIMServer.third.GetUrlReq")
proto.RegisterType((*GetUrlResp)(nil), "OpenIMServer.third.GetUrlResp")
proto.RegisterType((*GetPutReq)(nil), "OpenIMServer.third.GetPutReq")
proto.RegisterType((*GetPutFragment)(nil), "OpenIMServer.third.GetPutFragment")
proto.RegisterType((*GetPutResp)(nil), "OpenIMServer.third.GetPutResp")
@ -763,6 +857,7 @@ type ThirdClient interface {
ApplyPut(ctx context.Context, in *ApplyPutReq, opts ...grpc.CallOption) (*ApplyPutResp, error)
GetPut(ctx context.Context, in *GetPutReq, opts ...grpc.CallOption) (*GetPutResp, error)
ConfirmPut(ctx context.Context, in *ConfirmPutReq, opts ...grpc.CallOption) (*ConfirmPutResp, error)
GetUrl(ctx context.Context, in *GetUrlReq, opts ...grpc.CallOption) (*GetUrlResp, error)
GetSignalInvitationInfo(ctx context.Context, in *GetSignalInvitationInfoReq, opts ...grpc.CallOption) (*GetSignalInvitationInfoResp, error)
GetSignalInvitationInfoStartApp(ctx context.Context, in *GetSignalInvitationInfoStartAppReq, opts ...grpc.CallOption) (*GetSignalInvitationInfoStartAppResp, error)
FcmUpdateToken(ctx context.Context, in *FcmUpdateTokenReq, opts ...grpc.CallOption) (*FcmUpdateTokenResp, error)
@ -804,6 +899,15 @@ func (c *thirdClient) ConfirmPut(ctx context.Context, in *ConfirmPutReq, opts ..
return out, nil
}
func (c *thirdClient) GetUrl(ctx context.Context, in *GetUrlReq, opts ...grpc.CallOption) (*GetUrlResp, error) {
out := new(GetUrlResp)
err := grpc.Invoke(ctx, "/OpenIMServer.third.third/GetUrl", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *thirdClient) GetSignalInvitationInfo(ctx context.Context, in *GetSignalInvitationInfoReq, opts ...grpc.CallOption) (*GetSignalInvitationInfoResp, error) {
out := new(GetSignalInvitationInfoResp)
err := grpc.Invoke(ctx, "/OpenIMServer.third.third/GetSignalInvitationInfo", in, out, c.cc, opts...)
@ -846,6 +950,7 @@ type ThirdServer interface {
ApplyPut(context.Context, *ApplyPutReq) (*ApplyPutResp, error)
GetPut(context.Context, *GetPutReq) (*GetPutResp, error)
ConfirmPut(context.Context, *ConfirmPutReq) (*ConfirmPutResp, error)
GetUrl(context.Context, *GetUrlReq) (*GetUrlResp, error)
GetSignalInvitationInfo(context.Context, *GetSignalInvitationInfoReq) (*GetSignalInvitationInfoResp, error)
GetSignalInvitationInfoStartApp(context.Context, *GetSignalInvitationInfoStartAppReq) (*GetSignalInvitationInfoStartAppResp, error)
FcmUpdateToken(context.Context, *FcmUpdateTokenReq) (*FcmUpdateTokenResp, error)
@ -910,6 +1015,24 @@ func _Third_ConfirmPut_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Third_GetUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUrlReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ThirdServer).GetUrl(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/OpenIMServer.third.third/GetUrl",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ThirdServer).GetUrl(ctx, req.(*GetUrlReq))
}
return interceptor(ctx, in, info, handler)
}
func _Third_GetSignalInvitationInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSignalInvitationInfoReq)
if err := dec(in); err != nil {
@ -998,6 +1121,10 @@ var _Third_serviceDesc = grpc.ServiceDesc{
MethodName: "ConfirmPut",
Handler: _Third_ConfirmPut_Handler,
},
{
MethodName: "GetUrl",
Handler: _Third_GetUrl_Handler,
},
{
MethodName: "GetSignalInvitationInfo",
Handler: _Third_GetSignalInvitationInfo_Handler,
@ -1019,53 +1146,55 @@ var _Third_serviceDesc = grpc.ServiceDesc{
Metadata: "third/third.proto",
}
func init() { proto.RegisterFile("third/third.proto", fileDescriptor_third_ed6a664e4920a6b2) }
func init() { proto.RegisterFile("third/third.proto", fileDescriptor_third_85db3e967ff9b8c1) }
var fileDescriptor_third_ed6a664e4920a6b2 = []byte{
// 717 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xc1, 0x6e, 0xd3, 0x4a,
0x14, 0x95, 0x93, 0x26, 0xaf, 0xb9, 0xe9, 0x4b, 0x5f, 0xaf, 0xaa, 0x47, 0x64, 0x4a, 0x9b, 0x4e,
0xd5, 0x92, 0x4d, 0x13, 0xa9, 0x48, 0x80, 0x04, 0x42, 0xb4, 0x45, 0xad, 0x82, 0x88, 0x1a, 0x39,
0x2d, 0x0b, 0x36, 0xc8, 0x24, 0x93, 0xc4, 0xaa, 0x3d, 0x1e, 0x3c, 0xe3, 0x16, 0xfa, 0x07, 0x88,
0x1d, 0x5f, 0xc3, 0x0a, 0xf1, 0x01, 0x7c, 0x14, 0xf2, 0xd8, 0x49, 0xec, 0xc4, 0x49, 0x28, 0x1b,
0xd8, 0x44, 0x33, 0xc7, 0xe7, 0x9e, 0x39, 0x73, 0xe7, 0xde, 0xab, 0xc0, 0x9a, 0x1c, 0x58, 0x5e,
0xb7, 0xae, 0x7e, 0x6b, 0xdc, 0x73, 0xa5, 0x8b, 0x78, 0xc6, 0x29, 0x6b, 0x34, 0xdb, 0xd4, 0xbb,
0xa2, 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x8e, 0xaf, 0xa1,
0x18, 0xab, 0x3d, 0x4c, 0x7d, 0xa4, 0x64, 0xb9, 0xeb, 0x3b, 0x0b, 0x39, 0x82, 0x1f, 0x6d, 0xbe,
0xd9, 0x08, 0x59, 0xb1, 0x7f, 0x18, 0x8a, 0xf9, 0x44, 0xfd, 0xbe, 0xcb, 0x2b, 0xe8, 0xc1, 0xcf,
0x00, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x2e, 0xa0, 0xaa, 0xb7, 0x08, 0x00, 0x00,
var fileDescriptor_third_85db3e967ff9b8c1 = []byte{
// 746 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xc1, 0x6e, 0xda, 0x4a,
0x14, 0x95, 0x21, 0xf0, 0xc2, 0x25, 0x8f, 0xbc, 0x8c, 0xa2, 0xf7, 0x90, 0x5f, 0x9a, 0x90, 0x89,
0x92, 0xb2, 0x09, 0x48, 0xa9, 0xd4, 0x56, 0x6a, 0x55, 0x35, 0x49, 0x45, 0x44, 0x55, 0x14, 0x64,
0x42, 0x17, 0xdd, 0x54, 0x2e, 0x0c, 0x60, 0xc5, 0x8c, 0xa7, 0x33, 0xe3, 0xa4, 0xcd, 0x0f, 0x54,
0x55, 0x77, 0xfd, 0x9a, 0x2e, 0xfb, 0x01, 0xfd, 0xa8, 0xca, 0x63, 0x1b, 0x6c, 0xb0, 0x21, 0xe9,
0xa6, 0xdd, 0x58, 0x33, 0xc7, 0xe7, 0x9e, 0x39, 0x73, 0x7d, 0xef, 0x05, 0xd8, 0x90, 0x23, 0x8b,
0xf7, 0xeb, 0xea, 0x59, 0x63, 0xdc, 0x91, 0x0e, 0x42, 0xe7, 0x8c, 0xd0, 0x66, 0xab, 0x43, 0xf8,
0x15, 0xe1, 0x35, 0xf5, 0x46, 0xbf, 0xef, 0x61, 0x87, 0xcd, 0xd6, 0xa1, 0x8f, 0xd6, 0xd9, 0x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, 0x86, 0xde, 0x42, 0x29, 0x5e, 0xcb, 0x68,
0x3f, 0x49, 0x6a, 0xae, 0xf5, 0xf4, 0x83, 0xdb, 0xd0, 0x04, 0x43, 0xaf, 0xa1, 0x18, 0x29, 0x62,
0x94, 0xf8, 0xb5, 0xe3, 0x7d, 0xa3, 0xef, 0x2d, 0xe5, 0x08, 0x76, 0xb2, 0xfd, 0x66, 0xcb, 0x67,
0x45, 0xfe, 0x13, 0x29, 0xe6, 0x13, 0xf5, 0x7c, 0x97, 0x57, 0xd0, 0x83, 0x9f, 0x01, 0x00, 0x00,
0xff, 0xff, 0x14, 0x1d, 0x29, 0xf8, 0x69, 0x09, 0x00, 0x00,
}

View File

@ -15,7 +15,7 @@ message ApplyPutResp {
string url = 1;
string putID = 2;
int64 fragmentSize = 3;
// int64 expirationTime = 4;
// int64 expirationTime = 4;
repeated string PutURLs = 5;
}
@ -27,6 +27,16 @@ message ConfirmPutResp {
string url = 1;
}
message GetUrlReq {
string name = 1;
}
message GetUrlResp {
string url = 1;
int64 size = 2;
string hash = 3;
}
message GetPutReq {
string putID = 1;
}
@ -85,6 +95,7 @@ service third {
rpc ApplyPut(ApplyPutReq) returns(ApplyPutResp);
rpc GetPut(GetPutReq) returns(GetPutResp);
rpc ConfirmPut(ConfirmPutReq) returns(ConfirmPutResp);
rpc GetUrl(GetUrlReq) returns(GetUrlResp);
rpc GetSignalInvitationInfo(GetSignalInvitationInfoReq) returns(GetSignalInvitationInfoResp);
rpc GetSignalInvitationInfoStartApp(GetSignalInvitationInfoStartAppReq) returns(GetSignalInvitationInfoStartAppResp);