server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Reverse proxy to expose streaming service.

Expose service via TCP, UDP or UNIX connection as WebSocket so clients can use standard protocol to communicate with internal backend.

The project was heavily inspired from socat and websocketd.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoints []Endpoint    // endpoint configuration (to where connection will be established)
	Timeout   time.Duration // connection timeout
}

Configuration for HTTP WS reverse proxy to multiple backend

func (Config) Create

func (c Config) Create() http.Handler

Create HTTP handler with internal mapping of exported path and remote addresses

Example
config := Config{
	Endpoints: []Endpoint{
		{Protocol: "tcp", Address: "127.0.0.1:12345", Path: "/ws"},
	},
	Timeout: 15 * time.Second,
}

http.ListenAndServe(":8080", config.Create())

type DynamicConfig added in v0.0.3

type DynamicConfig struct {
	Timeout time.Duration // connection timeout
}

Dynamic configuration for HTTP WS reverse proxy to multiple backend.

Mapping to /<address:port>/<protocol:tls|tcp|udp>

func (DynamicConfig) Create added in v0.0.3

func (c DynamicConfig) Create() http.Handler

Create HTTP handler with dynamic mapping to remote addresses

type Endpoint

type Endpoint struct {
	Path     string // front HTTP binding path (ex: /ws)
	Address  string // remote address with host and port (if applicable)
	Protocol string // protocol type: tcp, udp, unix
}

Endpoint definition that contains remote address (with port) and protocol (supported by Go Dial function)

Jump to

Keyboard shortcuts

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