Coder Social home page Coder Social logo

camouflage's Introduction

camouflage

An HTTP proxy package for intercepting, modifying traffic and forwarding it via a reverse proxy server (like HAproxy).

This package is extended upon elazarl's goproxy. Full functionality of it can be access through GoProxy variable, But ctx.UserData must not be altered.

package main

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

	"github.com/elazarl/goproxy"
	"github.com/rahulwa/camouflage/proxy"
)

func init() {
	rProxyServer, err := url.Parse("http://127.0.0.1:8081")
	if err != nil {
		log.Fatal("main: init: unable to parse reverseproxyadress")
	}
	proxy.Conf = &proxy.Config{
		RedisControllerChannel: "proxiesChannel",
		ReverseProxyServer:     *rProxyServer,
		ProxyPort:              8080,
		MetricPort:             9099,
		Verbose:                false,
		DumpInWireFormat:       false,
	}
	flag.Parse()
}

func main() {
  // This line will add X-GoProxy: yxorPoG-X header to all requests sent through the proxy. 
  proxy.GoProxy.OnRequest().DoFunc(
    func(r *http.Request,ctx *goproxy.ProxyCtx)(*http.Request,*http.Response) {
        r.Header.Set("X-GoProxy","yxorPoG-X")
        return r,nil
  })
  // Start the proxy server 
  proxy.Proxy(nil, nil)
}

For more example, see examples directory and documentation.

Features

  • supports regular HTTP proxy, HTTPS through CONNECT, and "hijacking" HTTPS connection using "Man in the Middle" style attack (thanks to goproxy).
  • requests and responses are fully customizable (thanks to goproxy).
  • send a tracking uuid with X-Camouflage-Context header on response.
  • proxy chaining with the help of any reverse proxy.
  • save/send requests and responses to nearly anywhere with the help of fluentd.
  • metrics exposures via prometheus-client.
  • publishes json on the configured redis Channel - containing the destination site, reverse-proxy-server and status-code for each bad response happens from destination-site with the status code between 400 to 599 for real-time analysis or action.

camouflage's People

Contributors

rahulwa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

camouflage's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.