grpc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

Dial returns a GRPC connection.

func DialInsecure

func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

DialInsecure returns an insecure GRPC connection.

Types

type ClientOption

type ClientOption func(o *clientOptions)

ClientOption is gRPC client option.

func WithEndpoint

func WithEndpoint(endpoint string) ClientOption

WithEndpoint with client endpoint.

func WithOptions

func WithOptions(opts ...grpc.DialOption) ClientOption

WithOptions with gRPC options.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout with client timeout.

type Server

type Server struct {
	*grpc.Server
	// contains filtered or unexported fields
}

Server is a gRPC server wrapper

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Endpoint

func (s *Server) Endpoint() (string, error)

Endpoint return a real address to registry endpoint. examples: grpc://127.0.0.1:9000?isSecure=false

func (*Server) Start

func (s *Server) Start(_ context.Context) error

Start the gRPC server.

func (*Server) Stop

func (s *Server) Stop(_ context.Context) error

Stop the gRPC server.

type ServerOption

type ServerOption func(o *Server)

ServerOption is gRPC server option.

func Address

func Address(addr string) ServerOption

Address with server address.

func Network

func Network(network string) ServerOption

Network with server network.

func Options

func Options(opts ...grpc.ServerOption) ServerOption

Options with grpc options.

func TLSConfig

func TLSConfig(c *tls.Config) ServerOption

TLSConfig with TLS config.

func Timeout

func Timeout(timeout time.Duration) ServerOption

Timeout with server timeout.

func UnaryInterceptor

func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption

UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

func (*Transport) Endpoint

func (tr *Transport) Endpoint() string

Endpoint returns the transport endpoint.

func (*Transport) Kind

func (tr *Transport) Kind() transport.Kind

Kind returns the transport kind.

func (*Transport) Operation

func (tr *Transport) Operation() string

Operation returns the transport operation.

Jump to

Keyboard shortcuts

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