Help us shape the future of Go! Take the 2026 Go Developer Survey

grpc

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Target           string
	DailOptions      []grpc.DialOption
	Weight           uint32
	MaxFails         uint
	Timeout          time.Duration
	FailTimeout      time.Duration
	TLSVerify        bool
	Tags             map[string]string
	IsTracingEnabled bool
	ServiceID        string
}

Options defines the configuration for a GRPC proxy instance.

type Proxy added in v0.10.0

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

Proxy implements a reverse proxy for gRPC services.

func New

func New(options Options) (*Proxy, error)

New creates a new GRPCProxy instance with the given options.

func (*Proxy) AddFailedCount added in v0.10.0

func (p *Proxy) AddFailedCount(count uint) error

AddFailedCount increments the failed request count for the upstream server.

func (*Proxy) Close added in v0.10.0

func (p *Proxy) Close() error

Close closes the underlying gRPC client connection.

func (*Proxy) ID added in v0.10.0

func (p *Proxy) ID() string

ID return proxy's ID.

func (*Proxy) IsAvailable added in v0.10.0

func (p *Proxy) IsAvailable() bool

IsAvailable returns true if the upstream gRPC server is considered healthy.

func (*Proxy) ServeHTTP added in v0.10.0

func (p *Proxy) ServeHTTP(ctx context.Context, c *app.RequestContext)

ServeHTTP implements the http.Handler interface.

func (*Proxy) Tag added in v0.10.0

func (p *Proxy) Tag(key string) (value string, exist bool)

Tag retrieves a specific metadata tag value from the proxy instance.

func (*Proxy) Tags added in v0.10.0

func (p *Proxy) Tags() map[string]string

Tags returns all metadata tags of the proxy instance.

func (*Proxy) Target added in v0.10.0

func (p *Proxy) Target() string

Target returns the target URL of the upstream gRPC server.

func (*Proxy) Weight added in v0.10.0

func (p *Proxy) Weight() uint32

Weight returns the relative weight of this proxy instance for load balancing.

Jump to

Keyboard shortcuts

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