Simple HTTP reverse proxy to encrypt JSON payloads in transit
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pkg
main.go
readme.md

readme.md


🔒http-encryption-proxy

Simple HTTP reverse proxy
to encrypt JSON payloads in transit



Getting Started

Installation

go get -u github.com/ume/http-encryption-proxy

Usage

CLI

Enter installation directory (cd $GOPATH/src/github.com/ume/http-encryption-proxy) and run:

go run main.go -debug

API

package main

import (
	"flag"
	"log"
	"net/http"
	"net/url"

	"github.com/ume/http-encryption-proxy/pkg/proxy"
)

var port = flag.String("port", "4800", "bind address")
var debug = flag.Bool("debug", false, "debug mode")

func main() {
	flag.Parse()

	var apiURL *url.URL
	var err error

	if apiURL, err = url.Parse("https://api.thirdparty.com"); err != nil {
		log.Fatal(err)
	}

	handler := proxy.NewEncryptionProxy([]*proxy.Target{
		&proxy.Target{Destination: apiURL, EncryptJSON: true},
	})

	if *debug {
		log.Printf("serving proxy at port %v\n", *port)
	}

	log.Fatal(http.ListenAndServe(":"+*port, handler))
}