Documentation ¶
Overview ¶
Package grpc provides a gRPC client that fits the gRPC server.
Index ¶
- func NewGRPCTLSServer(t *testing.T, addr string, useTLS bool) (*exec.Cmd, context.CancelFunc)
- type Client
- func (c *Client) Close()
- func (c *Client) GetFeature(ctx context.Context, long, lat int32) error
- func (c *Client) HandleStream(ctx context.Context, numberOfMessages int32) error
- func (c *Client) HandleUnary(ctx context.Context, name string) error
- func (c *Client) ListFeatures(ctx context.Context, longLo, latLo, longHi, latHi int32) error
- type Options
- type Server
- func (s *Server) GetFeature(_ context.Context, point *routeguide.Point) (*routeguide.Feature, error)
- func (s *Server) GetGRPCServer() *grpc.Server
- func (s *Server) ListFeatures(rect *routeguide.Rectangle, stream routeguide.RouteGuide_ListFeaturesServer) error
- func (*Server) Max(srv pbStream.Math_MaxServer) error
- func (s *Server) RecordRoute(stream routeguide.RouteGuide_RecordRouteServer) error
- func (s *Server) RouteChat(stream routeguide.RouteGuide_RouteChatServer) error
- func (s *Server) Run()
- func (*Server) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error)
- func (s *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGRPCTLSServer ¶
NewGRPCTLSServer triggers an external go tls client that runs `numRequests` HTTPs requests to `serverAddr`. Returns the command executed and a callback to start sending requests.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a single gRPC client that fits the gRPC server.
func (*Client) GetFeature ¶
GetFeature activates the GetFeature RPC.
func (*Client) HandleStream ¶
HandleStream performs a gRPC stream call to FetchResponse RPC of StreamService service.
func (*Client) HandleUnary ¶
HandleUnary performs a gRPC unary call to SayHello RPC of the greeter service.
type Options ¶
type Options struct { // DialTimeout the timeout before giving up on a dialing to the server. Set as 0 for the default (currently 5 seconds). DialTimeout time.Duration // CustomDialer allows to modify the underlying dialer used by grpc package. Set nil for the default dialer. CustomDialer *net.Dialer }
Options allows to determine the behavior of the client.
type Server ¶
type Server struct { Address string pb.UnimplementedGreeterServer routeguide.UnimplementedRouteGuideServer pbStream.UnimplementedMathServer // contains filtered or unexported fields }
Server is used to implement helloworld.GreeterServer.
func NewServerWithoutBind ¶
func NewServerWithoutBind(opts ...grpc.ServerOption) *Server
NewServerWithoutBind returns a new instance of the gRPC server.
func (*Server) GetFeature ¶
func (s *Server) GetFeature(_ context.Context, point *routeguide.Point) (*routeguide.Feature, error)
GetFeature returns the feature at the given point.
func (*Server) GetGRPCServer ¶
GetGRPCServer returns the gRPC server.
func (*Server) ListFeatures ¶
func (s *Server) ListFeatures(rect *routeguide.Rectangle, stream routeguide.RouteGuide_ListFeaturesServer) error
ListFeatures lists all features contained within the given bounding Rectangle.
func (*Server) Max ¶
func (*Server) Max(srv pbStream.Math_MaxServer) error
Max implements MathServer.
func (*Server) RecordRoute ¶
func (s *Server) RecordRoute(stream routeguide.RouteGuide_RecordRouteServer) error
RecordRoute records a route composited of a sequence of points.
It gets a stream of points, and responds with statistics about the "trip": number of points, number of known features visited, total distance traveled, and total time spent.
func (*Server) RouteChat ¶
func (s *Server) RouteChat(stream routeguide.RouteGuide_RouteChatServer) error
RouteChat receives a stream of message/location pairs, and responds with a stream of all previous messages at each of those locations.
func (*Server) SayHello ¶
func (*Server) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error)
SayHello implements helloworld.GreeterServer.
Directories ¶
Path | Synopsis |
---|---|
Package main provides a simple gRPC server that can be used for testing.
|
Package main provides a simple gRPC server that can be used for testing. |