proto

package
v0.0.0-...-ee930af Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: MIT Imports: 13 Imported by: 2

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRouteGuideHandler

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

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

func RegisterRouteGuideHandlerClient

func RegisterRouteGuideHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RouteGuideClient) error

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

func RegisterRouteGuideHandlerFromEndpoint

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

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

func RegisterRouteGuideServer

func RegisterRouteGuideServer(s *grpc.Server, srv RouteGuideServer)

Types

type Request

type Request struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Request) Descriptor

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

func (*Request) GetId

func (m *Request) GetId() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (dst *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type Response

type Response struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Response) Descriptor

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

func (*Response) GetName

func (m *Response) GetName() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (dst *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type RouteGuideClient

type RouteGuideClient interface {
	GetName(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error)
	GetInfo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

RouteGuideClient is the client API for RouteGuide service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRouteGuideClient

func NewRouteGuideClient(cc *grpc.ClientConn) RouteGuideClient

type RouteGuideServer

type RouteGuideServer interface {
	GetName(context.Context, *Request) (*Response, error)
	Echo(context.Context, *StringMessage) (*StringMessage, error)
	GetInfo(context.Context, *Request) (*Response, error)
}

type StringMessage

type StringMessage struct {
	Value                string   `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StringMessage) Descriptor

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

func (*StringMessage) GetValue

func (m *StringMessage) GetValue() string

func (*StringMessage) ProtoMessage

func (*StringMessage) ProtoMessage()

func (*StringMessage) Reset

func (m *StringMessage) Reset()

func (*StringMessage) String

func (m *StringMessage) String() string

func (*StringMessage) XXX_DiscardUnknown

func (m *StringMessage) XXX_DiscardUnknown()

func (*StringMessage) XXX_Marshal

func (m *StringMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StringMessage) XXX_Merge

func (dst *StringMessage) XXX_Merge(src proto.Message)

func (*StringMessage) XXX_Size

func (m *StringMessage) XXX_Size() int

func (*StringMessage) XXX_Unmarshal

func (m *StringMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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