Giter VIP home page Giter VIP logo

destructive_socks5_proxy's Introduction

##Destructive Proxy

Utilizes the Socks5 proxy protocol to proxy all socket traffic.

In addition to providing proxy functionality, the destructive proxy is able to inject latency around network calls and shutdown connections by hostname.

How Build From Source

  • Install latest GO version (https://golang.org/dl).
    • The following steps assume GO is installed to /usr/local/go (refer to GO_HOME below)
  • edit .bash_profile and add these lines:
export GOPATH=~/GOWorkspace
export GO_HOME=/usr/local/go 
export PATH=$PATH:$GO_HOME/bin:$GOPATH/bin
  • Run these commands:
go get github.com/intuit/destructive_socks5_proxy
go get -u golang.org/x/net/proxy
go get github.com/Unknwon/macaron
cd ~/GOWorkspace/src/github.com/intuit/destructive_socks5_proxy
./test_with_coverage.sh
  • Expected output:
....
PASS
coverage: 93.6% of statements
ok      github.com/intuit/destructive_socks5_proxy  
  • Now run these commands:
   cd destructive_socks5_proxy
   ./build.sh
   ls *
  • Expected output:
.... 
destructive_socks5_proxy_darwin_amd64
destructive_socks5_proxy_linux_amd64
destructive_socks5_proxy_windows_amd64.exe

Usage

Default
$PORT=4000 ./destructive_socks5_proxy

##### Commandline Options

Linux

$ ./destructive_socks5_proxy_linux_amd64 -help
Usage of ./destructive_socks5_proxy:
  -addr="0.0.0.0:9000": address to listen on
  -blacklist="": csv list of hosts to blacklist
  -config="todo": optional json config file of host:latency:type
  -whitelist="": csv list of hosts to whitelist.

Mac

$ ./destructive_socks5_proxy_darwin_amd64 -help
Usage of ./destructive_socks5_proxy:
  -addr="0.0.0.0:9000": address to listen on
  -blacklist="": csv list of hosts to blacklist
  -config="todo": optional json config file of host:latency:type
  -whitelist="": csv list of hosts to whitelist.

Note that the included binaries are located in the destructive_socks5_proxy subdirectory.

Java Parameters

# For example:
java  -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9000 ...

API

/set_latency/:host/per_remote_write?latency=100ms[&count=1]
  • Set the per_remote_write latency for the :host parameter
    • Adds latency for every network write to the remote host. One connection can make many network writes, even for a single request.
    • Optionally, specify a count value to limit the number of times the latency value is applied. For instance, count=1 means the only 1 remote write will have the latency added. Note that count < 0, indicates means to continue to add latency to all remote writes until latency is explicitly removed. This is the default behavior.
  • The latency parameter parses a duration string (e.g., 60000ms, 60s, 1m).
/set_latency/:host/per_remote_read?latency=100ms[&count=1]
  • Set the per_remote_read latency for the :host parameter
    • Adds latency for every network read from the remote host. One connection can make many network reads, even for a single request.
    • Optionally, specify a count value to limit the number of times the latency value is applied. For instance, count=1 means the only 1 remote read will have the latency added. Note that count < 0, indicates means to continue to add latency to all remote reads until latency is explicitly removed. This is the default behavior.
  • The latency parameter parses a duration string (e.g., 60000ms, 60s, 1m).
/set_latency/:host/per_remote_connect?latency=100ms[&count=1]
  • Set the per_remote_connect latency for the :host parameter

    • Adds latency for each network connect to the remote host. Does not work very well for long lived connections (e.g., JMS, JDBC)
    • Optionally, specify a count value to limit the number of times the latency value is applied. For instance, count=1 means the only 1 remote write will have the latency added. Note that count < 0, indicates means to continue to add latency to all remote writes until latency is explicitly removed. This is the default behavior.
  • The latency parameter parses a duration string (e.g., 60000ms, 60s, 1m).

/get_latancy/:host/per_remote_write
  • Lists hostname and latency for the :host parameter if latency has been set with per_remote_write parameter
/get_latancy/:host/per_remote_connect
  • Lists hostname and latency for the :host parameter if latency has been set with per_remote_connect parameter
/get_latancy/all/per_remote_write
  • Lists hostname and latency for all hosts that have had latency set using the per_remote_write parameter
/get_latancy/all/per_remote_connect
  • Lists hostname and latency for all hosts that have had latency set using the per_remote_connect parameter
/counters
  • Lists counts and metrics on which hosts have been seen, bytes, total latency, etc
/counters/reset
  • Resets counters
/dependencies
  • Lists dependencies
/whitelist/:host/:add_or_remove
  • Add or remote a host to the whitelist.
    • Requires the server to be started with the -whitelist option.
    • Note: blacklist and whitelist can't be used at the same time.
/whitelisted
  • Lists hosts that have been added to the whitelist
/blacklist/:host/:add_or_remove
  • Add or remote a host to the blacklist.
    • Requires the server to be started with the -blacklist option.
    • Note: blacklist and whitelist can't be used at the same time.
/blacklisted
  • Lists hosts that have been added to the whitelist

destructive_socks5_proxy's People

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.