diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8c45cda --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "go.formatTool": "goimports" +} \ No newline at end of file diff --git a/network/network.pb.go b/network/network.pb.go new file mode 100644 index 0000000..f74412d --- /dev/null +++ b/network/network.pb.go @@ -0,0 +1,210 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: network.proto + +package network + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// The request message containing the user's name. +type NetworkRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetworkRequest) Reset() { *m = NetworkRequest{} } +func (m *NetworkRequest) String() string { return proto.CompactTextString(m) } +func (*NetworkRequest) ProtoMessage() {} +func (*NetworkRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_8571034d60397816, []int{0} +} + +func (m *NetworkRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NetworkRequest.Unmarshal(m, b) +} +func (m *NetworkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NetworkRequest.Marshal(b, m, deterministic) +} +func (m *NetworkRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkRequest.Merge(m, src) +} +func (m *NetworkRequest) XXX_Size() int { + return xxx_messageInfo_NetworkRequest.Size(m) +} +func (m *NetworkRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkRequest proto.InternalMessageInfo + +func (m *NetworkRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// The response message containing the greetings +type NetworkReply struct { + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetworkReply) Reset() { *m = NetworkReply{} } +func (m *NetworkReply) String() string { return proto.CompactTextString(m) } +func (*NetworkReply) ProtoMessage() {} +func (*NetworkReply) Descriptor() ([]byte, []int) { + return fileDescriptor_8571034d60397816, []int{1} +} + +func (m *NetworkReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NetworkReply.Unmarshal(m, b) +} +func (m *NetworkReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NetworkReply.Marshal(b, m, deterministic) +} +func (m *NetworkReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetworkReply.Merge(m, src) +} +func (m *NetworkReply) XXX_Size() int { + return xxx_messageInfo_NetworkReply.Size(m) +} +func (m *NetworkReply) XXX_DiscardUnknown() { + xxx_messageInfo_NetworkReply.DiscardUnknown(m) +} + +var xxx_messageInfo_NetworkReply proto.InternalMessageInfo + +func (m *NetworkReply) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func init() { + proto.RegisterType((*NetworkRequest)(nil), "oddscrawler.NetworkRequest") + proto.RegisterType((*NetworkReply)(nil), "oddscrawler.NetworkReply") +} + +func init() { proto.RegisterFile("network.proto", fileDescriptor_8571034d60397816) } + +var fileDescriptor_8571034d60397816 = []byte{ + // 180 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4b, 0x2d, 0x29, + 0xcf, 0x2f, 0xca, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xce, 0x4f, 0x49, 0x29, 0x4e, + 0x2e, 0x4a, 0x2c, 0xcf, 0x49, 0x2d, 0x52, 0x52, 0xe1, 0xe2, 0xf3, 0x83, 0xc8, 0x06, 0xa5, 0x16, + 0x96, 0xa6, 0x16, 0x97, 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, + 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x4a, 0x1a, 0x5c, 0x3c, 0x70, 0x55, 0x05, 0x39, 0x95, 0x42, 0x12, + 0x5c, 0xec, 0xb9, 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0x30, 0x65, 0x30, 0xae, 0x51, 0x20, 0x17, 0x27, + 0x54, 0x65, 0x6a, 0x91, 0x90, 0x0b, 0x17, 0x47, 0x70, 0x62, 0xa5, 0x47, 0x6a, 0x4e, 0x4e, 0xbe, + 0x90, 0xb4, 0x1e, 0x92, 0xb5, 0x7a, 0xa8, 0x76, 0x4a, 0x49, 0x62, 0x97, 0x2c, 0xc8, 0xa9, 0x54, + 0x62, 0x70, 0x32, 0xe1, 0x12, 0xcb, 0x4b, 0x2d, 0xd1, 0xcb, 0xc9, 0x4f, 0x4c, 0xcb, 0x49, 0x45, + 0x56, 0xe8, 0x04, 0x73, 0x54, 0x00, 0xc8, 0x5f, 0x01, 0x8c, 0x51, 0xec, 0x50, 0x8f, 0xfe, 0x60, + 0x64, 0x4c, 0x62, 0x03, 0x7b, 0xd6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x36, 0x32, 0xf1, 0x15, + 0xfd, 0x00, 0x00, 0x00, +} + +// 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 + +// NetworkerClient is the client API for Networker service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NetworkerClient interface { + // Sends a greeting + SayHello(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkReply, error) +} + +type networkerClient struct { + cc *grpc.ClientConn +} + +func NewNetworkerClient(cc *grpc.ClientConn) NetworkerClient { + return &networkerClient{cc} +} + +func (c *networkerClient) SayHello(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkReply, error) { + out := new(NetworkReply) + err := c.cc.Invoke(ctx, "/oddscrawler.Networker/SayHello", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NetworkerServer is the server API for Networker service. +type NetworkerServer interface { + // Sends a greeting + SayHello(context.Context, *NetworkRequest) (*NetworkReply, error) +} + +// UnimplementedNetworkerServer can be embedded to have forward compatible implementations. +type UnimplementedNetworkerServer struct { +} + +func (*UnimplementedNetworkerServer) SayHello(ctx context.Context, req *NetworkRequest) (*NetworkReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") +} + +func RegisterNetworkerServer(s *grpc.Server, srv NetworkerServer) { + s.RegisterService(&_Networker_serviceDesc, srv) +} + +func _Networker_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetworkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NetworkerServer).SayHello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/oddscrawler.Networker/SayHello", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NetworkerServer).SayHello(ctx, req.(*NetworkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Networker_serviceDesc = grpc.ServiceDesc{ + ServiceName: "oddscrawler.Networker", + HandlerType: (*NetworkerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SayHello", + Handler: _Networker_SayHello_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "network.proto", +} diff --git a/network/network.proto b/network/network.proto index 08848eb..dd48666 100644 --- a/network/network.proto +++ b/network/network.proto @@ -4,7 +4,7 @@ option cc_enable_arenas = true; option java_outer_classname = "NetworkProto"; option java_multiple_files = true; option java_package = "net.loafle.oddscrawler"; -option go_package = "git.loafle.net/odds-crawler/odds-crawler-proto/network"; +option go_package = "network"; package oddscrawler; @@ -22,3 +22,5 @@ service Networker { // Sends a greeting rpc SayHello (NetworkRequest) returns (NetworkReply) {} } + +// protoc -I network/ network/network.proto --go_out=plugins=grpc:network \ No newline at end of file