proxy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package proxy provides server and codec for proxying gRPC requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher added in v0.2.0

type Matcher interface {
	MatchMetadata(string, metadata.MD) discovery.Matches
}

Matcher matches the request URI and incoming metadata to the registered rules.

type Option

type Option func(*Server)

Option is a functional option for the server.

func Debug

func Debug() Option

Debug sets the debug mode.

func Version

func Version(v string) Option

Version sets the version of the server.

func WithGRPCServerOptions

func WithGRPCServerOptions(opts ...grpc.ServerOption) Option

WithGRPCServerOptions sets the gRPC server options.

type RawBytesCodec

type RawBytesCodec struct{}

RawBytesCodec sets the received bytes as-is to the target, whether it is a byte slice or a proto.Message. For proto.Message, it uses proto.Marshal and proto.Unmarshal.

func (RawBytesCodec) Marshal

func (RawBytesCodec) Marshal(v any) ([]byte, error)

Marshal returns the received byte slice as is.

func (RawBytesCodec) Name

func (RawBytesCodec) Name() string

Name returns the name of the codec.

func (RawBytesCodec) Unmarshal

func (RawBytesCodec) Unmarshal(data []byte, v any) error

Unmarshal sets the received bytes as is to the target.

type Server

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

Server is a gRPC server.

func NewServer

func NewServer(m Matcher, opts ...Option) *Server

NewServer creates a new server.

func (*Server) Close

func (s *Server) Close()

Close stops the server.

func (*Server) Listen

func (s *Server) Listen(addr string) (err error)

Listen starts the server on the given address. Blocking call.

type ServerStream added in v0.2.0

type ServerStream grpc.ServerStream

ServerStream is a gRPC server stream.

Directories

Path Synopsis
Package middleware contains middlewares for gRPC unknown handlers.
Package middleware contains middlewares for gRPC unknown handlers.

Jump to

Keyboard shortcuts

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