pb

package
v0.0.0-...-364af84 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	DriverEnum_name = map[int32]string{
		0: "Digit",
		1: "String",
		2: "Math",
		3: "Chinese",
		4: "Audio",
		5: "Language",
	}
	DriverEnum_value = map[string]int32{
		"Digit":    0,
		"String":   1,
		"Math":     2,
		"Chinese":  3,
		"Audio":    4,
		"Language": 5,
	}
)

Enum value maps for DriverEnum.

View Source
var (
	LangEnum_name = map[int32]string{
		0: "Zh",
		1: "Latin",
		2: "Ko",
		3: "Jp",
		4: "Ru",
		5: "Th",
		6: "Greek",
		7: "Arabic",
		8: "Hebrew",
	}
	LangEnum_value = map[string]int32{
		"Zh":     0,
		"Latin":  1,
		"Ko":     2,
		"Jp":     3,
		"Ru":     4,
		"Th":     5,
		"Greek":  6,
		"Arabic": 7,
		"Hebrew": 8,
	}
)

Enum value maps for LangEnum.

View Source
var File_vcode_proto protoreflect.FileDescriptor
View Source
var VcodeService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.VcodeService",
	HandlerType: (*VcodeServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Generate",
			Handler:    _VcodeService_Generate_Handler,
		},
		{
			MethodName: "Verify",
			Handler:    _VcodeService_Verify_Handler,
		},
		{
			MethodName: "GenRawCode",
			Handler:    _VcodeService_GenRawCode_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "vcode.proto",
}

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

Functions

func InitGrpcClient

func InitGrpcClient(addr string)

InitGrpcClient init grpc-tpl grpc client

func RegisterVcodeServiceHandler

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

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

func RegisterVcodeServiceHandlerClient

func RegisterVcodeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VcodeServiceClient) error

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

func RegisterVcodeServiceHandlerFromEndpoint

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

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

func RegisterVcodeServiceHandlerServer

func RegisterVcodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VcodeServiceServer) error

RegisterVcodeServiceHandlerServer registers the http handlers for service VcodeService to "mux". UnaryRPC :call VcodeServiceServer 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 RegisterVcodeServiceHandlerFromEndpoint instead.

func RegisterVcodeServiceServer

func RegisterVcodeServiceServer(s grpc.ServiceRegistrar, srv VcodeServiceServer)

Types

type DriverEnum

type DriverEnum int32
const (
	DriverEnum_Digit    DriverEnum = 0
	DriverEnum_String   DriverEnum = 1
	DriverEnum_Math     DriverEnum = 2
	DriverEnum_Chinese  DriverEnum = 3
	DriverEnum_Audio    DriverEnum = 4
	DriverEnum_Language DriverEnum = 5
)

func (DriverEnum) Descriptor

func (DriverEnum) Descriptor() protoreflect.EnumDescriptor

func (DriverEnum) Enum

func (x DriverEnum) Enum() *DriverEnum

func (DriverEnum) EnumDescriptor deprecated

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

Deprecated: Use DriverEnum.Descriptor instead.

func (DriverEnum) Number

func (x DriverEnum) Number() protoreflect.EnumNumber

func (DriverEnum) String

func (x DriverEnum) String() string

func (DriverEnum) Type

type GenRawCodeReq

type GenRawCodeReq struct {
	AppID  int32  `protobuf:"varint,1,opt,name=AppID,proto3" json:"AppID,omitempty"`
	IP     string `protobuf:"bytes,2,opt,name=IP,proto3" json:"IP,omitempty"`
	Length int32  `protobuf:"varint,3,opt,name=Length,proto3" json:"Length,omitempty"`
	IDTag  string `protobuf:"bytes,4,opt,name=IDTag,proto3" json:"IDTag,omitempty"`
	// contains filtered or unexported fields
}

GenRawCode请求参数

func (*GenRawCodeReq) Descriptor deprecated

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

Deprecated: Use GenRawCodeReq.ProtoReflect.Descriptor instead.

func (*GenRawCodeReq) GetAppID

func (x *GenRawCodeReq) GetAppID() int32

func (*GenRawCodeReq) GetIDTag

func (x *GenRawCodeReq) GetIDTag() string

func (*GenRawCodeReq) GetIP

