client

package
v0.0.0-...-08f68e1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONNECTING = iota
	IDLE
	RUNNING
)

Status of a Connection

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config *Config
	// contains filtered or unexported fields
}

Client connects to one or more Server using HTTP websockets. The Server can then send HTTP requests to execute.

func NewClient

func NewClient(config *Config) (c *Client)

NewClient creates a new Client.

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown the Proxy

func (*Client) Start

func (c *Client) Start(ctx context.Context)

Start the Proxy

type Config

type Config struct {
	Target       string
	PoolIdleSize int
	PoolMaxSize  int
	SecretKey    string
	// contains filtered or unexported fields
}

func LoadConfiguration

func LoadConfiguration(configFile string, subdomain string, port int, showWsReadErrors bool) (Config, error)

LoadConfiguration loads configuration from a YAML file

type Connection

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

Connection handle a single websocket (HTTP/TCP) connection to an Server

func NewConnection

func NewConnection(pool *Pool) *Connection

NewConnection create a Connection object

func (*Connection) Close

func (connection *Connection) Close()

Close close the ws/tcp connection and remove it from the pool

func (*Connection) Connect

func (connection *Connection) Connect(ctx context.Context) (err error)

Connect to the IsolatorServer using a HTTP websocket

func (*Connection) IsInitialConnection

func (c *Connection) IsInitialConnection() bool

type Pool

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

Pool manage a pool of connection to a remote Server

func NewPool

func NewPool(client *Client, target string) (pool *Pool)

NewPool creates a new Pool

func (*Pool) Shutdown

func (pool *Pool) Shutdown()

Shutdown close all connection in the pool

func (*Pool) Size

func (pool *Pool) Size() (poolSize *PoolSize)

Size return the current state of the pool

func (*Pool) Start

func (pool *Pool) Start(ctx context.Context)

Start connect to the remote Server

type PoolSize

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

PoolSize represent the number of open connections per status

func (*PoolSize) String

func (poolSize *PoolSize) String() string

type ProxyTunnels

type ProxyTunnels struct {
	Tunnels []TunnelConfig
}

type TunnelConfig

type TunnelConfig struct {
	Name      string
	Subdomain string
	Port      int
}

Jump to

Keyboard shortcuts

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