├── gen.go ├── README.md ├── tools.go ├── Makefile ├── go.mod ├── swagger.proto ├── .github └── workflows │ └── gh-pages.yml ├── api.proto ├── service └── service.go ├── cmd └── grpc_gateway_example │ └── main.go ├── api_pb ├── swagger.pb.go ├── api.pb.gw.go └── api.pb.go ├── api.swagger.json └── go.sum /gen.go: -------------------------------------------------------------------------------- 1 | //go:generate make 2 | 3 | package grpc_gateway_example 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # grpc-gateway-example 2 | 3 | RESTful API and gRPC interface -------------------------------------------------------------------------------- /tools.go: -------------------------------------------------------------------------------- 1 | // +build tools 2 | 3 | package grpc_gateway_example 4 | 5 | import ( 6 | _ "github.com/golang/protobuf/protoc-gen-go" 7 | _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway" 8 | _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger" 9 | ) 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | mkdir -p "api_pb" 3 | protoc -I/usr/local/include -I. \ 4 | -I${GOPATH}/src \ 5 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ 6 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway \ 7 | --grpc-gateway_out=logtostderr=true:./api_pb \ 8 | --swagger_out=allow_merge=true,merge_file_name=api:. \ 9 | --go_out=plugins=grpc:./api_pb ./*.proto 10 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/klim0v/grpc-gateway-example 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b 7 | github.com/golang/protobuf v1.3.5 8 | github.com/gorilla/websocket v1.4.2 // indirect 9 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 10 | github.com/grpc-ecosystem/grpc-gateway v1.14.3 11 | github.com/prometheus/client_golang v1.5.1 12 | github.com/stretchr/testify v1.5.1 // indirect 13 | github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc 14 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e 15 | google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c 16 | google.golang.org/grpc v1.24.0 17 | ) 18 | -------------------------------------------------------------------------------- /swagger.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | import "protoc-gen-swagger/options/annotations.proto"; 4 | import "google/rpc/status.proto"; 5 | 6 | package api_pb; 7 | 8 | option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { 9 | info: { 10 | title: "My Habr Example Service" 11 | version: "1.0" 12 | contact: { 13 | name: "Klimov Sergey" 14 | url: "https://github.com/klim0v" 15 | email: "klim0v-sergey@yandex.ru" 16 | }; 17 | }; 18 | schemes: [HTTP,HTTPS,WS,WSS] 19 | consumes: "application/json" 20 | produces: "application/json" 21 | responses: { 22 | key: "default" 23 | value: { 24 | description: "" 25 | schema: { 26 | json_schema: { 27 | ref: ".google.rpc.Status" 28 | }; 29 | }; 30 | }; 31 | }; 32 | }; -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: github pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Setup Node 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: 12 19 | env: 20 | RUNNER_TEMP: "abc" 21 | 22 | - name: Cache dependencies 23 | uses: actions/cache@v1 24 | with: 25 | path: ~/.npm 26 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 27 | restore-keys: | 28 | ${{ runner.os }}-node- 29 | 30 | - run: npm install -g redoc-cli 31 | 32 | - name: Build 33 | run: redoc-cli bundle ./api.swagger.json 34 | 35 | - run: mkdir -p ./public && mv redoc-static.html ./public/index.html 36 | 37 | - name: Deploy 38 | uses: peaceiris/actions-gh-pages@v3.5.5 39 | with: 40 | github_token: ${{ secrets.GITHUB_TOKEN }} 41 | publish_dir: ./public 42 | -------------------------------------------------------------------------------- /api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package api_pb; 4 | 5 | import "google/api/annotations.proto"; 6 | import "google/protobuf/struct.proto"; 7 | import "google/api/httpbody.proto"; 8 | import "google/protobuf/empty.proto"; 9 | 10 | message AddressRequest { 11 | string address = 1; 12 | uint64 height = 2; 13 | } 14 | message AddressResponse { 15 | map balance = 1; 16 | string transactions_count = 2; 17 | } 18 | message SubscribeRequest { 19 | string query = 1; 20 | } 21 | message SubscribeResponse { 22 | string query = 1; 23 | google.protobuf.Struct data = 2; 24 | message Event { 25 | string key = 1; 26 | repeated string events = 2; 27 | } 28 | repeated Event events = 3; 29 | } 30 | 31 | service BlockchainService { 32 | rpc Address (AddressRequest) returns (AddressResponse) { 33 | option (google.api.http) = { 34 | get: "/address/{address}" 35 | }; 36 | } 37 | rpc DownloadFile(google.protobuf.Empty) returns (google.api.HttpBody) { 38 | option (google.api.http) = { 39 | get: "/file.txt" 40 | }; 41 | } 42 | rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) { 43 | option (google.api.http) = { 44 | get: "/subscribe" 45 | }; 46 | } 47 | } -------------------------------------------------------------------------------- /service/service.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "github.com/golang/protobuf/jsonpb" 8 | "github.com/golang/protobuf/ptypes/empty" 9 | _struct "github.com/golang/protobuf/ptypes/struct" 10 | "github.com/klim0v/grpc-gateway-example/api_pb" 11 | "google.golang.org/genproto/googleapis/api/httpbody" 12 | "google.golang.org/grpc/codes" 13 | "google.golang.org/grpc/status" 14 | "time" 15 | ) 16 | 17 | type BlockchainServer struct { 18 | eventBus <-chan interface{} 19 | } 20 | 21 | func NewBlockchainServer(eventBus <-chan interface{}) *BlockchainServer { 22 | return &BlockchainServer{eventBus: eventBus} 23 | } 24 | 25 | func (*BlockchainServer) DownloadFile(_ context.Context, _ *empty.Empty) (*httpbody.HttpBody, error) { 26 | return &httpbody.HttpBody{ 27 | ContentType: "application/octet-stream", 28 | Data: []byte("Hello World"), 29 | }, nil 30 | } 31 | 32 | func (b *BlockchainServer) Address(_ context.Context, req *api_pb.AddressRequest) (*api_pb.AddressResponse, error) { 33 | if req.Address != "Mxb9a117e772a965a3fddddf83398fd8d71bf57ff6" { 34 | return &api_pb.AddressResponse{}, status.Error(codes.FailedPrecondition, "wallet not found") 35 | } 36 | return &api_pb.AddressResponse{ 37 | Balance: map[string]string{ 38 | "BIP": "12345678987654321", 39 | }, 40 | TransactionsCount: "120", 41 | }, nil 42 | } 43 | 44 | func (b *BlockchainServer) Subscribe(req *api_pb.SubscribeRequest, stream api_pb.BlockchainService_SubscribeServer) error { 45 | for { 46 | select { 47 | case <-stream.Context().Done(): 48 | return stream.Context().Err() 49 | case event := <-b.eventBus: 50 | byteData, err := json.Marshal(event) 51 | if err != nil { 52 | return err 53 | } 54 | var bb bytes.Buffer 55 | bb.Write(byteData) 56 | data := &_struct.Struct{Fields: make(map[string]*_struct.Value)} 57 | if err := (&jsonpb.Unmarshaler{}).Unmarshal(&bb, data); err != nil { 58 | return err 59 | } 60 | 61 | if err := stream.Send(&api_pb.SubscribeResponse{ 62 | Query: req.Query, 63 | Data: data, 64 | Events: []*api_pb.SubscribeResponse_Event{ 65 | { 66 | Key: "tx.hash", 67 | Events: []string{"01EFD8EEF507A5BFC4A7D57ECA6F61B96B7CDFF559698639A6733D25E2553539"}, 68 | }, 69 | }, 70 | }); err != nil { 71 | return err 72 | } 73 | case <-time.After(5 * time.Second): 74 | return nil 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /cmd/grpc_gateway_example/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | "github.com/golang/glog" 7 | grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" 8 | "github.com/grpc-ecosystem/grpc-gateway/runtime" 9 | gw "github.com/klim0v/grpc-gateway-example/api_pb" 10 | "github.com/klim0v/grpc-gateway-example/service" 11 | "github.com/prometheus/client_golang/prometheus/promhttp" 12 | "github.com/tmc/grpc-websocket-proxy/wsproxy" 13 | "golang.org/x/sync/errgroup" 14 | "google.golang.org/grpc" 15 | "net" 16 | "net/http" 17 | "time" 18 | ) 19 | 20 | func run() error { 21 | ctx := context.Background() 22 | ctx, cancel := context.WithCancel(ctx) 23 | defer cancel() 24 | 25 | lis, err := net.Listen("tcp", ":8842") 26 | if err != nil { 27 | return err 28 | } 29 | 30 | grpcServer := grpc.NewServer( 31 | grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor), 32 | grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor), 33 | ) 34 | eventBus := make(chan interface{}) 35 | gw.RegisterBlockchainServiceServer(grpcServer, service.NewBlockchainServer(eventBus)) 36 | grpc_prometheus.Register(grpcServer) 37 | 38 | var group errgroup.Group 39 | 40 | group.Go(func() error { 41 | return grpcServer.Serve(lis) 42 | }) 43 | 44 | mux := runtime.NewServeMux(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true})) 45 | runtime.SetHTTPBodyMarshaler(mux) 46 | opts := []grpc.DialOption{ 47 | grpc.WithInsecure(), 48 | grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(50000000)), 49 | } 50 | 51 | group.Go(func() error { 52 | return gw.RegisterBlockchainServiceHandlerFromEndpoint(ctx, mux, ":8842", opts) 53 | }) 54 | group.Go(func() error { 55 | return http.ListenAndServe(":8843", wsproxy.WebsocketProxy(mux)) 56 | }) 57 | group.Go(func() error { 58 | return http.ListenAndServe(":2662", promhttp.Handler()) 59 | }) 60 | group.Go(func() error { 61 | for i := 0; i < 100; i++ { 62 | eventBus <- struct { 63 | Type byte 64 | Coin string 65 | Value int 66 | TransactionCount int 67 | Timestamp time.Time 68 | }{ 69 | Type: 1, 70 | Coin: "BIP", 71 | TransactionCount: i, 72 | Timestamp: time.Now(), 73 | } 74 | } 75 | return nil 76 | }) 77 | 78 | return group.Wait() 79 | } 80 | 81 | func main() { 82 | flag.Parse() 83 | defer glog.Flush() 84 | 85 | if err := run(); err != nil { 86 | glog.Fatal(err) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /api_pb/swagger.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: swagger.proto 3 | 4 | package api_pb 5 | 6 | import ( 7 | fmt "fmt" 8 | proto "github.com/golang/protobuf/proto" 9 | _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" 10 | _ "google.golang.org/genproto/googleapis/rpc/status" 11 | math "math" 12 | ) 13 | 14 | // Reference imports to suppress errors if they are not otherwise used. 15 | var _ = proto.Marshal 16 | var _ = fmt.Errorf 17 | var _ = math.Inf 18 | 19 | // This is a compile-time assertion to ensure that this generated file 20 | // is compatible with the proto package it is being compiled against. 21 | // A compilation error at this line likely means your copy of the 22 | // proto package needs to be updated. 23 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 24 | 25 | func init() { proto.RegisterFile("swagger.proto", fileDescriptor_49635b75e059a131) } 26 | 27 | var fileDescriptor_49635b75e059a131 = []byte{ 28 | // 251 bytes of a gzipped FileDescriptorProto 29 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x8f, 0xcf, 0x4a, 0x3b, 0x31, 30 | 0x10, 0xc7, 0xd9, 0x5f, 0x4b, 0x7f, 0xb0, 0x50, 0x90, 0x20, 0xae, 0xee, 0x69, 0xd1, 0x9b, 0xb8, 31 | 0x49, 0xad, 0xb7, 0x9e, 0xfc, 0x83, 0x20, 0x88, 0x17, 0xfb, 0x00, 0x32, 0x9b, 0xc6, 0x34, 0x9a, 32 | 0xcd, 0x0c, 0x49, 0x76, 0xed, 0xbe, 0x86, 0xcf, 0xe2, 0xc1, 0xc7, 0x13, 0xb3, 0xbd, 0x79, 0x9a, 33 | 0x99, 0xef, 0x7c, 0x06, 0xe6, 0x93, 0xcf, 0xc3, 0x07, 0x68, 0xad, 0x3c, 0x27, 0x8f, 0x11, 0xd9, 34 | 0x0c, 0xc8, 0xbc, 0x50, 0x53, 0x5e, 0xa4, 0x51, 0xd6, 0x5a, 0xb9, 0x7a, 0x4f, 0x08, 0xa4, 0x68, 35 | 0xd0, 0x05, 0x01, 0xce, 0x61, 0x84, 0xd4, 0x8f, 0x57, 0x65, 0xa1, 0x11, 0xb5, 0x55, 0xc2, 0x93, 36 | 0x14, 0x21, 0x42, 0xec, 0xf6, 0x8b, 0xdb, 0xef, 0xec, 0xf3, 0xe6, 0x2b, 0x63, 0x32, 0x2f, 0x9e, 37 | 0x86, 0xea, 0x01, 0x1a, 0x5f, 0xdd, 0xef, 0xa0, 0x25, 0xab, 0xaa, 0xb5, 0xf2, 0xbd, 0x91, 0xea, 38 | 0xf4, 0x2e, 0x9f, 0x3f, 0x5a, 0xd3, 0x62, 0xff, 0x9b, 0x68, 0x35, 0xb0, 0x93, 0x6d, 0x8c, 0x14, 39 | 0x56, 0x42, 0x68, 0x13, 0xb7, 0x5d, 0xc3, 0x25, 0xb6, 0xe2, 0xdd, 0x9a, 0x76, 0xd1, 0x97, 0xc5, 40 | 0x58, 0xeb, 0x90, 0xc8, 0xeb, 0x01, 0xdc, 0x46, 0xed, 0xb8, 0xef, 0x96, 0x93, 0x4b, 0xbe, 0x38, 41 | 0x9f, 0x66, 0xff, 0x26, 0xd3, 0xe5, 0x01, 0x10, 0x59, 0x23, 0xd3, 0x7b, 0xe2, 0x2d, 0xa0, 0x5b, 42 | 0xfd, 0x49, 0x9e, 0xcf, 0xf2, 0xff, 0x1b, 0xf5, 0x0a, 0x9d, 0x8d, 0xec, 0x98, 0x1d, 0xe5, 0x87, 43 | 0x25, 0xe3, 0xa3, 0x00, 0xf7, 0x24, 0xf9, 0x3a, 0x09, 0x34, 0xb3, 0x64, 0x70, 0xf5, 0x13, 0x00, 44 | 0x00, 0xff, 0xff, 0xea, 0x72, 0x08, 0x21, 0x21, 0x01, 0x00, 0x00, 45 | } 46 | -------------------------------------------------------------------------------- /api_pb/api.pb.gw.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 | // source: api.proto 3 | 4 | /* 5 | Package api_pb is a reverse proxy. 6 | 7 | It translates gRPC into RESTful JSON APIs. 8 | */ 9 | package api_pb 10 | 11 | import ( 12 | "context" 13 | "io" 14 | "net/http" 15 | 16 | "github.com/golang/protobuf/descriptor" 17 | "github.com/golang/protobuf/proto" 18 | "github.com/golang/protobuf/ptypes/empty" 19 | "github.com/grpc-ecosystem/grpc-gateway/runtime" 20 | "github.com/grpc-ecosystem/grpc-gateway/utilities" 21 | "google.golang.org/grpc" 22 | "google.golang.org/grpc/codes" 23 | "google.golang.org/grpc/grpclog" 24 | "google.golang.org/grpc/status" 25 | ) 26 | 27 | // Suppress "imported and not used" errors 28 | var _ codes.Code 29 | var _ io.Reader 30 | var _ status.Status 31 | var _ = runtime.String 32 | var _ = utilities.NewDoubleArray 33 | var _ = descriptor.ForMessage 34 | 35 | var ( 36 | filter_BlockchainService_Address_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} 37 | ) 38 | 39 | func request_BlockchainService_Address_0(ctx context.Context, marshaler runtime.Marshaler, client BlockchainServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 40 | var protoReq AddressRequest 41 | var metadata runtime.ServerMetadata 42 | 43 | var ( 44 | val string 45 | ok bool 46 | err error 47 | _ = err 48 | ) 49 | 50 | val, ok = pathParams["address"] 51 | if !ok { 52 | return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") 53 | } 54 | 55 | protoReq.Address, err = runtime.String(val) 56 | 57 | if err != nil { 58 | return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) 59 | } 60 | 61 | if err := req.ParseForm(); err != nil { 62 | return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 63 | } 64 | if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BlockchainService_Address_0); err != nil { 65 | return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 66 | } 67 | 68 | msg, err := client.Address(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 69 | return msg, metadata, err 70 | 71 | } 72 | 73 | func local_request_BlockchainService_Address_0(ctx context.Context, marshaler runtime.Marshaler, server BlockchainServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 74 | var protoReq AddressRequest 75 | var metadata runtime.ServerMetadata 76 | 77 | var ( 78 | val string 79 | ok bool 80 | err error 81 | _ = err 82 | ) 83 | 84 | val, ok = pathParams["address"] 85 | if !ok { 86 | return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") 87 | } 88 | 89 | protoReq.Address, err = runtime.String(val) 90 | 91 | if err != nil { 92 | return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) 93 | } 94 | 95 | if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_BlockchainService_Address_0); err != nil { 96 | return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 97 | } 98 | 99 | msg, err := server.Address(ctx, &protoReq) 100 | return msg, metadata, err 101 | 102 | } 103 | 104 | func request_BlockchainService_DownloadFile_0(ctx context.Context, marshaler runtime.Marshaler, client BlockchainServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 105 | var protoReq empty.Empty 106 | var metadata runtime.ServerMetadata 107 | 108 | msg, err := client.DownloadFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 109 | return msg, metadata, err 110 | 111 | } 112 | 113 | func local_request_BlockchainService_DownloadFile_0(ctx context.Context, marshaler runtime.Marshaler, server BlockchainServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 114 | var protoReq empty.Empty 115 | var metadata runtime.ServerMetadata 116 | 117 | msg, err := server.DownloadFile(ctx, &protoReq) 118 | return msg, metadata, err 119 | 120 | } 121 | 122 | var ( 123 | filter_BlockchainService_Subscribe_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 124 | ) 125 | 126 | func request_BlockchainService_Subscribe_0(ctx context.Context, marshaler runtime.Marshaler, client BlockchainServiceClient, req *http.Request, pathParams map[string]string) (BlockchainService_SubscribeClient, runtime.ServerMetadata, error) { 127 | var protoReq SubscribeRequest 128 | var metadata runtime.ServerMetadata 129 | 130 | if err := req.ParseForm(); err != nil { 131 | return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 132 | } 133 | if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_BlockchainService_Subscribe_0); err != nil { 134 | return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 135 | } 136 | 137 | stream, err := client.Subscribe(ctx, &protoReq) 138 | if err != nil { 139 | return nil, metadata, err 140 | } 141 | header, err := stream.Header() 142 | if err != nil { 143 | return nil, metadata, err 144 | } 145 | metadata.HeaderMD = header 146 | return stream, metadata, nil 147 | 148 | } 149 | 150 | // RegisterBlockchainServiceHandlerServer registers the http handlers for service BlockchainService to "mux". 151 | // UnaryRPC :call BlockchainServiceServer directly. 152 | // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 153 | func RegisterBlockchainServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlockchainServiceServer) error { 154 | 155 | mux.Handle("GET", pattern_BlockchainService_Address_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 156 | ctx, cancel := context.WithCancel(req.Context()) 157 | defer cancel() 158 | inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 159 | rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 160 | if err != nil { 161 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 162 | return 163 | } 164 | resp, md, err := local_request_BlockchainService_Address_0(rctx, inboundMarshaler, server, req, pathParams) 165 | ctx = runtime.NewServerMetadataContext(ctx, md) 166 | if err != nil { 167 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 168 | return 169 | } 170 | 171 | forward_BlockchainService_Address_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 172 | 173 | }) 174 | 175 | mux.Handle("GET", pattern_BlockchainService_DownloadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 176 | ctx, cancel := context.WithCancel(req.Context()) 177 | defer cancel() 178 | inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 179 | rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 180 | if err != nil { 181 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 182 | return 183 | } 184 | resp, md, err := local_request_BlockchainService_DownloadFile_0(rctx, inboundMarshaler, server, req, pathParams) 185 | ctx = runtime.NewServerMetadataContext(ctx, md) 186 | if err != nil { 187 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 188 | return 189 | } 190 | 191 | forward_BlockchainService_DownloadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 192 | 193 | }) 194 | 195 | mux.Handle("GET", pattern_BlockchainService_Subscribe_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 196 | err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") 197 | _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 198 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 199 | return 200 | }) 201 | 202 | return nil 203 | } 204 | 205 | // RegisterBlockchainServiceHandlerFromEndpoint is same as RegisterBlockchainServiceHandler but 206 | // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 207 | func RegisterBlockchainServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 208 | conn, err := grpc.Dial(endpoint, opts...) 209 | if err != nil { 210 | return err 211 | } 212 | defer func() { 213 | if err != nil { 214 | if cerr := conn.Close(); cerr != nil { 215 | grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 216 | } 217 | return 218 | } 219 | go func() { 220 | <-ctx.Done() 221 | if cerr := conn.Close(); cerr != nil { 222 | grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 223 | } 224 | }() 225 | }() 226 | 227 | return RegisterBlockchainServiceHandler(ctx, mux, conn) 228 | } 229 | 230 | // RegisterBlockchainServiceHandler registers the http handlers for service BlockchainService to "mux". 231 | // The handlers forward requests to the grpc endpoint over "conn". 232 | func RegisterBlockchainServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 233 | return RegisterBlockchainServiceHandlerClient(ctx, mux, NewBlockchainServiceClient(conn)) 234 | } 235 | 236 | // RegisterBlockchainServiceHandlerClient registers the http handlers for service BlockchainService 237 | // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BlockchainServiceClient". 238 | // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BlockchainServiceClient" 239 | // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 240 | // "BlockchainServiceClient" to call the correct interceptors. 241 | func RegisterBlockchainServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BlockchainServiceClient) error { 242 | 243 | mux.Handle("GET", pattern_BlockchainService_Address_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 244 | ctx, cancel := context.WithCancel(req.Context()) 245 | defer cancel() 246 | inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 247 | rctx, err := runtime.AnnotateContext(ctx, mux, req) 248 | if err != nil { 249 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 250 | return 251 | } 252 | resp, md, err := request_BlockchainService_Address_0(rctx, inboundMarshaler, client, req, pathParams) 253 | ctx = runtime.NewServerMetadataContext(ctx, md) 254 | if err != nil { 255 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 256 | return 257 | } 258 | 259 | forward_BlockchainService_Address_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 260 | 261 | }) 262 | 263 | mux.Handle("GET", pattern_BlockchainService_DownloadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 264 | ctx, cancel := context.WithCancel(req.Context()) 265 | defer cancel() 266 | inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 267 | rctx, err := runtime.AnnotateContext(ctx, mux, req) 268 | if err != nil { 269 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 270 | return 271 | } 272 | resp, md, err := request_BlockchainService_DownloadFile_0(rctx, inboundMarshaler, client, req, pathParams) 273 | ctx = runtime.NewServerMetadataContext(ctx, md) 274 | if err != nil { 275 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 276 | return 277 | } 278 | 279 | forward_BlockchainService_DownloadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 280 | 281 | }) 282 | 283 | mux.Handle("GET", pattern_BlockchainService_Subscribe_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 284 | ctx, cancel := context.WithCancel(req.Context()) 285 | defer cancel() 286 | inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 287 | rctx, err := runtime.AnnotateContext(ctx, mux, req) 288 | if err != nil { 289 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 290 | return 291 | } 292 | resp, md, err := request_BlockchainService_Subscribe_0(rctx, inboundMarshaler, client, req, pathParams) 293 | ctx = runtime.NewServerMetadataContext(ctx, md) 294 | if err != nil { 295 | runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 296 | return 297 | } 298 | 299 | forward_BlockchainService_Subscribe_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) 300 | 301 | }) 302 | 303 | return nil 304 | } 305 | 306 | var ( 307 | pattern_BlockchainService_Address_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0}, []string{"address"}, "", runtime.AssumeColonVerbOpt(true))) 308 | 309 | pattern_BlockchainService_DownloadFile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"file.txt"}, "", runtime.AssumeColonVerbOpt(true))) 310 | 311 | pattern_BlockchainService_Subscribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"subscribe"}, "", runtime.AssumeColonVerbOpt(true))) 312 | ) 313 | 314 | var ( 315 | forward_BlockchainService_Address_0 = runtime.ForwardResponseMessage 316 | 317 | forward_BlockchainService_DownloadFile_0 = runtime.ForwardResponseMessage 318 | 319 | forward_BlockchainService_Subscribe_0 = runtime.ForwardResponseStream 320 | ) 321 | -------------------------------------------------------------------------------- /api.swagger.json: -------------------------------------------------------------------------------- 1 | { 2 | "swagger": "2.0", 3 | "info": { 4 | "title": "My Habr Example Service", 5 | "version": "1.0", 6 | "contact": { 7 | "name": "Klimov Sergey", 8 | "url": "https://github.com/klim0v", 9 | "email": "klim0v-sergey@yandex.ru" 10 | } 11 | }, 12 | "schemes": [ 13 | "http", 14 | "https", 15 | "ws", 16 | "wss" 17 | ], 18 | "consumes": [ 19 | "application/json" 20 | ], 21 | "produces": [ 22 | "application/json" 23 | ], 24 | "paths": { 25 | "/address/{address}": { 26 | "get": { 27 | "operationId": "Address", 28 | "responses": { 29 | "200": { 30 | "description": "A successful response.", 31 | "schema": { 32 | "$ref": "#/definitions/api_pbAddressResponse" 33 | } 34 | }, 35 | "default": { 36 | "description": "", 37 | "schema": { 38 | "$ref": "#/definitions/rpcStatus" 39 | } 40 | } 41 | }, 42 | "parameters": [ 43 | { 44 | "name": "address", 45 | "in": "path", 46 | "required": true, 47 | "type": "string" 48 | }, 49 | { 50 | "name": "height", 51 | "in": "query", 52 | "required": false, 53 | "type": "string", 54 | "format": "uint64" 55 | } 56 | ], 57 | "tags": [ 58 | "BlockchainService" 59 | ] 60 | } 61 | }, 62 | "/file.txt": { 63 | "get": { 64 | "operationId": "DownloadFile", 65 | "responses": { 66 | "200": { 67 | "description": "A successful response.", 68 | "schema": { 69 | "$ref": "#/definitions/apiHttpBody" 70 | } 71 | }, 72 | "default": { 73 | "description": "", 74 | "schema": { 75 | "$ref": "#/definitions/rpcStatus" 76 | } 77 | } 78 | }, 79 | "tags": [ 80 | "BlockchainService" 81 | ] 82 | } 83 | }, 84 | "/subscribe": { 85 | "get": { 86 | "operationId": "Subscribe", 87 | "responses": { 88 | "200": { 89 | "description": "A successful response.(streaming responses)", 90 | "schema": { 91 | "$ref": "#/x-stream-definitions/api_pbSubscribeResponse" 92 | } 93 | }, 94 | "default": { 95 | "description": "", 96 | "schema": { 97 | "$ref": "#/definitions/rpcStatus" 98 | } 99 | } 100 | }, 101 | "parameters": [ 102 | { 103 | "name": "query", 104 | "in": "query", 105 | "required": false, 106 | "type": "string" 107 | } 108 | ], 109 | "tags": [ 110 | "BlockchainService" 111 | ] 112 | } 113 | } 114 | }, 115 | "definitions": { 116 | "SubscribeResponseEvent": { 117 | "type": "object", 118 | "properties": { 119 | "key": { 120 | "type": "string" 121 | }, 122 | "events": { 123 | "type": "array", 124 | "items": { 125 | "type": "string" 126 | } 127 | } 128 | } 129 | }, 130 | "apiHttpBody": { 131 | "type": "object", 132 | "properties": { 133 | "content_type": { 134 | "type": "string", 135 | "description": "The HTTP Content-Type header value specifying the content type of the body." 136 | }, 137 | "data": { 138 | "type": "string", 139 | "format": "byte", 140 | "description": "The HTTP request/response body as raw binary." 141 | }, 142 | "extensions": { 143 | "type": "array", 144 | "items": { 145 | "$ref": "#/definitions/protobufAny" 146 | }, 147 | "description": "Application specific response metadata. Must be set in the first response\nfor streaming APIs." 148 | } 149 | }, 150 | "description": "Message that represents an arbitrary HTTP body. It should only be used for\npayload formats that can't be represented as JSON, such as raw binary or\nan HTML page.\n\n\nThis message can be used both in streaming and non-streaming API methods in\nthe request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one\nwants to extract parameters from either the URL or HTTP template into the\nrequest fields and also want access to the raw HTTP body.\n\nExample:\n\n message GetResourceRequest {\n // A unique request id.\n string request_id = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody) returns\n (google.protobuf.Empty);\n }\n\nExample with streaming methods:\n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n }\n\nUse of this type only changes how the request and response bodies are\nhandled, all other features will continue to work unchanged." 151 | }, 152 | "api_pbAddressResponse": { 153 | "type": "object", 154 | "properties": { 155 | "balance": { 156 | "type": "object", 157 | "additionalProperties": { 158 | "type": "string" 159 | } 160 | }, 161 | "transactions_count": { 162 | "type": "string" 163 | } 164 | } 165 | }, 166 | "api_pbSubscribeResponse": { 167 | "type": "object", 168 | "properties": { 169 | "query": { 170 | "type": "string" 171 | }, 172 | "data": { 173 | "type": "object" 174 | }, 175 | "events": { 176 | "type": "array", 177 | "items": { 178 | "$ref": "#/definitions/SubscribeResponseEvent" 179 | } 180 | } 181 | } 182 | }, 183 | "protobufAny": { 184 | "type": "object", 185 | "properties": { 186 | "type_url": { 187 | "type": "string", 188 | "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." 189 | }, 190 | "value": { 191 | "type": "string", 192 | "format": "byte", 193 | "description": "Must be a valid serialized protocol buffer of the above specified type." 194 | } 195 | }, 196 | "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := ptypes.MarshalAny(foo)\n ...\n foo := \u0026pb.Foo{}\n if err := ptypes.UnmarshalAny(any, foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" 197 | }, 198 | "protobufNullValue": { 199 | "type": "string", 200 | "enum": [ 201 | "NULL_VALUE" 202 | ], 203 | "default": "NULL_VALUE", 204 | "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." 205 | }, 206 | "rpcStatus": { 207 | "type": "object", 208 | "properties": { 209 | "code": { 210 | "type": "integer", 211 | "format": "int32", 212 | "description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." 213 | }, 214 | "message": { 215 | "type": "string", 216 | "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." 217 | }, 218 | "details": { 219 | "type": "array", 220 | "items": { 221 | "$ref": "#/definitions/protobufAny" 222 | }, 223 | "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." 224 | } 225 | }, 226 | "description": "- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\n[google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` that can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security/privacy reasons.", 227 | "title": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https://github.com/grpc). The error model is designed to be:" 228 | }, 229 | "runtimeStreamError": { 230 | "type": "object", 231 | "properties": { 232 | "grpc_code": { 233 | "type": "integer", 234 | "format": "int32" 235 | }, 236 | "http_code": { 237 | "type": "integer", 238 | "format": "int32" 239 | }, 240 | "message": { 241 | "type": "string" 242 | }, 243 | "http_status": { 244 | "type": "string" 245 | }, 246 | "details": { 247 | "type": "array", 248 | "items": { 249 | "$ref": "#/definitions/protobufAny" 250 | } 251 | } 252 | } 253 | } 254 | }, 255 | "x-stream-definitions": { 256 | "api_pbSubscribeResponse": { 257 | "type": "object", 258 | "properties": { 259 | "result": { 260 | "$ref": "#/definitions/api_pbSubscribeResponse" 261 | }, 262 | "error": { 263 | "$ref": "#/definitions/runtimeStreamError" 264 | } 265 | }, 266 | "title": "Stream result of api_pbSubscribeResponse" 267 | } 268 | } 269 | } 270 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 3 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 4 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 5 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 6 | github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 7 | github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= 8 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 9 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= 10 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 11 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 12 | github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= 13 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 14 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 15 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 16 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 17 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 18 | github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= 19 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 20 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 21 | github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 22 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= 23 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 24 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 25 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 26 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 27 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 28 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 29 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 30 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 31 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 32 | github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= 33 | github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= 34 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 35 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 36 | github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= 37 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 38 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 39 | github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= 40 | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 41 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= 42 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= 43 | github.com/grpc-ecosystem/grpc-gateway v1.14.3 h1:OCJlWkOUoTnl0neNGlf4fUm3TmbEtguw7vR+nGtnDjY= 44 | github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0= 45 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 46 | github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 47 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 48 | github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= 49 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 50 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 51 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= 52 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 53 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 54 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 55 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 56 | github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= 57 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= 58 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 59 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 60 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 61 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 62 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 63 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 64 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 65 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 66 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 67 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 68 | github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= 69 | github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= 70 | github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= 71 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 72 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 73 | github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= 74 | github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 75 | github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= 76 | github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= 77 | github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= 78 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 79 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 80 | github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= 81 | github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= 82 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 83 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 84 | github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= 85 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 86 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 87 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 88 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 89 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 90 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 91 | github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= 92 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 93 | github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc h1:yUaosFVTJwnltaHbSNC3i82I92quFs+OFPRl8kNMVwo= 94 | github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= 95 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 96 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 97 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 98 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 99 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 100 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 101 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 102 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 103 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 104 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 105 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 106 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 107 | golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs= 108 | golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 109 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 110 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 111 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 112 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 113 | golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= 114 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 115 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= 116 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 117 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 118 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 119 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 120 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= 121 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 122 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 123 | golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= 124 | golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 125 | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= 126 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 127 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 128 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 129 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 130 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 131 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 132 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 133 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 134 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 135 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 136 | google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c h1:hrpEMCZ2O7DR5gC1n2AJGVhrwiEjOi35+jxtIuZpTMo= 137 | google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 138 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 139 | google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= 140 | google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= 141 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 142 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 143 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 144 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= 145 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 146 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 147 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 148 | gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= 149 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 150 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 151 | gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= 152 | gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 153 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 154 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 155 | -------------------------------------------------------------------------------- /api_pb/api.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: api.proto 3 | 4 | package api_pb 5 | 6 | import ( 7 | context "context" 8 | fmt "fmt" 9 | proto "github.com/golang/protobuf/proto" 10 | empty "github.com/golang/protobuf/ptypes/empty" 11 | _struct "github.com/golang/protobuf/ptypes/struct" 12 | _ "google.golang.org/genproto/googleapis/api/annotations" 13 | httpbody "google.golang.org/genproto/googleapis/api/httpbody" 14 | grpc "google.golang.org/grpc" 15 | codes "google.golang.org/grpc/codes" 16 | status "google.golang.org/grpc/status" 17 | math "math" 18 | ) 19 | 20 | // Reference imports to suppress errors if they are not otherwise used. 21 | var _ = proto.Marshal 22 | var _ = fmt.Errorf 23 | var _ = math.Inf 24 | 25 | // This is a compile-time assertion to ensure that this generated file 26 | // is compatible with the proto package it is being compiled against. 27 | // A compilation error at this line likely means your copy of the 28 | // proto package needs to be updated. 29 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 30 | 31 | type AddressRequest struct { 32 | Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` 33 | Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` 34 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 35 | XXX_unrecognized []byte `json:"-"` 36 | XXX_sizecache int32 `json:"-"` 37 | } 38 | 39 | func (m *AddressRequest) Reset() { *m = AddressRequest{} } 40 | func (m *AddressRequest) String() string { return proto.CompactTextString(m) } 41 | func (*AddressRequest) ProtoMessage() {} 42 | func (*AddressRequest) Descriptor() ([]byte, []int) { 43 | return fileDescriptor_00212fb1f9d3bf1c, []int{0} 44 | } 45 | 46 | func (m *AddressRequest) XXX_Unmarshal(b []byte) error { 47 | return xxx_messageInfo_AddressRequest.Unmarshal(m, b) 48 | } 49 | func (m *AddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 50 | return xxx_messageInfo_AddressRequest.Marshal(b, m, deterministic) 51 | } 52 | func (m *AddressRequest) XXX_Merge(src proto.Message) { 53 | xxx_messageInfo_AddressRequest.Merge(m, src) 54 | } 55 | func (m *AddressRequest) XXX_Size() int { 56 | return xxx_messageInfo_AddressRequest.Size(m) 57 | } 58 | func (m *AddressRequest) XXX_DiscardUnknown() { 59 | xxx_messageInfo_AddressRequest.DiscardUnknown(m) 60 | } 61 | 62 | var xxx_messageInfo_AddressRequest proto.InternalMessageInfo 63 | 64 | func (m *AddressRequest) GetAddress() string { 65 | if m != nil { 66 | return m.Address 67 | } 68 | return "" 69 | } 70 | 71 | func (m *AddressRequest) GetHeight() uint64 { 72 | if m != nil { 73 | return m.Height 74 | } 75 | return 0 76 | } 77 | 78 | type AddressResponse struct { 79 | Balance map[string]string `protobuf:"bytes,1,rep,name=balance,proto3" json:"balance,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` 80 | TransactionsCount string `protobuf:"bytes,2,opt,name=transactions_count,json=transactionsCount,proto3" json:"transactions_count,omitempty"` 81 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 82 | XXX_unrecognized []byte `json:"-"` 83 | XXX_sizecache int32 `json:"-"` 84 | } 85 | 86 | func (m *AddressResponse) Reset() { *m = AddressResponse{} } 87 | func (m *AddressResponse) String() string { return proto.CompactTextString(m) } 88 | func (*AddressResponse) ProtoMessage() {} 89 | func (*AddressResponse) Descriptor() ([]byte, []int) { 90 | return fileDescriptor_00212fb1f9d3bf1c, []int{1} 91 | } 92 | 93 | func (m *AddressResponse) XXX_Unmarshal(b []byte) error { 94 | return xxx_messageInfo_AddressResponse.Unmarshal(m, b) 95 | } 96 | func (m *AddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 97 | return xxx_messageInfo_AddressResponse.Marshal(b, m, deterministic) 98 | } 99 | func (m *AddressResponse) XXX_Merge(src proto.Message) { 100 | xxx_messageInfo_AddressResponse.Merge(m, src) 101 | } 102 | func (m *AddressResponse) XXX_Size() int { 103 | return xxx_messageInfo_AddressResponse.Size(m) 104 | } 105 | func (m *AddressResponse) XXX_DiscardUnknown() { 106 | xxx_messageInfo_AddressResponse.DiscardUnknown(m) 107 | } 108 | 109 | var xxx_messageInfo_AddressResponse proto.InternalMessageInfo 110 | 111 | func (m *AddressResponse) GetBalance() map[string]string { 112 | if m != nil { 113 | return m.Balance 114 | } 115 | return nil 116 | } 117 | 118 | func (m *AddressResponse) GetTransactionsCount() string { 119 | if m != nil { 120 | return m.TransactionsCount 121 | } 122 | return "" 123 | } 124 | 125 | type SubscribeRequest struct { 126 | Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` 127 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 128 | XXX_unrecognized []byte `json:"-"` 129 | XXX_sizecache int32 `json:"-"` 130 | } 131 | 132 | func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} } 133 | func (m *SubscribeRequest) String() string { return proto.CompactTextString(m) } 134 | func (*SubscribeRequest) ProtoMessage() {} 135 | func (*SubscribeRequest) Descriptor() ([]byte, []int) { 136 | return fileDescriptor_00212fb1f9d3bf1c, []int{2} 137 | } 138 | 139 | func (m *SubscribeRequest) XXX_Unmarshal(b []byte) error { 140 | return xxx_messageInfo_SubscribeRequest.Unmarshal(m, b) 141 | } 142 | func (m *SubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 143 | return xxx_messageInfo_SubscribeRequest.Marshal(b, m, deterministic) 144 | } 145 | func (m *SubscribeRequest) XXX_Merge(src proto.Message) { 146 | xxx_messageInfo_SubscribeRequest.Merge(m, src) 147 | } 148 | func (m *SubscribeRequest) XXX_Size() int { 149 | return xxx_messageInfo_SubscribeRequest.Size(m) 150 | } 151 | func (m *SubscribeRequest) XXX_DiscardUnknown() { 152 | xxx_messageInfo_SubscribeRequest.DiscardUnknown(m) 153 | } 154 | 155 | var xxx_messageInfo_SubscribeRequest proto.InternalMessageInfo 156 | 157 | func (m *SubscribeRequest) GetQuery() string { 158 | if m != nil { 159 | return m.Query 160 | } 161 | return "" 162 | } 163 | 164 | type SubscribeResponse struct { 165 | Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` 166 | Data *_struct.Struct `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` 167 | Events []*SubscribeResponse_Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` 168 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 169 | XXX_unrecognized []byte `json:"-"` 170 | XXX_sizecache int32 `json:"-"` 171 | } 172 | 173 | func (m *SubscribeResponse) Reset() { *m = SubscribeResponse{} } 174 | func (m *SubscribeResponse) String() string { return proto.CompactTextString(m) } 175 | func (*SubscribeResponse) ProtoMessage() {} 176 | func (*SubscribeResponse) Descriptor() ([]byte, []int) { 177 | return fileDescriptor_00212fb1f9d3bf1c, []int{3} 178 | } 179 | 180 | func (m *SubscribeResponse) XXX_Unmarshal(b []byte) error { 181 | return xxx_messageInfo_SubscribeResponse.Unmarshal(m, b) 182 | } 183 | func (m *SubscribeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 184 | return xxx_messageInfo_SubscribeResponse.Marshal(b, m, deterministic) 185 | } 186 | func (m *SubscribeResponse) XXX_Merge(src proto.Message) { 187 | xxx_messageInfo_SubscribeResponse.Merge(m, src) 188 | } 189 | func (m *SubscribeResponse) XXX_Size() int { 190 | return xxx_messageInfo_SubscribeResponse.Size(m) 191 | } 192 | func (m *SubscribeResponse) XXX_DiscardUnknown() { 193 | xxx_messageInfo_SubscribeResponse.DiscardUnknown(m) 194 | } 195 | 196 | var xxx_messageInfo_SubscribeResponse proto.InternalMessageInfo 197 | 198 | func (m *SubscribeResponse) GetQuery() string { 199 | if m != nil { 200 | return m.Query 201 | } 202 | return "" 203 | } 204 | 205 | func (m *SubscribeResponse) GetData() *_struct.Struct { 206 | if m != nil { 207 | return m.Data 208 | } 209 | return nil 210 | } 211 | 212 | func (m *SubscribeResponse) GetEvents() []*SubscribeResponse_Event { 213 | if m != nil { 214 | return m.Events 215 | } 216 | return nil 217 | } 218 | 219 | type SubscribeResponse_Event struct { 220 | Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` 221 | Events []string `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"` 222 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 223 | XXX_unrecognized []byte `json:"-"` 224 | XXX_sizecache int32 `json:"-"` 225 | } 226 | 227 | func (m *SubscribeResponse_Event) Reset() { *m = SubscribeResponse_Event{} } 228 | func (m *SubscribeResponse_Event) String() string { return proto.CompactTextString(m) } 229 | func (*SubscribeResponse_Event) ProtoMessage() {} 230 | func (*SubscribeResponse_Event) Descriptor() ([]byte, []int) { 231 | return fileDescriptor_00212fb1f9d3bf1c, []int{3, 0} 232 | } 233 | 234 | func (m *SubscribeResponse_Event) XXX_Unmarshal(b []byte) error { 235 | return xxx_messageInfo_SubscribeResponse_Event.Unmarshal(m, b) 236 | } 237 | func (m *SubscribeResponse_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 238 | return xxx_messageInfo_SubscribeResponse_Event.Marshal(b, m, deterministic) 239 | } 240 | func (m *SubscribeResponse_Event) XXX_Merge(src proto.Message) { 241 | xxx_messageInfo_SubscribeResponse_Event.Merge(m, src) 242 | } 243 | func (m *SubscribeResponse_Event) XXX_Size() int { 244 | return xxx_messageInfo_SubscribeResponse_Event.Size(m) 245 | } 246 | func (m *SubscribeResponse_Event) XXX_DiscardUnknown() { 247 | xxx_messageInfo_SubscribeResponse_Event.DiscardUnknown(m) 248 | } 249 | 250 | var xxx_messageInfo_SubscribeResponse_Event proto.InternalMessageInfo 251 | 252 | func (m *SubscribeResponse_Event) GetKey() string { 253 | if m != nil { 254 | return m.Key 255 | } 256 | return "" 257 | } 258 | 259 | func (m *SubscribeResponse_Event) GetEvents() []string { 260 | if m != nil { 261 | return m.Events 262 | } 263 | return nil 264 | } 265 | 266 | func init() { 267 | proto.RegisterType((*AddressRequest)(nil), "api_pb.AddressRequest") 268 | proto.RegisterType((*AddressResponse)(nil), "api_pb.AddressResponse") 269 | proto.RegisterMapType((map[string]string)(nil), "api_pb.AddressResponse.BalanceEntry") 270 | proto.RegisterType((*SubscribeRequest)(nil), "api_pb.SubscribeRequest") 271 | proto.RegisterType((*SubscribeResponse)(nil), "api_pb.SubscribeResponse") 272 | proto.RegisterType((*SubscribeResponse_Event)(nil), "api_pb.SubscribeResponse.Event") 273 | } 274 | 275 | func init() { proto.RegisterFile("api.proto", fileDescriptor_00212fb1f9d3bf1c) } 276 | 277 | var fileDescriptor_00212fb1f9d3bf1c = []byte{ 278 | // 495 bytes of a gzipped FileDescriptorProto 279 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xc1, 0x6e, 0xd3, 0x40, 280 | 0x10, 0x95, 0x93, 0x36, 0x91, 0x27, 0x11, 0x34, 0xa3, 0x28, 0x75, 0x0d, 0x12, 0x91, 0xc5, 0x21, 281 | 0x12, 0xc2, 0x86, 0x70, 0x00, 0xf5, 0x80, 0xd4, 0x40, 0x10, 0x37, 0x24, 0x47, 0xea, 0xb5, 0x5a, 282 | 0xdb, 0xdb, 0x64, 0x55, 0xb3, 0xeb, 0x7a, 0xd7, 0x81, 0x08, 0x71, 0xe1, 0x17, 0xe0, 0x73, 0x38, 283 | 0xf1, 0x0b, 0xfc, 0x02, 0x1f, 0x82, 0xbc, 0xde, 0x8d, 0xa2, 0x26, 0xbd, 0x79, 0xf6, 0xbd, 0x79, 284 | 0xb3, 0xf3, 0xde, 0x1a, 0x5c, 0x52, 0xb0, 0xb0, 0x28, 0x85, 0x12, 0xd8, 0x21, 0x05, 0xbb, 0x2a, 285 | 0x12, 0xff, 0xf1, 0x52, 0x88, 0x65, 0x4e, 0x23, 0x52, 0xb0, 0x88, 0x70, 0x2e, 0x14, 0x51, 0x4c, 286 | 0x70, 0xd9, 0xb0, 0xb6, 0xa8, 0xae, 0x92, 0xea, 0x3a, 0x92, 0xaa, 0xac, 0x52, 0x65, 0xd0, 0xb3, 287 | 0x9d, 0xde, 0x95, 0x52, 0x45, 0x22, 0xb2, 0x8d, 0x81, 0x1e, 0xdd, 0x6d, 0xa4, 0x9f, 0x0b, 0x65, 288 | 0xc0, 0x60, 0x06, 0x0f, 0x2e, 0xb2, 0xac, 0xa4, 0x52, 0xc6, 0xf4, 0xb6, 0xa2, 0x52, 0xa1, 0x07, 289 | 0x5d, 0xd2, 0x9c, 0x78, 0xce, 0xd8, 0x99, 0xb8, 0xb1, 0x2d, 0x71, 0x04, 0x9d, 0x15, 0x65, 0xcb, 290 | 0x95, 0xf2, 0x5a, 0x63, 0x67, 0x72, 0x14, 0x9b, 0x2a, 0xf8, 0xed, 0xc0, 0xc3, 0xad, 0x88, 0x2c, 291 | 0x04, 0x97, 0x14, 0xdf, 0x42, 0x37, 0x21, 0x39, 0xe1, 0x29, 0xf5, 0x9c, 0x71, 0x7b, 0xd2, 0x9b, 292 | 0x3e, 0x0d, 0x9b, 0x2d, 0xc3, 0x3b, 0xcc, 0x70, 0xd6, 0xd0, 0xe6, 0x5c, 0x95, 0x9b, 0xd8, 0x36, 293 | 0xe1, 0x73, 0x40, 0x55, 0x12, 0x2e, 0x49, 0xaa, 0x3d, 0xb8, 0x4a, 0x45, 0xc5, 0x9b, 0xb9, 0x6e, 294 | 0x3c, 0xd8, 0x45, 0xde, 0xd5, 0x80, 0x7f, 0x0e, 0xfd, 0x5d, 0x1d, 0x3c, 0x81, 0xf6, 0x0d, 0xdd, 295 | 0x98, 0x05, 0xea, 0x4f, 0x1c, 0xc2, 0xf1, 0x9a, 0xe4, 0x15, 0x35, 0x1a, 0x4d, 0x71, 0xde, 0x7a, 296 | 0xe3, 0x04, 0x13, 0x38, 0x59, 0x54, 0x89, 0x4c, 0x4b, 0x96, 0x50, 0x6b, 0xc2, 0x10, 0x8e, 0x6f, 297 | 0x2b, 0x5a, 0x5a, 0x85, 0xa6, 0x08, 0xfe, 0x38, 0x30, 0xd8, 0xa1, 0x9a, 0x55, 0x0f, 0x72, 0xf1, 298 | 0x19, 0x1c, 0x65, 0x44, 0x11, 0x3d, 0xae, 0x37, 0x3d, 0x0d, 0x9b, 0x10, 0x42, 0x1b, 0x42, 0xb8, 299 | 0xd0, 0xe9, 0xc5, 0x9a, 0x84, 0xaf, 0xa1, 0x43, 0xd7, 0x94, 0x2b, 0xe9, 0xb5, 0xb5, 0x59, 0x4f, 300 | 0xac, 0x59, 0x7b, 0xd3, 0xc2, 0x79, 0xcd, 0x8b, 0x0d, 0xdd, 0x7f, 0x09, 0xc7, 0xfa, 0xe0, 0xc0, 301 | 0xc2, 0xa3, 0xad, 0x66, 0x6b, 0xdc, 0x9e, 0xb8, 0xb6, 0x65, 0xfa, 0xab, 0x05, 0x83, 0x59, 0x2e, 302 | 0xd2, 0x9b, 0x74, 0x45, 0x18, 0x5f, 0xd0, 0x72, 0xcd, 0x52, 0x8a, 0x97, 0xd0, 0xbd, 0xb0, 0x31, 303 | 0xef, 0x25, 0xa5, 0x3d, 0xf1, 0x4f, 0xef, 0x49, 0x30, 0xf0, 0x7f, 0xfc, 0xfd, 0xf7, 0xb3, 0x35, 304 | 0x44, 0x8c, 0xcc, 0x4b, 0x89, 0xbe, 0x99, 0x8f, 0xef, 0xf8, 0x09, 0xfa, 0xef, 0xc5, 0x17, 0x9e, 305 | 0x0b, 0x92, 0x7d, 0x60, 0x39, 0xc5, 0xd1, 0x9e, 0x11, 0xf3, 0xfa, 0x35, 0xfa, 0x43, 0x7b, 0x5e, 306 | 0xff, 0x16, 0x1f, 0x95, 0x2a, 0x66, 0x22, 0xdb, 0x04, 0x03, 0xad, 0xdc, 0x43, 0x37, 0xba, 0x66, 307 | 0x39, 0x0d, 0xd5, 0x57, 0x85, 0x97, 0xe0, 0x6e, 0x4d, 0x41, 0xef, 0x80, 0x4f, 0xcd, 0x65, 0xcf, 308 | 0xee, 0x75, 0x30, 0x40, 0x2d, 0xda, 0x47, 0x88, 0xa4, 0xc5, 0x5e, 0x38, 0x49, 0x47, 0x5f, 0xe8, 309 | 0xd5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xab, 0x37, 0x17, 0x38, 0x98, 0x03, 0x00, 0x00, 310 | } 311 | 312 | // Reference imports to suppress errors if they are not otherwise used. 313 | var _ context.Context 314 | var _ grpc.ClientConn 315 | 316 | // This is a compile-time assertion to ensure that this generated file 317 | // is compatible with the grpc package it is being compiled against. 318 | const _ = grpc.SupportPackageIsVersion4 319 | 320 | // BlockchainServiceClient is the client API for BlockchainService service. 321 | // 322 | // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 323 | type BlockchainServiceClient interface { 324 | Address(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*AddressResponse, error) 325 | DownloadFile(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error) 326 | Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (BlockchainService_SubscribeClient, error) 327 | } 328 | 329 | type blockchainServiceClient struct { 330 | cc *grpc.ClientConn 331 | } 332 | 333 | func NewBlockchainServiceClient(cc *grpc.ClientConn) BlockchainServiceClient { 334 | return &blockchainServiceClient{cc} 335 | } 336 | 337 | func (c *blockchainServiceClient) Address(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*AddressResponse, error) { 338 | out := new(AddressResponse) 339 | err := c.cc.Invoke(ctx, "/api_pb.BlockchainService/Address", in, out, opts...) 340 | if err != nil { 341 | return nil, err 342 | } 343 | return out, nil 344 | } 345 | 346 | func (c *blockchainServiceClient) DownloadFile(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error) { 347 | out := new(httpbody.HttpBody) 348 | err := c.cc.Invoke(ctx, "/api_pb.BlockchainService/DownloadFile", in, out, opts...) 349 | if err != nil { 350 | return nil, err 351 | } 352 | return out, nil 353 | } 354 | 355 | func (c *blockchainServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (BlockchainService_SubscribeClient, error) { 356 | stream, err := c.cc.NewStream(ctx, &_BlockchainService_serviceDesc.Streams[0], "/api_pb.BlockchainService/Subscribe", opts...) 357 | if err != nil { 358 | return nil, err 359 | } 360 | x := &blockchainServiceSubscribeClient{stream} 361 | if err := x.ClientStream.SendMsg(in); err != nil { 362 | return nil, err 363 | } 364 | if err := x.ClientStream.CloseSend(); err != nil { 365 | return nil, err 366 | } 367 | return x, nil 368 | } 369 | 370 | type BlockchainService_SubscribeClient interface { 371 | Recv() (*SubscribeResponse, error) 372 | grpc.ClientStream 373 | } 374 | 375 | type blockchainServiceSubscribeClient struct { 376 | grpc.ClientStream 377 | } 378 | 379 | func (x *blockchainServiceSubscribeClient) Recv() (*SubscribeResponse, error) { 380 | m := new(SubscribeResponse) 381 | if err := x.ClientStream.RecvMsg(m); err != nil { 382 | return nil, err 383 | } 384 | return m, nil 385 | } 386 | 387 | // BlockchainServiceServer is the server API for BlockchainService service. 388 | type BlockchainServiceServer interface { 389 | Address(context.Context, *AddressRequest) (*AddressResponse, error) 390 | DownloadFile(context.Context, *empty.Empty) (*httpbody.HttpBody, error) 391 | Subscribe(*SubscribeRequest, BlockchainService_SubscribeServer) error 392 | } 393 | 394 | // UnimplementedBlockchainServiceServer can be embedded to have forward compatible implementations. 395 | type UnimplementedBlockchainServiceServer struct { 396 | } 397 | 398 | func (*UnimplementedBlockchainServiceServer) Address(ctx context.Context, req *AddressRequest) (*AddressResponse, error) { 399 | return nil, status.Errorf(codes.Unimplemented, "method Address not implemented") 400 | } 401 | func (*UnimplementedBlockchainServiceServer) DownloadFile(ctx context.Context, req *empty.Empty) (*httpbody.HttpBody, error) { 402 | return nil, status.Errorf(codes.Unimplemented, "method DownloadFile not implemented") 403 | } 404 | func (*UnimplementedBlockchainServiceServer) Subscribe(req *SubscribeRequest, srv BlockchainService_SubscribeServer) error { 405 | return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") 406 | } 407 | 408 | func RegisterBlockchainServiceServer(s *grpc.Server, srv BlockchainServiceServer) { 409 | s.RegisterService(&_BlockchainService_serviceDesc, srv) 410 | } 411 | 412 | func _BlockchainService_Address_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 413 | in := new(AddressRequest) 414 | if err := dec(in); err != nil { 415 | return nil, err 416 | } 417 | if interceptor == nil { 418 | return srv.(BlockchainServiceServer).Address(ctx, in) 419 | } 420 | info := &grpc.UnaryServerInfo{ 421 | Server: srv, 422 | FullMethod: "/api_pb.BlockchainService/Address", 423 | } 424 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 425 | return srv.(BlockchainServiceServer).Address(ctx, req.(*AddressRequest)) 426 | } 427 | return interceptor(ctx, in, info, handler) 428 | } 429 | 430 | func _BlockchainService_DownloadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 431 | in := new(empty.Empty) 432 | if err := dec(in); err != nil { 433 | return nil, err 434 | } 435 | if interceptor == nil { 436 | return srv.(BlockchainServiceServer).DownloadFile(ctx, in) 437 | } 438 | info := &grpc.UnaryServerInfo{ 439 | Server: srv, 440 | FullMethod: "/api_pb.BlockchainService/DownloadFile", 441 | } 442 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { 443 | return srv.(BlockchainServiceServer).DownloadFile(ctx, req.(*empty.Empty)) 444 | } 445 | return interceptor(ctx, in, info, handler) 446 | } 447 | 448 | func _BlockchainService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { 449 | m := new(SubscribeRequest) 450 | if err := stream.RecvMsg(m); err != nil { 451 | return err 452 | } 453 | return srv.(BlockchainServiceServer).Subscribe(m, &blockchainServiceSubscribeServer{stream}) 454 | } 455 | 456 | type BlockchainService_SubscribeServer interface { 457 | Send(*SubscribeResponse) error 458 | grpc.ServerStream 459 | } 460 | 461 | type blockchainServiceSubscribeServer struct { 462 | grpc.ServerStream 463 | } 464 | 465 | func (x *blockchainServiceSubscribeServer) Send(m *SubscribeResponse) error { 466 | return x.ServerStream.SendMsg(m) 467 | } 468 | 469 | var _BlockchainService_serviceDesc = grpc.ServiceDesc{ 470 | ServiceName: "api_pb.BlockchainService", 471 | HandlerType: (*BlockchainServiceServer)(nil), 472 | Methods: []grpc.MethodDesc{ 473 | { 474 | MethodName: "Address", 475 | Handler: _BlockchainService_Address_Handler, 476 | }, 477 | { 478 | MethodName: "DownloadFile", 479 | Handler: _BlockchainService_DownloadFile_Handler, 480 | }, 481 | }, 482 | Streams: []grpc.StreamDesc{ 483 | { 484 | StreamName: "Subscribe", 485 | Handler: _BlockchainService_Subscribe_Handler, 486 | ServerStreams: true, 487 | }, 488 | }, 489 | Metadata: "api.proto", 490 | } 491 | --------------------------------------------------------------------------------