hookah

package module
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

hookah

A Swiss Army knife for data pipelines.

GoDoc

Download options

Build instructions

go get
go get github.com/wybiral/hookah/cmd/hookah
go build
go build github.com/wybiral/hookah/cmd/hookah

Usage instructions (CLI)

The hookah command allows you to pipe data between various sources/destinations. By default pipes are full duplex but can be limited to input/output-only mode.

For details run hookah -h

Examples

Pipe from stdin/stdout to a new TCP listener on port 8080:

hookah stdio tcp-listen://localhost:8080

Note: this is the same even if you ommit the stdio part because hookah will assume stdio is indended when only one node (tcp-listen in this case) is used.

Pipe from a TCP client on port 8080 to a new WebSocket listener on port 8081:

hookah tcp://localhost:8080 ws-listen://localhost:8081

Pipe from a new Unix domain socket listener to a TCP client on port 8080:

hookah unix-listen://path/to/sock tcp://localhost:8080

Pipe only the input from a TCP client to the output of another TCP client:

hookah -i tcp://:8080 -o tcp://:8081

Fan-out the input from a TCP listener to the output of multiple TCP clients:

hookah -i tcp-listen://:8080 -o tcp://:8081 -o tcp://:8082 -o tcp://:8083

Usage instructions (Go package)

See godoc page.

Documentation

Overview

Package hookah provides input/output stream constructors.

Index

Constants

View Source
const Version = "2.2.0"

Version of hookah API.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v1.0.0

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

API is an instance of the Hookah API.

func New added in v1.0.0

func New() *API

New returns a Hookah API instance with default handlers.

func (*API) ListProtocols

func (a *API) ListProtocols() []Protocol

ListProtocols returns all registered protocols.

func (*API) NewNode

func (a *API) NewNode(op string) (*node.Node, error)

NewNode parses an option string and returns a new Node.

func (*API) RegisterProtocol

func (a *API) RegisterProtocol(proto, usage string, h Handler)

RegisterProtocol registers a new protocol handler.

type Handler

type Handler func(arg string) (*node.Node, error)

Handler is a function that returns a new Node.

type Protocol

type Protocol struct {
	Handler Handler
	Proto   string
	Usage   string
}

Protocol represents a registered protocol handler.

Directories

Path Synopsis
cmd
hookah
Package main implements the main hookah CLI tool.
Package main implements the main hookah CLI tool.
examples
certstream
Example of using hookah to create an input node from the CertStream WebSocket API (https://certstream.calidog.io/).
Example of using hookah to create an input node from the CertStream WebSocket API (https://certstream.calidog.io/).
customproto
Example of using hookah with a custom protocol.
Example of using hookah with a custom protocol.
internal
app
Package app implements main hookah application Node manager.
Package app implements main hookah application Node manager.
protocols
Package protocols implements all builtin hookah protocols.
Package protocols implements all builtin hookah protocols.
pkg
fanout
Package fanout implements a fanout type that makes it easy to build publish-subcribe patterns using []byte channels.
Package fanout implements a fanout type that makes it easy to build publish-subcribe patterns using []byte channels.
flagslice
Package flagslice implements a variable argument string type for CLI flags.
Package flagslice implements a variable argument string type for CLI flags.
node
Package node implements Node type.
Package node implements Node type.

Jump to

Keyboard shortcuts

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