pb

package
v0.0.0-...-707c192 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	AuthService_Authenticate_FullMethodName  = "/auth.pb.AuthService/Authenticate"
	AuthService_RefreshToken_FullMethodName  = "/auth.pb.AuthService/RefreshToken"
	AuthService_ValidateToken_FullMethodName = "/auth.pb.AuthService/ValidateToken"
	AuthService_ClearToken_FullMethodName    = "/auth.pb.AuthService/ClearToken"
	AuthService_Delete_FullMethodName        = "/auth.pb.AuthService/Delete"
	AuthService_AddBlocked_FullMethodName    = "/auth.pb.AuthService/AddBlocked"
)

Variables

View Source
var (
	AuthenticateRequest_AuthType_name = map[int32]string{
		0: "NONE",
		1: "CREATE_UID",
	}
	AuthenticateRequest_AuthType_value = map[string]int32{
		"NONE":       0,
		"CREATE_UID": 1,
	}
)

Enum value maps for AuthenticateRequest_AuthType.

View Source
var AuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "auth.pb.AuthService",
	HandlerType: (*AuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Authenticate",
			Handler:    _AuthService_Authenticate_Handler,
		},
		{
			MethodName: "RefreshToken",
			Handler:    _AuthService_RefreshToken_Handler,
		},
		{
			MethodName: "ValidateToken",
			Handler:    _AuthService_ValidateToken_Handler,
		},
		{
			MethodName: "ClearToken",
			Handler:    _AuthService_ClearToken_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _AuthService_Delete_Handler,
		},
		{
			MethodName: "AddBlocked",
			Handler:    _AuthService_AddBlocked_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "auth/auth.proto",
}

AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_auth_auth_proto protoreflect.FileDescriptor

Functions

func RegisterAuthServiceHandler

func RegisterAuthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAuthServiceHandler registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAuthServiceHandlerClient

func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error

RegisterAuthServiceHandlerClient registers the http handlers for service AuthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AuthServiceClient" to call the correct interceptors.

func RegisterAuthServiceHandlerFromEndpoint

func RegisterAuthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAuthServiceHandlerServer

func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error

RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux". UnaryRPC :call AuthServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead.

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	// Authenticate request a jwt token by id
	// return a jwt token and a refresh token
	// 请求一个 jwt token,用于身份认证
	Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error)
	// RefreshToken request a new jwt token by refresh token
	// return a jwt token and a refresh token
	// 刷新jwt token 过期时间
	RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*RefreshTokenResponse, error)
	// ValidateToken validate a jwt token
	// return a uid and data
	// 验证jwt token是否合法
	ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error)
	// ClearToken clear the uid's token
	// 清除uid对应的token
	ClearToken(ctx context.Context, in *ClearTokenRequest, opts ...grpc.CallOption) (*ClearTokenResponse, error)
	// Delete delete the id and uid info from db
	// 删除id对应的uid信息
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// AddBlocked add a uid to block list
	// if is_block is true, will block the uid for duration seconds
	// 添加到黑名单
	AddBlocked(ctx context.Context, in *BlockListRequest, opts ...grpc.CallOption) (*BlockListResponse, error)
}

AuthServiceClient is the client API for AuthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type AuthServiceServer

type AuthServiceServer interface {
	// Authenticate request a jwt token by id
	// return a jwt token and a refresh token
	// 请求一个 jwt token,用于身份认证
	Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error)
	// RefreshToken request a new jwt token by refresh token
	// return a jwt token and a refresh token
	// 刷新jwt token 过期时间
	RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error)
	// ValidateToken validate a jwt token
	// return a uid and data
	// 验证jwt token是否合法
	ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
	// ClearToken clear the uid's token
	// 清除uid对应的token
	ClearToken(context.Context, *ClearTokenRequest) (*ClearTokenResponse, error)
	// Delete delete the id and uid info from db
	// 删除id对应的uid信息
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// AddBlocked add a uid to block list
	// if is_block is true, will block the uid for duration seconds
	// 添加到黑名单
	AddBlocked(context.Context, *BlockListRequest) (*BlockListResponse, error)
}

AuthServiceServer is the server API for AuthService service. All implementations should embed UnimplementedAuthServiceServer for forward compatibility

type AuthenticateRequest

