tunnel

package
v5.0.5 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidClientMode = errors.New("invalid client mode")

ErrInvalidClientMode indicate that the requested client mode is not valid for the tunnel.

Functions

func ProxyDestination

func ProxyDestination(dialer Dialer, endpoint, token string, opts ...ProxyOption) error

ProxyDestination proxies TCP connection from remote source device to the local destination application via IoT secure tunneling. This is usually used on IoT things.

func ProxySource

func ProxySource(listener net.Listener, endpoint, token string, opts ...ProxyOption) error

ProxySource proxies TCP connection from local socket to remote destination application via IoT secure tunneling. This is usually used on a computer or bastion server.

Types

type ClientMode

type ClientMode string

ClientMode is a mode of the client.

const (
	Source      ClientMode = "source"
	Destination ClientMode = "destination"
)

List of ClientModes.

func (ClientMode) String

func (m ClientMode) String() string

type Dialer

type Dialer func() (io.ReadWriteCloser, error)

Dialer is a proxy destination dialer.

type ErrorHandler

type ErrorHandler interface {
	HandleError(error)
}

ErrorHandler is an interface to handler error.

type ErrorHandlerFunc

type ErrorHandlerFunc func(error)

ErrorHandlerFunc type is an adapter to use handler function as ErrorHandler.

func (ErrorHandlerFunc) HandleError

func (f ErrorHandlerFunc) HandleError(err error)

HandleError implements ErrorHandler interface.

type Notification

type Notification struct {
	ClientAccessToken string     `json:"clientAccessToken"`
	ClientMode        ClientMode `json:"clientMode"`
	Region            string     `json:"region"`
	Services          []string   `json:"services"`
}

Notification represents notify message.

type Option

type Option func(*Options) error

Option is a type of functional options.

type Options

type Options struct {
	// EndpointHostFunc is a function returns secure proxy endpoint.
	EndpointHostFunc func(region string) string
	// TopicFunc is a function returns MQTT topic for the operation.
	TopicFunc func(operation string) string
}

Options stores options of the tunnel.

type ProxyOption

type ProxyOption func(*ProxyOptions) error

ProxyOption is a type of functional options.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ProxyOption

WithErrorHandler sets a ErrorHandler.

func WithPingPeriod

func WithPingPeriod(d time.Duration) ProxyOption

WithPingPeriod sets ping send period.

type ProxyOptions

type ProxyOptions struct {
	InsecureSkipVerify bool
	Scheme             string
	ErrorHandler       ErrorHandler
	PingPeriod         time.Duration
}

ProxyOptions stores options of the proxy.

type Tunnel

type Tunnel interface {
	mqtt.Handler
	OnError(func(error))
}

Tunnel is an interface of secure tunneling.

func New

func New(ctx context.Context, cli awsiotdev.Device, dialer map[string]Dialer, opts ...Option) (Tunnel, error)

New creates new secure tunneling proxy.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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