peroxide

package module
Version: v0.0.0-...-6ddd95f Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2014 License: MIT Imports: 2 Imported by: 0

README

peroxide

GoDoc Build Status

Peroxide provides some simple proxy-server-like functions in golang to simplify testing reliable or redundant network services and bindings.

These projects have corner cases that are otherwise difficult to test as they involve bringing the service up/down at specific intervals in order to test the correct availability sequence. Peroxide makes this somewhat easier to accomplish, as you don't have to touch the running service; simply start/stop a proxy at will.

Documentation

Overview

Package peroxide provides some simple proxy-server-like functions to simplify testing reliable or redundant network services and bindings.

These projects have corner cases that are otherwise difficult to test as they involve bringing the service up/down at specific intervals in order to test the correct availability sequence. Peroxide makes this somewhat easier to accomplish, as you don't have to touch the running service; simply start/stop a proxy at will.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Close()
}

Conn is an interface implemented by all proxied connections.

type Listener

type Listener interface {
	// AcceptOne tells the Listener to accept another connection for proxying. It returns the
	// address on which it is expecting to accept that connection, and a channel on which it
	// will send the resulting Conn object once the connection is established.
	AcceptOne() (net.Addr, <-chan Conn)

	Close()
}

Listener is an interface for connection-oriented protocols like TCP.

type TCPListener

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

TCPListener implements the Listener interface for the TCP protocol.

func NewTCPListener

func NewTCPListener(t TestingT, listenAddr, dstAddr string) *TCPListener

NewTCPListener returns a new TCPListener for proxying connections between listenAddr and dstAddr.

func (*TCPListener) AcceptOne

func (l *TCPListener) AcceptOne() (net.Addr, <-chan Conn)

AcceptOne implements the Listener AcceptOne method.

func (*TCPListener) Close

func (l *TCPListener) Close()

Close implements the Listener Close method.

type TestingT

type TestingT interface {
	Error(args ...interface{})
	Fatal(args ...interface{})
}

TestingT is an interface wrapping golang's built-in *testing.T.

Jump to

Keyboard shortcuts

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