go-proxy

command module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2015 License: MIT Imports: 9 Imported by: 0

README

go-proxy

license GoDoc Build Status

A simple proxy implementation for the modern day

This project aims to produce a programmable proxy to facilitate Ambassador pattern. Find out more about Ambassador in micro service deployment

go-proxy strives to achieve the following goals

  • To be not complicated
  • Code is the docuementation
  • Exist as a standalone program and a library for proxy
  • Interface with discovery backend
  • Tunnel your data with TLS connection.
  • Be as lean as possible
Import go-proxy as library

go get github.com/jeffjen/go-proxy/proxy

Running go-proxy as a standalone program
  • Running with static candidates:

    go-proxy --src :16379 --dst 10.0.3.144:6379
    
  • Running with discovery backend:

    go-proxy --src :16379 --srv /srv/redis/debug \
        --dsc http://etcd0:2379 \
        --dsc http://etcd1:2379
    
  • Add TLS encryption to your connection

    go-proxy tls-client --src :16379 --dst 10.0.3.144:6379 \
        --tlscertpath s3://devops.example.org/client-cert
    
    go-proxy tls-client --src :16379 --dst 10.0.3.144:6379 \
        --tlscertpath /path/to/client-cert
    
  • Setting up TLS proxy server

    go-proxy tls-server --src :6379 --dst 10.0.3.144:6379 \
        --tlscertpath s3://devops.example.org/server-cert
    
    go-proxy tls-server --src :6379 --dst 10.0.3.144:6379 \
        --tlscertpath /path/to/server-cert
    
Behavior

The proxy module does not attempt to perform reconnection to remote endpoint.

The discovery backend chosen is etcd https://github.com/coreos/etcd

Layout for the discovery backend should look like the following:

/srv/redis/debug
/srv/redis/debug/10.0.1.134:6379
/srv/redis/debug/10.0.2.15:6379
/srv/redis/debug/10.0.3.41:6379

When nodes' state in service /srv/redis/debug changes e.g. leaving or joining, the proxy will attempt to obtain a new set of nodes, followed by a reset on established connections.

Proxy behaviors can be divided into two modes: ordered, or round-robin.

In ordered mode:

  • the first remote host is attempted
  • then second
  • until all were tried, the proxy declare connection failed.

In round-robin node

  • connections are spread among available candidates.
  • no ordered retry
Documentaion

GoDoc available: https://godoc.org/github.com/jeffjen/go-proxy

Documentation

Overview

Transport level proxy for the mondern day.

The root package is provided as a standalone proxy app for verifying implementation detail.

This project aims to produce a programmable proxy to facilitate Ambassador pattern: https://docs.docker.com/engine/articles/ambassador_pattern_linking/

A full implementation for a configurable Ambassador daemon ambd https://github.com/jeffjen/ambd

Usage: go-proxy [OPTIONS]

The TCP proxy with discovery service support

Options:
		--net "tcp4"                            Network type
		--src [--src option --src option]       Origin address to listen
		--dst [--dst option --dst option]       Target to proxy to
		--dsc [--dsc option --dsc option]       Discovery service endpoint
		--srv                                   Service identity in discovery
		--lb                                    Weather we do load balance
		--loglevel "INFO"                       Set debug level [$LOG_LEVEL]
		--help, -h                              show help
		--version, -v                           print the version

Commands:
		tls-client       Setup client encrypt mode
		tls-server       Setup server encrypt mode
		help             Shows a list of commands or help for one command

Running with static candidates:

go-proxy --src :16379 --dst 10.0.3.144:6379

Running with static candidates and round robin balance:

go-proxy --src :16379 --lb \
	--dst 10.0.0.12:6379 --dst 10.0.1.123:6379

Running with discovery backend:

go-proxy --dsc http://etcd0:2379 --dsc http://etcd1:2379 \
    --src :16379 \
    --srv /srv/redis/debug

Running in cluster mode:

go-proxy --src :16379 --src :16378 \
	--dst 10.0.0.12:6379 --dst 10.0.1.123:6379

Add TLS encryption to your connection

go-proxy tls-client --src :16379 --dst 10.0.3.144:6379 \
    --tlscertpath s3://devops.example.org/client-cert

go-proxy tls-client --src :16379 --dst 10.0.3.144:6379 \
    --tlscertpath /path/to/client-cert

Setting up TLS proxy server

go-proxy tls-server --src :6379 --dst 10.0.3.144:6379 \
    --tlscertpath s3://devops.example.org/server-cert

go-proxy tls-server --src :6379 --dst 10.0.3.144:6379 \
    --tlscertpath /path/to/server-cert

Directories

Path Synopsis
Package proxy provides an intuitive transport level proxy.
Package proxy provides an intuitive transport level proxy.

Jump to

Keyboard shortcuts

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