type AuthenticateRequest struct {
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	// account id/ room id
	Id   string                       `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Auth AuthenticateRequest_AuthType `protobuf:"varint,3,opt,name=auth,proto3,enum=auth.pb.AuthenticateRequest_AuthType" json:"auth,omitempty"`
	// custom your data ,will pack to token
	CustomData []byte `protobuf:"bytes,4,opt,name=custom_data,json=customData,proto3" json:"custom_data,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthenticateRequest) Descriptor deprecated

func (*AuthenticateRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead.

func (*AuthenticateRequest) GetAppId

func (x *AuthenticateRequest) GetAppId() string

func (*AuthenticateRequest) GetAuth

func (*AuthenticateRequest) GetCustomData

func (x *AuthenticateRequest) GetCustomData() []byte

func (*AuthenticateRequest) GetId

func (x *AuthenticateRequest) GetId() string

func (*AuthenticateRequest) ProtoMessage

func (*AuthenticateRequest) ProtoMessage()

func (*AuthenticateRequest) ProtoReflect

func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message

func (*AuthenticateRequest) Reset

func (x *AuthenticateRequest) Reset()

func (*AuthenticateRequest) String

func (x *AuthenticateRequest) String() string

type AuthenticateRequest_AuthType

type AuthenticateRequest_AuthType int32
const (
	// just create a jwt token by id, it is suitable for game room auth
	// 只创建一个jwt token,适用于游戏匹配房间验证
	AuthenticateRequest_NONE AuthenticateRequest_AuthType = 0
	// will create a uid by id, it is suitable for login auth
	// 通过id创建一个uid,适用于登录验证
	AuthenticateRequest_CREATE_UID AuthenticateRequest_AuthType = 1
)

func (AuthenticateRequest_AuthType) Descriptor

func (AuthenticateRequest_AuthType) Enum

func (AuthenticateRequest_AuthType) EnumDescriptor deprecated

func (AuthenticateRequest_AuthType) EnumDescriptor() ([]byte, []int)

Deprecated: Use AuthenticateRequest_AuthType.Descriptor instead.

func (AuthenticateRequest_AuthType) Number

func (AuthenticateRequest_AuthType) String

func (AuthenticateRequest_AuthType) Type

type AuthenticateResponse

type AuthenticateResponse struct {
	AccessToken  string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	Uid          string `protobuf:"bytes,3,opt,name=uid,proto3" json:"uid,omitempty"`
	// if is_override is true means already has a token
	// it is suitable for different device login logic
	// 如果为true,表示已经有一个token, 适用于不同设备重复登录逻辑
	IsOverride bool `protobuf:"varint,4,opt,name=is_override,json=isOverride,proto3" json:"is_override,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthenticateResponse) Descriptor deprecated

func (*AuthenticateResponse) Descriptor() ([]byte, []int)

Deprecated: Use AuthenticateResponse.ProtoReflect.Descriptor instead.

func (*AuthenticateResponse) GetAccessToken

func (x *AuthenticateResponse) GetAccessToken() string

func (*AuthenticateResponse) GetIsOverride

func (x *AuthenticateResponse) GetIsOverride() bool

func (*AuthenticateResponse) GetRefreshToken

func (x *AuthenticateResponse) GetRefreshToken() string

func (*AuthenticateResponse) GetUid

func (x *AuthenticateResponse) GetUid() string

func (*AuthenticateResponse) ProtoMessage

func (*AuthenticateResponse) ProtoMessage()

func (*AuthenticateResponse) ProtoReflect

func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message

func (*AuthenticateResponse) Reset

func (x *AuthenticateResponse) Reset()

func (*AuthenticateResponse) String

func (x *AuthenticateResponse) String() string

type BlockListRequest

type BlockListRequest struct {
	Uid      string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	IsBlock  bool   `protobuf:"varint,2,opt,name=is_block,json=isBlock,proto3" json:"is_block,omitempty"` // true: block, false: unblock
	Duration int64  `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"`              // block duration(Seconds) (if is_block is true)
	// contains filtered or unexported fields
}

func (*BlockListRequest) Descriptor deprecated

func (*BlockListRequest) Descriptor() ([]byte, []int)

Deprecated: Use BlockListRequest.ProtoReflect.Descriptor instead.

func (*BlockListRequest) GetDuration

func (x *BlockListRequest) GetDuration() int64

func (*BlockListRequest) GetIsBlock

func (x *BlockListRequest) GetIsBlock() bool

func (*BlockListRequest) GetUid

func (x *BlockListRequest) GetUid() string

func (*BlockListRequest) ProtoMessage

func (*BlockListRequest) ProtoMessage()

func (*BlockListRequest) ProtoReflect

func (x *BlockListRequest) ProtoReflect() protoreflect.Message

func (*BlockListRequest) Reset

func (x *BlockListRequest) Reset()

func (*BlockListRequest) String

func (x *BlockListRequest) String() string

type BlockListResponse

type BlockListResponse struct {
	// contains filtered or unexported fields
}

func (*BlockListResponse) Descriptor deprecated

func (*BlockListResponse) Descriptor() ([]byte, []int)

Deprecated: Use BlockListResponse.ProtoReflect.Descriptor instead.

func (*BlockListResponse) ProtoMessage

func (*BlockListResponse) ProtoMessage()

func (*BlockListResponse) ProtoReflect

func (x *BlockListResponse) ProtoReflect() protoreflect.Message

func (*BlockListResponse) Reset

func (x *BlockListResponse) Reset()

func (*BlockListResponse) String

func (x *BlockListResponse) String() string

type ClearTokenRequest

type ClearTokenRequest struct {
	Uid         string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ClearTokenRequest) Descriptor deprecated

func (*ClearTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use ClearTokenRequest.ProtoReflect.Descriptor instead.

func (*ClearTokenRequest) GetAccessToken

func (x *ClearTokenRequest) GetAccessToken() string

func (*ClearTokenRequest) GetUid

func (x *ClearTokenRequest) GetUid() string

func (*ClearTokenRequest) ProtoMessage

func (*ClearTokenRequest) ProtoMessage()

func (*ClearTokenRequest) ProtoReflect

func (x *ClearTokenRequest) ProtoReflect() protoreflect.Message

func (*ClearTokenRequest) Reset

func (x *ClearTokenRequest) Reset()

func (*ClearTokenRequest) String

func (x *ClearTokenRequest) String() string

type ClearTokenResponse

type ClearTokenResponse struct {
	// contains filtered or unexported fields
}

func (*ClearTokenResponse) Descriptor deprecated

func (*ClearTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use ClearTokenResponse.ProtoReflect.Descriptor instead.

func (*ClearTokenResponse) ProtoMessage

func (*ClearTokenResponse) ProtoMessage()

func (*ClearTokenResponse) ProtoReflect

func (x *ClearTokenResponse) ProtoReflect() protoreflect.Message

func (*ClearTokenResponse) Reset

func (x *ClearTokenResponse) Reset()

func (*ClearTokenResponse) String

func (x *ClearTokenResponse) String() string

type DeleteRequest

type DeleteRequest struct {
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	Id    string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetAppId

func (x *DeleteRequest) GetAppId() string

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

func (*DeleteResponse) Descriptor() ([]byte, []int)

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

func (x *DeleteResponse) ProtoReflect() protoreflect.Message

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type RefreshTokenRequest

type RefreshTokenRequest struct {
	RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshTokenRequest) Descriptor deprecated

func (*RefreshTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.

func (*RefreshTokenRequest) GetRefreshToken

func (x *RefreshTokenRequest) GetRefreshToken() string

func (*RefreshTokenRequest) ProtoMessage

func (*RefreshTokenRequest) ProtoMessage()

func (*RefreshTokenRequest) ProtoReflect

func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message

func (*RefreshTokenRequest) Reset

func (x *RefreshTokenRequest) Reset()

func (*RefreshTokenRequest) String

func (x *RefreshTokenRequest) String() string

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken  string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	// contains filtered or unexported fields
}

func (*RefreshTokenResponse) Descriptor deprecated

func (*RefreshTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use RefreshTokenResponse.ProtoReflect.Descriptor instead.

func (*RefreshTokenResponse) GetAccessToken

func (x *RefreshTokenResponse) GetAccessToken() string

func (*RefreshTokenResponse) GetRefreshToken

func (x *RefreshTokenResponse) GetRefreshToken() string

func (*RefreshTokenResponse) ProtoMessage

func (*RefreshTokenResponse) ProtoMessage()

func (*RefreshTokenResponse) ProtoReflect

func (x *RefreshTokenResponse) ProtoReflect() protoreflect.Message

func (*RefreshTokenResponse) Reset

func (x *RefreshTokenResponse) Reset()

func (*RefreshTokenResponse) String

func (x *RefreshTokenResponse) String() string

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct {
}

UnimplementedAuthServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedAuthServiceServer) AddBlocked

func (UnimplementedAuthServiceServer) Authenticate

func (UnimplementedAuthServiceServer) ClearToken

func (UnimplementedAuthServiceServer) Delete

func (UnimplementedAuthServiceServer) RefreshToken

func (UnimplementedAuthServiceServer) ValidateToken

type UnsafeAuthServiceServer

type UnsafeAuthServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthServiceServer will result in compilation errors.

type ValidateTokenRequest

type ValidateTokenRequest struct {
	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ValidateTokenRequest) Descriptor deprecated

func (*ValidateTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.

func (*ValidateTokenRequest) GetAccessToken

func (x *ValidateTokenRequest) GetAccessToken() string

func (*ValidateTokenRequest) ProtoMessage

func (*ValidateTokenRequest) ProtoMessage()

func (*ValidateTokenRequest) ProtoReflect

func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message

func (*ValidateTokenRequest) Reset

func (x *ValidateTokenRequest) Reset()

func (*ValidateTokenRequest) String

func (x *ValidateTokenRequest) String() string

type ValidateTokenResponse

type ValidateTokenResponse struct {
	Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	// custom data from token
	CustomData []byte `protobuf:"bytes,2,opt,name=custom_data,json=customData,proto3" json:"custom_data,omitempty"`
	// contains filtered or unexported fields
}

func (*ValidateTokenResponse) Descriptor deprecated

func (*ValidateTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use ValidateTokenResponse.ProtoReflect.Descriptor instead.

func (*ValidateTokenResponse) GetCustomData

func (x *ValidateTokenResponse) GetCustomData() []byte

func (*ValidateTokenResponse) GetUid

func (x *ValidateTokenResponse) GetUid() string

func (*ValidateTokenResponse) ProtoMessage

func (*ValidateTokenResponse) ProtoMessage()

func (*ValidateTokenResponse) ProtoReflect

func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message

func (*ValidateTokenResponse) Reset

func (x *ValidateTokenResponse) Reset()

func (*ValidateTokenResponse) String

func (x *ValidateTokenResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL