proxy

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

Factory provides a mechanism for building various type of proxy based on their unique type key. This is primarily developed for use when serialising proxy connection information to and from yaml files for Juju.

func NewDefaultFactory

func NewDefaultFactory() (*Factory, error)

NewDefaultFactory constructs a factory with all the known proxy implementations in juju registered.

func NewFactory

func NewFactory() *Factory

NewFactory creates a new empty factory

func (*Factory) MakerForTypeKey

func (f *Factory) MakerForTypeKey(typeKey string) (*FactoryMaker, error)

MakerForTypeKey provides a new factory maker for the given type key if one has been registered.

func (*Factory) Register

func (f *Factory) Register(typeKey string, register FactoryRegister) error

Register registers a new proxier type and creationg methods to this factory

type FactoryMaker

type FactoryMaker struct {
	RawConfig interface{}
	Register  FactoryRegister
}

FactoryMaker is shell object used for facilitating the making of a proxy object

func (*FactoryMaker) Config

func (f *FactoryMaker) Config() interface{}

Config returns a raw config for a given proxy type that can be used to unmarshal against.

func (*FactoryMaker) Make

func (f *FactoryMaker) Make() (Proxier, error)

Make attempts to make the proxy from the filled config.

type FactoryRegister

type FactoryRegister struct {
	ConfigFn func() interface{}
	MakerFn  func(interface{}) (Proxier, error)
}

FactoryRegister describe registration details for building a new proxy.

type Proxier

type Proxier interface {
	// Start starts the lifecycle of the proxy. Proxy's should have their start
	// method called before operating with the proxy.
	Start() error

	// Stop stops the proxy after a call to Start(). Proxy's should be
	// considered single use. This call should only ever be made once.
	Stop()

	// Type is the unique key identifying the type of proxying for configuration
	// purposes.
	Type() string
}

Proxier describes an implemntation of an object that is capable of performing connection proxying. Typically an implementation will support this interface and one of the more specific types of proxy's below. Proxy's should be considered single use with regards to their Start and Stop methods and not thead safe.

type TunnelProxier

type TunnelProxier interface {
	Proxier

	// Host returns the host string for establishing a tunneled connection.
	Host() string

	// Port returns the host port to connect to for tunneling connections.
	Port() string
}

TunnelProxier describes an implementation that can provide tunneled proxy services. The interface provides the connection details for connecting to the proxy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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