Documentation ¶
Index ¶
- Variables
- func ProxyDestination(dialer Dialer, endpoint, token string, opts ...ProxyOption) error
- func ProxySource(listener net.Listener, endpoint, token string, opts ...ProxyOption) error
- type ClientMode
- type Dialer
- type ErrorHandler
- type ErrorHandlerFunc
- type Notification
- type Option
- type Options
- type ProxyOption
- type ProxyOptions
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
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 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 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.