Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "v1_proto",
srcs = ["api.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v1_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/zeus/api/v1",
proto = ":v1_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"api.bm.go",
"generate.go",
],
embed = [":v1_go_proto"],
importpath = "go-common/app/service/live/zeus/api/v1",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/net/http/blademaster:go_default_library",
"//library/net/http/blademaster/binding:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,55 @@
// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api.proto
/*
Package v1 is a generated blademaster stub package.
This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
package 命名使用 {discovery_id}.{version} 的方式, version 形如 v1, v2, v1beta ..
NOTE: 不知道的 discovery_id 请询问大佬, 新项目找大佬申请 discovery_id先到先得抢注
e.g. account.service.v1
It is generated from these files:
api.proto
*/
package v1
import (
"context"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/http/blademaster/binding"
)
// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
var _ binding.StructValidator
var PathZeusMatch = "/live.zeus.v1.Zeus/Match"
// ==============
// Zeus Interface
// ==============
type ZeusBMServer interface {
// `method:"POST"`
Match(ctx context.Context, req *MatchRequest) (resp *MatchResponse, err error)
}
var v1ZeusSvc ZeusBMServer
func zeusMatch(c *bm.Context) {
p := new(MatchRequest)
if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
return
}
resp, err := v1ZeusSvc.Match(c, p)
c.JSON(resp, err)
}
// RegisterZeusBMServer Register the blademaster route
func RegisterZeusBMServer(e *bm.Engine, server ZeusBMServer) {
v1ZeusSvc = server
e.POST("/live.zeus.v1.Zeus/Match", zeusMatch)
}

View File

