Sign inSign up

jeffjen/go-proxy

By jeffjen

•Updated over 10 years ago

A simple proxy implementation

Image
0

2.6K

jeffjen/go-proxy repository overview

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
  • 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 --dsc http://etcd0:2379 --dsc http://etcd1:2379 \
        --src :16379 \
        --srv /srv/redis/debug
    
  • Adding TLS encryption to your connection

    go-proxy tls-client \
        --tlscacert ca.pem --tlskey key.pem --tlscert cert.pem \
        --src :16379 --dst 10.0.3.144:6379
    
  • Setting up TLS proxy server

    go-proxy tls-server \
        --tlscacert ca.pem --tlskey key.pem --tlscert cert.pem \
        --src :6379 --dst 10.0.3.144:6379
    
⁠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⁠

Tag summary

Content type

Image

Digest

sha256:f7f8085bb…

Size

4.3 MB

Last updated

over 10 years ago

docker pull jeffjen/go-proxy