rudia

package module
v0.0.0-...-34c8016 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: MIT Imports: 5 Imported by: 1

README

rudia

rudia is a simple application that will both connect to upstream TCP listener endpoints and accept connections from upstream TCP clients, and then relay the messages read to a second local TCP listener endpoint which accepts many connections and any number of client listeners. If connections that were explictly made are severed (e.g. to upstream or client listeners), the application will attempt to reconnect while maintaining all of the other client and upstream connections.

Example
Usage of rudia:
  -clientPort="32779": TCP port to listen for relay clients on
  -proxy=[]: Upstream address to proxy, repeat the flag to proxy multiple
  -retry=10: Retry interval in seconds for attempting to reconnect
  -upstreamListenerIdleTimeout=600: Idle timeout in seconds before an upstream listener connection is considered dead
  -upstreamPort="32799": TCP port to listen for upstreams on
  -upstreamProxyIdleTimeout=10: Idle timeout in seconds before a proxied upstream connection is considered dead

rudia -clientPort 9090 -upstreamPort 9091 -proxy someremoteserver:9999 -proxy someotherserver:6666

Documentation

Overview

Package rudia implements a simple library for relaying TCP string messages from one source to many clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repeater

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

A Repeater connects to an upstream TCP endpoint and relays the messages it receives to all connected clients.

func NewRepeater

func NewRepeater(options *RepeaterOptions) *Repeater

NewRepeater creates a new Repeater and starts listening for client connections.

func (*Repeater) ListenAndAcceptClients

func (r *Repeater) ListenAndAcceptClients(address string)

ListenAndAcceptClients listens to the specified adddress for new TCP clients and upon successful connect, adds them to the pool of clients to relay any messages received to.

func (*Repeater) ListenAndAcceptUpstreams

func (r *Repeater) ListenAndAcceptUpstreams(address string)

ListenAndAcceptUpstreams listens to the specified adddress for new TCP upstreams and upon successful connect, adds them to the pool of upstreams to relay any messages received from.

func (*Repeater) Proxy

func (r *Repeater) Proxy(address string)

Proxy connects to the specified TCP address and relays all received messages to connected clients. If the connection to the specified address fails, an attempt will be made to reconnect. This will repeat until the program exits.

func (*Repeater) Push

func (r *Repeater) Push(address string)

Push connects to the specified TCP address and relays all received messages from upstreams to it. If the connection to the specified address fails, an attempt will be made to reconnect. This will repeat until the program exits.

func (*Repeater) Shutdown

func (r *Repeater) Shutdown()

Shutdown shuts down the repeater, stops taking new connections and closing existing connections

func (*Repeater) Stop

func (r *Repeater) Stop(address string)

Stop terminates the proxy or push for the specified address.

type RepeaterOptions

type RepeaterOptions struct {
	RetryInterval               time.Duration
	UpstreamProxyIdleTimeout    time.Duration
	UpstreamListenerIdleTimeout time.Duration
}

RepeaterOptions provides configuration options for controlling the behavior of the Repeater.

Directories

Path Synopsis
cmd
rudia command
rudiad command

Jump to

Keyboard shortcuts

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