@@ -0,0 +1,861 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: app/service/live/zeus/api/v1/api.proto
package v1
/*
package 命名使用 {discovery_id}.{version} 的方式, version 形如 v1, v2, v1beta ..
NOTE: 不知道的 discovery_id 请询问大佬, 新项目找大佬申请 discovery_id先到先得抢注
e.g. account.service.v1
*/
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type MatchRequest struct {
Group string `protobuf:"bytes,1,opt,name=group,proto3" json:"group"`
Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform"`
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version"`
Build uint64 `protobuf:"varint,4,opt,name=build,proto3" json:"build"`
Buvid string `protobuf:"bytes,5,opt,name=buvid,proto3" json:"buvid"`
Uid uint64 `protobuf:"varint,6,opt,name=uid,proto3" json:"uid"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MatchRequest) Reset() { *m = MatchRequest{} }
func (m *MatchRequest) String() string { return proto.CompactTextString(m) }
func (*MatchRequest) ProtoMessage() {}
func (*MatchRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_api_c648a0d3cea95155, []int{0}
}
func (m *MatchRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MatchRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *MatchRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_MatchRequest.Merge(dst, src)
}
func (m *MatchRequest) XXX_Size() int {
return m.Size()
}
func (m *MatchRequest) XXX_DiscardUnknown() {
xxx_messageInfo_MatchRequest.DiscardUnknown(m)
}
var xxx_messageInfo_MatchRequest proto.InternalMessageInfo
func (m *MatchRequest) GetGroup() string {
if m != nil {
return m.Group
}
return ""
}
func (m *MatchRequest) GetPlatform() string {
if m != nil {
return m.Platform
}
return ""
}
func (m *MatchRequest) GetVersion() string {
if m != nil {
return m.Version
}
return ""
}
func (m *MatchRequest) GetBuild() uint64 {
if m != nil {
return m.Build
}
return 0
}
func (m *MatchRequest) GetBuvid() string {
if m != nil {
return m.Buvid
}
return ""
}
func (m *MatchRequest) GetUid() uint64 {
if m != nil {
return m.Uid
}
return 0
}
type MatchResponse struct {
IsMatch bool `protobuf:"varint,1,opt,name=is_match,json=isMatch,proto3" json:"is_match"`
Extend string `protobuf:"bytes,2,opt,name=extend,proto3" json:"extend"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MatchResponse) Reset() { *m = MatchResponse{} }
func (m *MatchResponse) String() string { return proto.CompactTextString(m) }
func (*MatchResponse) ProtoMessage() {}
func (*MatchResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_api_c648a0d3cea95155, []int{1}
}
func (m *MatchResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MatchResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalTo(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (dst *MatchResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MatchResponse.Merge(dst, src)
}
func (m *MatchResponse) XXX_Size() int {
return m.Size()
}
func (m *MatchResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MatchResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MatchResponse proto.InternalMessageInfo
func (m *MatchResponse) GetIsMatch() bool {
if m != nil {
return m.IsMatch
}
return false
}
func (m *MatchResponse) GetExtend() string {
if m != nil {
return m.Extend
}
return ""
}
func init() {
proto.RegisterType((*MatchRequest)(nil), "live.zeus.v1.MatchRequest")
proto.RegisterType((*MatchResponse)(nil), "live.zeus.v1.MatchResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// ZeusClient is the client API for Zeus service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ZeusClient interface {
// `method:"POST"`
Match(ctx context.Context, in *MatchRequest, opts ...grpc.CallOption) (*MatchResponse, error)
}
type zeusClient struct {
cc *grpc.ClientConn
}
func NewZeusClient(cc *grpc.ClientConn) ZeusClient {
return &zeusClient{cc}
}
func (c *zeusClient) Match(ctx context.Context, in *MatchRequest, opts ...grpc.CallOption) (*MatchResponse, error) {
out := new(MatchResponse)
err := c.cc.Invoke(ctx, "/live.zeus.v1.Zeus/Match", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ZeusServer is the server API for Zeus service.
type ZeusServer interface {
// `method:"POST"`
Match(context.Context, *MatchRequest) (*MatchResponse, error)
}
func RegisterZeusServer(s *grpc.Server, srv ZeusServer) {
s.RegisterService(&_Zeus_serviceDesc, srv)
}
func _Zeus_Match_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ZeusServer).Match(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/live.zeus.v1.Zeus/Match",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ZeusServer).Match(ctx, req.(*MatchRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Zeus_serviceDesc = grpc.ServiceDesc{
ServiceName: "live.zeus.v1.Zeus",
HandlerType: (*ZeusServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Match",
Handler: _Zeus_Match_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "app/service/live/zeus/api/v1/api.proto",
}
func (m *MatchRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MatchRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Group) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Group)))
i += copy(dAtA[i:], m.Group)
}
if len(m.Platform) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Platform)))
i += copy(dAtA[i:], m.Platform)
}
if len(m.Version) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Version)))
i += copy(dAtA[i:], m.Version)
}
if m.Build != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintApi(dAtA, i, uint64(m.Build))
}
if len(m.Buvid) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Buvid)))
i += copy(dAtA[i:], m.Buvid)
}
if m.Uid != 0 {
dAtA[i] = 0x30
i++
i = encodeVarintApi(dAtA, i, uint64(m.Uid))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *MatchResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MatchResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.IsMatch {
dAtA[i] = 0x8
i++
if m.IsMatch {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if len(m.Extend) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintApi(dAtA, i, uint64(len(m.Extend)))
i += copy(dAtA[i:], m.Extend)
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeVarintApi(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *MatchRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Group)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
l = len(m.Platform)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
l = len(m.Version)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
if m.Build != 0 {
n += 1 + sovApi(uint64(m.Build))
}
l = len(m.Buvid)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
if m.Uid != 0 {
n += 1 + sovApi(uint64(m.Uid))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *MatchResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.IsMatch {
n += 2
}
l = len(m.Extend)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovApi(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozApi(x uint64) (n int) {
return sovApi(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *MatchRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MatchRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MatchRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Group = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Platform", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Platform = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Version = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Build", wireType)
}
m.Build = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Build |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Buvid", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Buvid = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType)
}
m.Uid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Uid |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthApi
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MatchResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MatchResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MatchResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field IsMatch", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.IsMatch = bool(v != 0)
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Extend", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Extend = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthApi
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipApi(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowApi
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowApi
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowApi
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthApi
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowApi
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipApi(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthApi = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowApi = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("app/service/live/zeus/api/v1/api.proto", fileDescriptor_api_c648a0d3cea95155)
}
var fileDescriptor_api_c648a0d3cea95155 = []byte{
// 338 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4e, 0xc3, 0x30,
0x10, 0xc6, 0xe5, 0xfe, 0xaf, 0x29, 0x12, 0xf2, 0x14, 0x8a, 0xd4, 0x54, 0x95, 0x80, 0x2e, 0xc4,
0x2a, 0xbc, 0x00, 0xea, 0xc4, 0xc2, 0xe2, 0xb1, 0x42, 0x42, 0x49, 0xe3, 0xa6, 0x96, 0xda, 0xda,
0xc4, 0xb1, 0x85, 0x78, 0x42, 0x46, 0x5e, 0x80, 0x08, 0x75, 0xcc, 0x53, 0x20, 0x9f, 0xd3, 0xd2,
0x81, 0x25, 0xdf, 0xdd, 0xef, 0xee, 0x93, 0xef, 0x72, 0xf8, 0x26, 0x56, 0x8a, 0x6a, 0x9e, 0x5b,
0xb1, 0xe4, 0x74, 0x23, 0x2c, 0xa7, 0x1f, 0xdc, 0x68, 0x1a, 0x2b, 0x41, 0xed, 0xcc, 0x49, 0xa4,
0x72, 0x59, 0x48, 0x32, 0x70, 0xb5, 0xc8, 0xd5, 0x22, 0x3b, 0x1b, 0xde, 0x65, 0xa2, 0x58, 0x9b,
0x24, 0x5a, 0xca, 0x2d, 0xcd, 0x64, 0x26, 0x29, 0x34, 0x25, 0x66, 0x05, 0x19, 0x24, 0x10, 0x79,
0xf3, 0xe4, 0x1b, 0xe1, 0xc1, 0x73, 0x5c, 0x2c, 0xd7, 0x8c, 0xbf, 0x19, 0xae, 0x0b, 0x12, 0xe2,
0x76, 0x96, 0x4b, 0xa3, 0x02, 0x34, 0x46, 0xd3, 0xfe, 0xbc, 0x5f, 0x95, 0xa1, 0x07, 0xcc, 0x0b,
0x99, 0xe2, 0x9e, 0xda, 0xc4, 0xc5, 0x4a, 0xe6, 0xdb, 0xa0, 0x01, 0x3d, 0x83, 0xaa, 0x0c, 0x8f,
0x8c, 0x1d, 0x23, 0x72, 0x8d, 0xbb, 0x96, 0xe7, 0x5a, 0xc8, 0x5d, 0xd0, 0x84, 0xc6, 0xb3, 0xaa,
0x0c, 0x0f, 0x88, 0x1d, 0x02, 0xf7, 0x62, 0x62, 0xc4, 0x26, 0x0d, 0x5a, 0x63, 0x34, 0x6d, 0xf9,
0x17, 0x01, 0x30, 0x2f, 0xbe, 0xc1, 0x8a, 0x34, 0x68, 0xff, 0x8d, 0x04, 0x80, 0x79, 0x21, 0x97,
0xb8, 0x69, 0x44, 0x1a, 0x74, 0xc0, 0xdf, 0xad, 0xca, 0xd0, 0xa5, 0xcc, 0x7d, 0x26, 0x2f, 0xf8,
0xbc, 0x5e, 0x4f, 0x2b, 0xb9, 0xd3, 0x9c, 0xdc, 0xe2, 0x9e, 0xd0, 0xaf, 0x5b, 0xc7, 0x60, 0xc5,
0x9e, 0x1f, 0xff, 0xc0, 0x58, 0x57, 0x68, 0x30, 0x90, 0x09, 0xee, 0xf0, 0xf7, 0x82, 0xef, 0xd2,
0x7a, 0x4b, 0x5c, 0x95, 0x61, 0x4d, 0x58, 0xad, 0xf7, 0x4f, 0xb8, 0xb5, 0xe0, 0x46, 0x93, 0x47,
0xdc, 0xf6, 0xa6, 0x61, 0x74, 0x7a, 0x8c, 0xe8, 0xf4, 0xcf, 0x0e, 0xaf, 0xfe, 0xad, 0xf9, 0xb1,
0xe6, 0x17, 0x9f, 0xfb, 0x11, 0xfa, 0xda, 0x8f, 0xd0, 0xcf, 0x7e, 0x84, 0x16, 0x0d, 0x3b, 0x4b,
0x3a, 0x70, 0xa0, 0x87, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x92, 0x06, 0x64, 0x07, 0x02,
0x00, 0x00,
}

View File

@@ -0,0 +1,37 @@
// 定义项目 API 的 proto 文件 可以同时描述 gRPC 和 HTTP API
// protobuf 文件参考:
// - https://developers.google.com/protocol-buffers/
// - http://info.bilibili.co/display/documentation/gRPC+Proto
// protobuf 生成 HTTP 工具:
// - http://git.bilibili.co/platform/go-common/tree/master/app/tool/protoc-gen-bm
syntax = "proto3";
// package 命名使用 {discovery_id}.{version} 的方式, version 形如 v1, v2, v1beta ..
// NOTE: 不知道的 discovery_id 请询问大佬, 新项目找大佬申请 discovery_id先到先得抢注
// e.g. account.service.v1
package live.zeus.v1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// NOTE: 最后请删除这些无用的注释 (゜-゜)つロ
option go_package = "v1";
service Zeus {
// `method:"POST"`
rpc Match(MatchRequest) returns (MatchResponse);
}
message MatchRequest {
string group = 1 [(gogoproto.jsontag) = "group"];
string platform = 2 [(gogoproto.jsontag) = "platform"];
string version = 3 [(gogoproto.jsontag) = "version"];
uint64 build = 4 [(gogoproto.jsontag) = "build"];
string buvid = 5 [(gogoproto.jsontag) = "buvid"];
uint64 uid = 6 [(gogoproto.jsontag) = "uid"];
}
message MatchResponse {
bool is_match = 1 [(gogoproto.jsontag) = "is_match"];
string extend = 2 [(gogoproto.jsontag) = "extend"];
}

View File

@@ -0,0 +1,32 @@
<!-- package=live.zeus.v1 -->
- [/live.zeus.v1.Zeus/Match](#live.zeus.v1.ZeusMatch)
## /live.zeus.v1.Zeus/Match
### 无标题
#### 方法POST
#### 请求参数
|参数名|必选|类型|描述|
|:---|:---|:---|:---|
|group|否|string||
|platform|否|string||
|version|否|string||
|build|否|integer||
|buvid|否|string||
|uid|否|integer||
#### 响应
```javascript
{
"code": 0,
"message": "ok",
"data": {
"is_match": true,
"extend": ""
}
}
```

View File

@@ -0,0 +1,4 @@
package v1
// 生成 gRPC 代码
//go:generate $GOPATH/src/go-common/app/tool/warden/protoc.sh