mirror of
https://github.com/lightninglabs/aperture.git
synced 2025-12-18 01:24:19 +01:00
multi: format test proto with generic script
This commit is contained in:
7
pricesrpc/.clang-format
Normal file
7
pricesrpc/.clang-format
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
Language: Proto
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
SpaceBeforeParens: Always
|
||||||
|
CompactNamespaces: false
|
||||||
@@ -6,7 +6,7 @@ set -e
|
|||||||
function generate() {
|
function generate() {
|
||||||
echo "Generating root gRPC server protos"
|
echo "Generating root gRPC server protos"
|
||||||
|
|
||||||
PROTOS="prices.proto"
|
PROTOS="*.proto"
|
||||||
|
|
||||||
# For each of the sub-servers, we then generate their protos, but a restricted
|
# For each of the sub-servers, we then generate their protos, but a restricted
|
||||||
# set as they don't yet require REST proxies, or swagger docs.
|
# set as they don't yet require REST proxies, or swagger docs.
|
||||||
@@ -20,6 +20,11 @@ function generate() {
|
|||||||
--go-grpc_out . --go-grpc_opt paths=source_relative \
|
--go-grpc_out . --go-grpc_opt paths=source_relative \
|
||||||
"${file}"
|
"${file}"
|
||||||
|
|
||||||
|
# Stop here if we don't need to generate anything REST.
|
||||||
|
if [[ "$1" == "skip_rest" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate the REST reverse proxy.
|
# Generate the REST reverse proxy.
|
||||||
annotationsFile=${file//proto/yaml}
|
annotationsFile=${file//proto/yaml}
|
||||||
protoc -I/usr/local/include -I. \
|
protoc -I/usr/local/include -I. \
|
||||||
@@ -73,6 +78,11 @@ format
|
|||||||
generate
|
generate
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
pushd proxy/testdata
|
||||||
|
format
|
||||||
|
generate skip_rest
|
||||||
|
popd
|
||||||
|
|
||||||
if [[ "$COMPILE_MOBILE" == "1" ]]; then
|
if [[ "$COMPILE_MOBILE" == "1" ]]; then
|
||||||
pushd mobile
|
pushd mobile
|
||||||
./gen_bindings.sh $FALAFEL_VERSION
|
./gen_bindings.sh $FALAFEL_VERSION
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ package pricesrpc;
|
|||||||
|
|
||||||
option go_package = "github.com/lightninglabs/aperture/pricesrpc";
|
option go_package = "github.com/lightninglabs/aperture/pricesrpc";
|
||||||
|
|
||||||
service Prices { rpc GetPrice(GetPriceRequest) returns (GetPriceResponse); }
|
service Prices {
|
||||||
|
rpc GetPrice (GetPriceRequest) returns (GetPriceResponse);
|
||||||
message GetPriceRequest {
|
|
||||||
string path = 1;
|
|
||||||
|
|
||||||
string http_request_text = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetPriceResponse { int64 price_sats = 1; }
|
message GetPriceRequest {
|
||||||
|
string path = 1;
|
||||||
|
|
||||||
|
string http_request_text = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPriceResponse {
|
||||||
|
int64 price_sats = 1;
|
||||||
|
}
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ type testCase struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// helloServer is a simple server that implements the GreeterServer interface.
|
// helloServer is a simple server that implements the GreeterServer interface.
|
||||||
type helloServer struct{}
|
type helloServer struct {
|
||||||
|
proxytest.UnimplementedGreeterServer
|
||||||
|
}
|
||||||
|
|
||||||
// SayHello returns a simple string that also contains a string from the
|
// SayHello returns a simple string that also contains a string from the
|
||||||
// request.
|
// request.
|
||||||
|
|||||||
7
proxy/testdata/.clang-format
vendored
Normal file
7
proxy/testdata/.clang-format
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
Language: Proto
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 4
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
SpaceBeforeParens: Always
|
||||||
|
CompactNamespaces: false
|
||||||
7
proxy/testdata/gen_protos.sh
vendored
7
proxy/testdata/gen_protos.sh
vendored
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
protoc -I/usr/local/include -I. \
|
|
||||||
--go_out=plugins=grpc,paths=source_relative:. \
|
|
||||||
hello.proto
|
|
||||||
392
proxy/testdata/hello.pb.go
vendored
392
proxy/testdata/hello.pb.go
vendored
@@ -1,250 +1,230 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.33.0
|
||||||
|
// protoc v3.6.1
|
||||||
// source: hello.proto
|
// source: hello.proto
|
||||||
|
|
||||||
package proxy_test
|
package proxy_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
fmt "fmt"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
proto "github.com/golang/protobuf/proto"
|
reflect "reflect"
|
||||||
grpc "google.golang.org/grpc"
|
sync "sync"
|
||||||
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.
|
const (
|
||||||
var _ = proto.Marshal
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
var _ = fmt.Errorf
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
var _ = math.Inf
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
// 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
|
|
||||||
|
|
||||||
type HelloRequest struct {
|
type HelloRequest struct {
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
state protoimpl.MessageState
|
||||||
ReturnError bool `protobuf:"varint,2,opt,name=return_error,json=returnError,proto3" json:"return_error,omitempty"`
|
sizeCache protoimpl.SizeCache
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
unknownFields protoimpl.UnknownFields
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
ReturnError bool `protobuf:"varint,2,opt,name=return_error,json=returnError,proto3" json:"return_error,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HelloRequest) Reset() { *m = HelloRequest{} }
|
func (x *HelloRequest) Reset() {
|
||||||
func (m *HelloRequest) String() string { return proto.CompactTextString(m) }
|
*x = HelloRequest{}
|
||||||
func (*HelloRequest) ProtoMessage() {}
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_hello_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HelloRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HelloRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_hello_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*HelloRequest) Descriptor() ([]byte, []int) {
|
func (*HelloRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_61ef911816e0a8ce, []int{0}
|
return file_hello_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HelloRequest) XXX_Unmarshal(b []byte) error {
|
func (x *HelloRequest) GetName() string {
|
||||||
return xxx_messageInfo_HelloRequest.Unmarshal(m, b)
|
if x != nil {
|
||||||
}
|
return x.Name
|
||||||
func (m *HelloRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
return xxx_messageInfo_HelloRequest.Marshal(b, m, deterministic)
|
|
||||||
}
|
|
||||||
func (m *HelloRequest) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_HelloRequest.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *HelloRequest) XXX_Size() int {
|
|
||||||
return xxx_messageInfo_HelloRequest.Size(m)
|
|
||||||
}
|
|
||||||
func (m *HelloRequest) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_HelloRequest.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_HelloRequest proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *HelloRequest) GetName() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Name
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HelloRequest) GetReturnError() bool {
|
func (x *HelloRequest) GetReturnError() bool {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.ReturnError
|
return x.ReturnError
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
type HelloReply struct {
|
type HelloReply struct {
|
||||||
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
state protoimpl.MessageState
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
sizeCache protoimpl.SizeCache
|
||||||
XXX_unrecognized []byte `json:"-"`
|
unknownFields protoimpl.UnknownFields
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
|
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HelloReply) Reset() { *m = HelloReply{} }
|
func (x *HelloReply) Reset() {
|
||||||
func (m *HelloReply) String() string { return proto.CompactTextString(m) }
|
*x = HelloReply{}
|
||||||
func (*HelloReply) ProtoMessage() {}
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_hello_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HelloReply) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HelloReply) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HelloReply) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_hello_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
|
||||||
func (*HelloReply) Descriptor() ([]byte, []int) {
|
func (*HelloReply) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_61ef911816e0a8ce, []int{1}
|
return file_hello_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *HelloReply) XXX_Unmarshal(b []byte) error {
|
func (x *HelloReply) GetMessage() string {
|
||||||
return xxx_messageInfo_HelloReply.Unmarshal(m, b)
|
if x != nil {
|
||||||
}
|
return x.Message
|
||||||
func (m *HelloReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
return xxx_messageInfo_HelloReply.Marshal(b, m, deterministic)
|
|
||||||
}
|
|
||||||
func (m *HelloReply) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_HelloReply.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *HelloReply) XXX_Size() int {
|
|
||||||
return xxx_messageInfo_HelloReply.Size(m)
|
|
||||||
}
|
|
||||||
func (m *HelloReply) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_HelloReply.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_HelloReply proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *HelloReply) GetMessage() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Message
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
var File_hello_proto protoreflect.FileDescriptor
|
||||||
proto.RegisterType((*HelloRequest)(nil), "proxy_test.HelloRequest")
|
|
||||||
proto.RegisterType((*HelloReply)(nil), "proxy_test.HelloReply")
|
var file_hello_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x70,
|
||||||
|
0x72, 0x6f, 0x78, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x22, 0x45, 0x0a, 0x0c, 0x48, 0x65, 0x6c,
|
||||||
|
0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||||
|
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a,
|
||||||
|
0x0c, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x08, 0x52, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||||
|
0x22, 0x26, 0x0a, 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18,
|
||||||
|
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x8b, 0x01, 0x0a, 0x07, 0x47, 0x72, 0x65,
|
||||||
|
0x65, 0x74, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f,
|
||||||
|
0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65,
|
||||||
|
0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
|
0x78, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70,
|
||||||
|
0x6c, 0x79, 0x12, 0x42, 0x0a, 0x0e, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x4e, 0x6f,
|
||||||
|
0x41, 0x75, 0x74, 0x68, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x74, 0x65, 0x73,
|
||||||
|
0x74, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
|
||||||
|
0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x6c, 0x6c,
|
||||||
|
0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||||
|
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61,
|
||||||
|
0x62, 0x73, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x78,
|
||||||
|
0x79, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79,
|
||||||
|
0x5f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("hello.proto", fileDescriptor_61ef911816e0a8ce) }
|
var (
|
||||||
|
file_hello_proto_rawDescOnce sync.Once
|
||||||
|
file_hello_proto_rawDescData = file_hello_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
var fileDescriptor_61ef911816e0a8ce = []byte{
|
func file_hello_proto_rawDescGZIP() []byte {
|
||||||
// 186 bytes of a gzipped FileDescriptorProto
|
file_hello_proto_rawDescOnce.Do(func() {
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xce, 0x48, 0xcd, 0xc9,
|
file_hello_proto_rawDescData = protoimpl.X.CompressGZIP(file_hello_proto_rawDescData)
|
||||||
0xc9, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x2a, 0x28, 0xca, 0xaf, 0xa8, 0x8c, 0x2f,
|
})
|
||||||
0x49, 0x2d, 0x2e, 0x51, 0x72, 0xe5, 0xe2, 0xf1, 0x00, 0x49, 0x05, 0xa5, 0x16, 0x96, 0xa6, 0x16,
|
return file_hello_proto_rawDescData
|
||||||
0x97, 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06,
|
|
||||||
0x81, 0xd9, 0x42, 0x8a, 0x5c, 0x3c, 0x45, 0xa9, 0x25, 0xa5, 0x45, 0x79, 0xf1, 0xa9, 0x45, 0x45,
|
|
||||||
0xf9, 0x45, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x1c, 0x41, 0xdc, 0x10, 0x31, 0x57, 0x90, 0x90, 0x92,
|
|
||||||
0x1a, 0x17, 0x17, 0xd4, 0x98, 0x82, 0x9c, 0x4a, 0x21, 0x09, 0x2e, 0xf6, 0xdc, 0xd4, 0xe2, 0xe2,
|
|
||||||
0xc4, 0x74, 0x98, 0x39, 0x30, 0xae, 0x51, 0x37, 0x23, 0x17, 0xbb, 0x7b, 0x51, 0x6a, 0x6a, 0x49,
|
|
||||||
0x6a, 0x91, 0x90, 0x0d, 0x17, 0x47, 0x70, 0x62, 0x25, 0x58, 0x9b, 0x90, 0x84, 0x1e, 0xc2, 0x4d,
|
|
||||||
0x7a, 0xc8, 0x0e, 0x92, 0x12, 0xc3, 0x22, 0x03, 0xb2, 0xc3, 0x89, 0x8b, 0x0f, 0xa6, 0xdb, 0x2f,
|
|
||||||
0xdf, 0xb1, 0xb4, 0x24, 0x83, 0x74, 0x33, 0x92, 0xd8, 0xc0, 0xe1, 0x61, 0x0c, 0x08, 0x00, 0x00,
|
|
||||||
0xff, 0xff, 0x83, 0xcb, 0x43, 0x7d, 0x1e, 0x01, 0x00, 0x00,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
var file_hello_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var _ context.Context
|
var file_hello_proto_goTypes = []interface{}{
|
||||||
var _ grpc.ClientConn
|
(*HelloRequest)(nil), // 0: proxy_test.HelloRequest
|
||||||
|
(*HelloReply)(nil), // 1: proxy_test.HelloReply
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
}
|
||||||
// is compatible with the grpc package it is being compiled against.
|
var file_hello_proto_depIdxs = []int32{
|
||||||
const _ = grpc.SupportPackageIsVersion4
|
0, // 0: proxy_test.Greeter.SayHello:input_type -> proxy_test.HelloRequest
|
||||||
|
0, // 1: proxy_test.Greeter.SayHelloNoAuth:input_type -> proxy_test.HelloRequest
|
||||||
// GreeterClient is the client API for Greeter service.
|
1, // 2: proxy_test.Greeter.SayHello:output_type -> proxy_test.HelloReply
|
||||||
//
|
1, // 3: proxy_test.Greeter.SayHelloNoAuth:output_type -> proxy_test.HelloReply
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
2, // [2:4] is the sub-list for method output_type
|
||||||
type GreeterClient interface {
|
0, // [0:2] is the sub-list for method input_type
|
||||||
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
SayHelloNoAuth(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
type greeterClient struct {
|
func init() { file_hello_proto_init() }
|
||||||
cc *grpc.ClientConn
|
func file_hello_proto_init() {
|
||||||
}
|
if File_hello_proto != nil {
|
||||||
|
return
|
||||||
func NewGreeterClient(cc *grpc.ClientConn) GreeterClient {
|
|
||||||
return &greeterClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
|
||||||
out := new(HelloReply)
|
|
||||||
err := c.cc.Invoke(ctx, "/proxy_test.Greeter/SayHello", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
return out, nil
|
if !protoimpl.UnsafeEnabled {
|
||||||
}
|
file_hello_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HelloRequest); i {
|
||||||
func (c *greeterClient) SayHelloNoAuth(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
case 0:
|
||||||
out := new(HelloReply)
|
return &v.state
|
||||||
err := c.cc.Invoke(ctx, "/proxy_test.Greeter/SayHelloNoAuth", in, out, opts...)
|
case 1:
|
||||||
if err != nil {
|
return &v.sizeCache
|
||||||
return nil, err
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_hello_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HelloReply); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return out, nil
|
type x struct{}
|
||||||
}
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
// GreeterServer is the server API for Greeter service.
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
type GreeterServer interface {
|
RawDescriptor: file_hello_proto_rawDesc,
|
||||||
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
|
NumEnums: 0,
|
||||||
SayHelloNoAuth(context.Context, *HelloRequest) (*HelloReply, error)
|
NumMessages: 2,
|
||||||
}
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
// UnimplementedGreeterServer can be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedGreeterServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedGreeterServer) SayHello(ctx context.Context, req *HelloRequest) (*HelloReply, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedGreeterServer) SayHelloNoAuth(ctx context.Context, req *HelloRequest) (*HelloReply, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method SayHelloNoAuth not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) {
|
|
||||||
s.RegisterService(&_Greeter_serviceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(HelloRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(GreeterServer).SayHello(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/proxy_test.Greeter/SayHello",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Greeter_SayHelloNoAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(HelloRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(GreeterServer).SayHelloNoAuth(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/proxy_test.Greeter/SayHelloNoAuth",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(GreeterServer).SayHelloNoAuth(ctx, req.(*HelloRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _Greeter_serviceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "proxy_test.Greeter",
|
|
||||||
HandlerType: (*GreeterServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "SayHello",
|
|
||||||
Handler: _Greeter_SayHello_Handler,
|
|
||||||
},
|
},
|
||||||
{
|
GoTypes: file_hello_proto_goTypes,
|
||||||
MethodName: "SayHelloNoAuth",
|
DependencyIndexes: file_hello_proto_depIdxs,
|
||||||
Handler: _Greeter_SayHelloNoAuth_Handler,
|
MessageInfos: file_hello_proto_msgTypes,
|
||||||
},
|
}.Build()
|
||||||
},
|
File_hello_proto = out.File
|
||||||
Streams: []grpc.StreamDesc{},
|
file_hello_proto_rawDesc = nil
|
||||||
Metadata: "hello.proto",
|
file_hello_proto_goTypes = nil
|
||||||
|
file_hello_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|||||||
2
proxy/testdata/hello.proto
vendored
2
proxy/testdata/hello.proto
vendored
@@ -2,6 +2,8 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package proxy_test;
|
package proxy_test;
|
||||||
|
|
||||||
|
option go_package = "github.com/lightninglabs/aperture/proxy/testdata/proxy_test";
|
||||||
|
|
||||||
service Greeter {
|
service Greeter {
|
||||||
rpc SayHello (HelloRequest) returns (HelloReply);
|
rpc SayHello (HelloRequest) returns (HelloReply);
|
||||||
rpc SayHelloNoAuth (HelloRequest) returns (HelloReply);
|
rpc SayHelloNoAuth (HelloRequest) returns (HelloReply);
|
||||||
|
|||||||
137
proxy/testdata/hello_grpc.pb.go
vendored
Normal file
137
proxy/testdata/hello_grpc.pb.go
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
|
||||||
|
package proxy_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// GreeterClient is the client API for Greeter 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 GreeterClient interface {
|
||||||
|
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
||||||
|
SayHelloNoAuth(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type greeterClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient {
|
||||||
|
return &greeterClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *greeterClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
||||||
|
out := new(HelloReply)
|
||||||
|
err := c.cc.Invoke(ctx, "/proxy_test.Greeter/SayHello", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *greeterClient) SayHelloNoAuth(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) {
|
||||||
|
out := new(HelloReply)
|
||||||
|
err := c.cc.Invoke(ctx, "/proxy_test.Greeter/SayHelloNoAuth", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GreeterServer is the server API for Greeter service.
|
||||||
|
// All implementations must embed UnimplementedGreeterServer
|
||||||
|
// for forward compatibility
|
||||||
|
type GreeterServer interface {
|
||||||
|
SayHello(context.Context, *HelloRequest) (*HelloReply, error)
|
||||||
|
SayHelloNoAuth(context.Context, *HelloRequest) (*HelloReply, error)
|
||||||
|
mustEmbedUnimplementedGreeterServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedGreeterServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedGreeterServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedGreeterServer) SayHelloNoAuth(context.Context, *HelloRequest) (*HelloReply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SayHelloNoAuth not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {}
|
||||||
|
|
||||||
|
// UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to GreeterServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeGreeterServer interface {
|
||||||
|
mustEmbedUnimplementedGreeterServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer) {
|
||||||
|
s.RegisterService(&Greeter_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Greeter_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(HelloRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(GreeterServer).SayHello(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/proxy_test.Greeter/SayHello",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(GreeterServer).SayHello(ctx, req.(*HelloRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Greeter_SayHelloNoAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(HelloRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(GreeterServer).SayHelloNoAuth(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/proxy_test.Greeter/SayHelloNoAuth",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(GreeterServer).SayHelloNoAuth(ctx, req.(*HelloRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Greeter_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "proxy_test.Greeter",
|
||||||
|
HandlerType: (*GreeterServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "SayHello",
|
||||||
|
Handler: _Greeter_SayHello_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SayHelloNoAuth",
|
||||||
|
Handler: _Greeter_SayHelloNoAuth_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "hello.proto",
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user