func (x *GenRawCodeReq) GetIP() string

func (*GenRawCodeReq) GetLength

func (x *GenRawCodeReq) GetLength() int32

func (*GenRawCodeReq) ProtoMessage

func (*GenRawCodeReq) ProtoMessage()

func (*GenRawCodeReq) ProtoReflect

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

func (*GenRawCodeReq) Reset

func (x *GenRawCodeReq) Reset()

func (*GenRawCodeReq) String

func (x *GenRawCodeReq) String() string

type GenerateReq

type GenerateReq struct {
	AppID    int32      `protobuf:"varint,1,opt,name=AppID,proto3" json:"AppID,omitempty"`
	IP       string     `protobuf:"bytes,2,opt,name=IP,proto3" json:"IP,omitempty"`
	Driver   DriverEnum `protobuf:"varint,3,opt,name=Driver,proto3,enum=pb.DriverEnum" json:"Driver,omitempty"`
	Height   int32      `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"`
	Width    int32      `protobuf:"varint,5,opt,name=Width,proto3" json:"Width,omitempty"`
	Length   int32      `protobuf:"varint,6,opt,name=Length,proto3" json:"Length,omitempty"`
	Lang     LangEnum   `protobuf:"varint,7,opt,name=Lang,proto3,enum=pb.LangEnum" json:"Lang,omitempty"`
	MaxSkew  float64    `protobuf:"fixed64,8,opt,name=MaxSkew,proto3" json:"MaxSkew,omitempty"`
	DotCount int32      `protobuf:"varint,9,opt,name=DotCount,proto3" json:"DotCount,omitempty"`
	// contains filtered or unexported fields
}

Generate请求参数

func (*GenerateReq) Descriptor deprecated

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

Deprecated: Use GenerateReq.ProtoReflect.Descriptor instead.

func (*GenerateReq) GetAppID

func (x *GenerateReq) GetAppID() int32

func (*GenerateReq) GetDotCount

func (x *GenerateReq) GetDotCount() int32

func (*GenerateReq) GetDriver

func (x *GenerateReq) GetDriver() DriverEnum

func (*GenerateReq) GetHeight

func (x *GenerateReq) GetHeight() int32

func (*GenerateReq) GetIP

func (x *GenerateReq) GetIP() string

func (*GenerateReq) GetLang

func (x *GenerateReq) GetLang() LangEnum

func (*GenerateReq) GetLength

func (x *GenerateReq) GetLength() int32

func (*GenerateReq) GetMaxSkew

func (x *GenerateReq) GetMaxSkew() float64

func (*GenerateReq) GetWidth

func (x *GenerateReq) GetWidth() int32

func (*GenerateReq) ProtoMessage

func (*GenerateReq) ProtoMessage()

func (*GenerateReq) ProtoReflect

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

func (*GenerateReq) Reset

func (x *GenerateReq) Reset()

func (*GenerateReq) String

func (x *GenerateReq) String() string

type GenerateRsp

type GenerateRsp struct {
	Data string `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"`
	ID   string `protobuf:"bytes,2,opt,name=ID,proto3" json:"ID,omitempty"`
	// contains filtered or unexported fields
}

Generate返回结果

func (*GenerateRsp) Descriptor deprecated

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

Deprecated: Use GenerateRsp.ProtoReflect.Descriptor instead.

func (*GenerateRsp) GetData

func (x *GenerateRsp) GetData() string

func (*GenerateRsp) GetID

func (x *GenerateRsp) GetID() string

func (*GenerateRsp) ProtoMessage

func (*GenerateRsp) ProtoMessage()

func (*GenerateRsp) ProtoReflect

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

func (*GenerateRsp) Reset

func (x *GenerateRsp) Reset()

func (*GenerateRsp) String

func (x *GenerateRsp) String() string

type LangEnum

type LangEnum int32
const (
	LangEnum_Zh     LangEnum = 0
	LangEnum_Latin  LangEnum = 1
	LangEnum_Ko     LangEnum = 2
	LangEnum_Jp     LangEnum = 3
	LangEnum_Ru     LangEnum = 4
	LangEnum_Th     LangEnum = 5
	LangEnum_Greek  LangEnum = 6
	LangEnum_Arabic LangEnum = 7
	LangEnum_Hebrew LangEnum = 8
)

