proxy

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package proxy is a transparent proxy built on the micro/server

Package proxy is a transparent proxy built on the micro/server

Index

Constants

This section is empty.

Variables

View Source
var DefaultEndpoint = "localhost:9090"

DefaultEndpoint holds default proxy address

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option func signature

func Tracer added in v3.1.6

func Tracer(t tracer.Tracer) Option

Tracer to be used for tracing

func WithClient

func WithClient(c client.Client) Option

WithClient sets the client

func WithEndpoint

func WithEndpoint(e string) Option

WithEndpoint sets a proxy endpoint

func WithLink(name string, c client.Client) Option

WithLink sets a link for outbound requests

func WithLogger

func WithLogger(l logger.Logger) Option

WithLogger specifies the logger to use

func WithMeter added in v3.1.6

func WithMeter(m meter.Meter) Option

WithMeter specifies the meter to use

func WithRouter

func WithRouter(r router.Router) Option

WithRouter specifies the router to use

type Options

type Options struct {
	// Tracer used for tracing
	Tracer tracer.Tracer
	// Client for communication
	Client client.Client
	// Router for routing
	Router router.Router
	// Logger used for logging
	Logger logger.Logger
	// Meter used for metrics
	Meter meter.Meter
	// Links holds the communication links
	Links map[string]client.Client
	// Endpoint holds the destination address
	Endpoint string
}

Options for proxy

func NewOptions added in v3.1.6

func NewOptions(opts ...Option) Options

NewOptions returns new options struct that filled by opts

type Proxy

type Proxy interface {
	// ProcessMessage handles inbound messages
	ProcessMessage(context.Context, server.Message) error
	// ServeRequest handles inbound requests
	ServeRequest(context.Context, server.Request, server.Response) error
	// Name of the proxy protocol
	String() string
}

Proxy can be used as a proxy server for micro services

Jump to

Keyboard shortcuts

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