client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DialEndpoint must contain an HTTP URL which will be used for connection upgrade
	// e.g. https://<public-ip>:12345/tunnel
	DialEndpoint string
	// DialMethod must contain an HTTP method to be used for request, e.g. POST
	DialMethod string
	// ForwardAddr is an address which will receive the data stream from remote service
	// 127.0.0.1 if not specified
	ForwardAddr string
	// ForwardPort is the number of port which will receive the data stream from remote service
	ForwardPort int
	// RequestDecorator allows to modify the request before it is sent to the Port Forwarder
	RequestDecorator func(req *http.Request)
	// Debug enables debug logging
	Debug bool
}

Config specifies the configuration for PortForwarderClient

type PortForwarderClient

type PortForwarderClient interface {
	// StartForwarding starts a goroutine which initiates the connection to remote service.
	//It will try to re-connect in case of failure.
	StartForwarding(ctx context.Context, minRetryInterval, maxRetryInterval time.Duration)
	// Ready returns true if client currently has an active forwarding connection
	Ready() bool
	// Close terminates the connection
	Close() error
}

PortForwarderClient allows the remote service to bypass the client firewall by using long-running connection

func New

func New(log zerolog.Logger, cfg *Config) (PortForwarderClient, error)

New creates PortForwarderClient

Directories

Path Synopsis
internal
rt

Jump to

Keyboard shortcuts

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