tunnel

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTunnelAddress is the default address that the tunnel pkg will
	// use if an alternate address is not specified
	DefaultTunnelAddress = "dproxy.batch.sh:443"

	// ReconnectSleep determines the length of time to wait between reconnect attempts to dProxy
	ReconnectSleep = time.Second * 5

	DefaultGRPCTimeoutSeconds = 5
)

Variables

View Source
var (
	ErrNotAuthorized = errors.New("not authorized")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Client services.DProxyClient
	Conn   *grpc.ClientConn
	Token  string

	PlumberClusterID  string
	PlumberID         string
	PlumberVersion    string
	OutboundMessageCh chan *events.Outbound

	Options *opts.TunnelOptions
	// contains filtered or unexported fields
}

func (*Client) Close

func (d *Client) Close() error

func (*Client) Delete added in v1.6.0

func (d *Client) Delete(ctx context.Context, tunnelID string) error

func (*Client) Read

func (d *Client) Read() chan *events.Outbound

func (*Client) Start

func (d *Client) Start(ctx context.Context, bus string, errorCh chan<- *records.ErrorRecord) error

type Config added in v1.14.4

type Config struct {
	PlumberVersion   string
	PlumberClusterID string
	PlumberID        string
}

type ITunnel

type ITunnel interface {
	// Start is called by a backend's Tunnel() method. It authorizes the connection
	// and begins reading a GRPC stream of responses consisting of Tunnel protobuf
	// messages.
	Start(ctx context.Context, bus string, errorCh chan<- *records.ErrorRecord) error

	// Read returns a channel that will receive replay events from the dProxy service
	Read() chan *events.Outbound

	// Close closes the connection to dProxy service
	Close() error

	// Delete deletes a tunnel from dProxy and from ui-bff destinations.
	// This should be called after the tunnel is deleted from the plumber cluster to ensure proper cleanup.
	Delete(ctx context.Context, tunnelID string) error
}

func New

func New(opts *opts.TunnelOptions, cfg *Config) (ITunnel, error)

New validates CLI options and returns a new Client struct

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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