func (LangEnum) Descriptor

func (LangEnum) Descriptor() protoreflect.EnumDescriptor

func (LangEnum) Enum

func (x LangEnum) Enum() *LangEnum

func (LangEnum) EnumDescriptor deprecated

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

Deprecated: Use LangEnum.Descriptor instead.

func (LangEnum) Number

func (x LangEnum) Number() protoreflect.EnumNumber

func (LangEnum) String

func (x LangEnum) String() string

func (LangEnum) Type

type UnimplementedVcodeServiceServer

type UnimplementedVcodeServiceServer struct {
}

UnimplementedVcodeServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedVcodeServiceServer) GenRawCode

func (UnimplementedVcodeServiceServer) Generate

func (UnimplementedVcodeServiceServer) Verify

type UnsafeVcodeServiceServer

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

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

type VcodeServiceClient

type VcodeServiceClient interface {
	// 生成验证码
	Generate(ctx context.Context, in *GenerateReq, opts ...grpc.CallOption) (*GenerateRsp, error)
	// 校验验证码
	Verify(ctx context.Context, in *VerifyReq, opts ...grpc.CallOption) (*VerifyRsp, error)
	// 生成原始验证码
	GenRawCode(ctx context.Context, in *GenRawCodeReq, opts ...grpc.CallOption) (*GenerateRsp, error)
}

VcodeServiceClient is the client API for VcodeService 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.

var (
	// GrpcClient grpc-tpl grpc client
	GrpcClient VcodeServiceClient
)

type VcodeServiceServer

type VcodeServiceServer interface {
	// 生成验证码
	Generate(context.Context, *GenerateReq) (*GenerateRsp, error)
	// 校验验证码
	Verify(context.Context, *VerifyReq) (*VerifyRsp, error)
	// 生成原始验证码
	GenRawCode(context.Context, *GenRawCodeReq) (*GenerateRsp, error)
	// contains filtered or unexported methods
}

VcodeServiceServer is the server API for VcodeService service. All implementations must embed UnimplementedVcodeServiceServer for forward compatibility

type VerifyReq

type VerifyReq struct {
	AppID  int32  `protobuf:"varint,1,opt,name=AppID,proto3" json:"AppID,omitempty"`
	IP     string `protobuf:"bytes,2,opt,name=IP,proto3" json:"IP,omitempty"`
	ID     string `protobuf:"bytes,3,opt,name=ID,proto3" json:"ID,omitempty"`
	Answer string `protobuf:"bytes,4,opt,name=Answer,proto3" json:"Answer,omitempty"`
	// contains filtered or unexported fields
}

Verify请求参数

func (*VerifyReq) Descriptor deprecated

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

Deprecated: Use VerifyReq.ProtoReflect.Descriptor instead.

func (*VerifyReq) GetAnswer

func (x *VerifyReq) GetAnswer() string

func (*VerifyReq) GetAppID

func (x *VerifyReq) GetAppID() int32

func (*VerifyReq) GetID

func (x *VerifyReq) GetID() string

func (*VerifyReq) GetIP

func (x *VerifyReq) GetIP() string

func (*VerifyReq) ProtoMessage

func (*VerifyReq) ProtoMessage()

func (*VerifyReq) ProtoReflect

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

func (*VerifyReq) Reset

func (x *VerifyReq) Reset()

func (*VerifyReq) String

func (x *VerifyReq) String() string

type VerifyRsp

type VerifyRsp struct {
	OK bool `protobuf:"varint,1,opt,name=OK,proto3" json:"OK,omitempty"`
	// contains filtered or unexported fields
}

获取评论返回结果

func (*VerifyRsp) Descriptor deprecated

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

Deprecated: Use VerifyRsp.ProtoReflect.Descriptor instead.

func (*VerifyRsp) GetOK

func (x *VerifyRsp) GetOK() bool

func (*VerifyRsp) ProtoMessage

func (*VerifyRsp) ProtoMessage()

func (*VerifyRsp) ProtoReflect

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

func (*VerifyRsp) Reset

func (x *VerifyRsp) Reset()

func (*VerifyRsp) String

func (x *VerifyRsp) String() string

Jump to

Keyboard shortcuts

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