connector

package
v0.5.61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	// Start the Connector, returns an error on failure
	Start(*types.CertBundle) error
	// Stop the Connector, returns an error on failure
	Stop() error
	// IsRunning returns true when the Connector is running
	IsRunning() bool

	// GenerateLocalCertBundle generates a root CA and leaf certificate for
	// securing connector communications for the local instance
	// this function is a convenience function which wraps other
	// methods
	GenerateLocalCertBundle(out string) (*types.CertBundle, error)

	// Fetches the local certificate bundle from the given directory
	// if any of the required files do not exist an error and a nil
	// CertBundle will be returned
	GetLocalCertBundle(dir string) (*types.CertBundle, error)

	// Generates a Leaf certificate for securing a connector
	GenerateLeafCert(
		privateKey, rootCA string,
		hosts, ips []string,
		dir string) (*types.CertBundle, error)

	// ExposeService allows you to expose a local or remote
	// service with another connector
	ExposeService(
		name string,
		port int,
		remoteAddr string,
		destAddr string,
		direction string,
	) (string, error)

	// RemoveService removes a previously exposed service
	RemoveService(id string) error

	// ListServices returns a slice of active services
	ListServices() ([]*shipyard.Service, error)
}

func NewConnector

func NewConnector(opts ConnectorOptions) Connector

NewConnector creates a new connector with the given options

type ConnectorImpl

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

ConnectorImpl is a concrete implementation of the Connector interface

func (*ConnectorImpl) ExposeService

func (c *ConnectorImpl) ExposeService(
	name string,
	port int,
	remoteAddr string,
	destAddr string,
	direction string,
) (string, error)

ExposeService allows you to expose a local or remote service with another connector

func (*ConnectorImpl) GenerateLeafCert

func (c *ConnectorImpl) GenerateLeafCert(
	rootKey, rootCA string, host, ips []string, dir string) (*types.CertBundle, error)

GenerateLeafCert generates a x509 leaf certificate with the given details

func (*ConnectorImpl) GenerateLocalCertBundle

func (c *ConnectorImpl) GenerateLocalCertBundle(out string) (*types.CertBundle, error)

creates a CA and local leaf cert

func (*ConnectorImpl) GetLocalCertBundle

func (c *ConnectorImpl) GetLocalCertBundle(dir string) (*types.CertBundle, error)

func (*ConnectorImpl) IsRunning

func (c *ConnectorImpl) IsRunning() bool

IsRunning returns true when the Connector is running

func (*ConnectorImpl) ListServices

func (c *ConnectorImpl) ListServices() ([]*shipyard.Service, error)

ListServices lists all active services

func (*ConnectorImpl) RemoveService

func (c *ConnectorImpl) RemoveService(id string) error

RemoveService removes a previously exposed service

func (*ConnectorImpl) Start

func (c *ConnectorImpl) Start(cb *types.CertBundle) error

Start the Connector, returns an error on failure

func (*ConnectorImpl) Stop

func (c *ConnectorImpl) Stop() error

Stop the Connector, returns an error on failure

type ConnectorOptions

type ConnectorOptions struct {
	LogDirectory string
	BinaryPath   string
	GrpcBind     string
	HTTPBind     string
	APIBind      string
	LogLevel     string
	PidFile      string
}

func DefaultConnectorOptions

func DefaultConnectorOptions() ConnectorOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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