GithubHelp home page GithubHelp logo

faik / cascade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azak-azkaran/cascade

0.0 0.0 0.0 322 KB

golang proxy which can switch between Direct mode and Cascade mode

License: BSD 3-Clause "New" or "Revised" License

Go 98.00% Makefile 2.00%

cascade's Introduction

cascade

Build Status Travis Status Quality Gate Status Coverage Coverage Status

Go proxy which can switch between Direct mode and Cascade mode Switch is done according to health check.

Installation

Just download the current release For running as daemon checkout the section in this readme

Install from source

checkout the source code and run

make install

Configuration

Configuration can be done by file or command line arguments

  • password : Password for authentication to a forward proxy
  • host : Address of a forward proxy
  • user : Username for authentication to a forward proxy
  • port : Port on which to run the proxy
  • health : Address which is used for health check if available go to direct mode (default: https://www.google.de )
  • health-time : Duration between health checks (default: 30 Seconds )
  • host-list : Comma Separated List of Host for which Proxy Redirect is used in Cascade Mode
  • config : Path to configuration yaml file. If set all other command line parameters will be ignored
  • version: Just shows the current version
  • vault-addr: address to the hashi corp vault
  • vault-token: token for the hashi corp vault

Health Check

A temporary client tries to connect to a certain address regularly. The Cascade mode is active if health check fails.

Direct Mode

Normal http internet Proxy Mode.

Cascade Mode

Cascade Mode means that this proxy stands between the client and another Proxy. Basic Authentication can be enabled for Cascade Mode

Proxy redirect for Hosts

If in cascade mode, different Proxy redirects can be added by adding a Comma seperated list. These redirects changes HTTPS and HTTP Request according to the setup rules. The Requests can be send to another Proxy or directly.

Direct Configuration:

  • DIRECT Connection: eclipse
  • DIRECT Connection: azure->
  • REDIRECT Connection to other Proxy: google->test:8888

HashiCorp Vault Configuration

Cascade can also get the configuration from a HashiCorp Vault. The secret store has to be version 2 and a vault configuration will overwrite a file configuration. The following secrets have to be saved in store:

  • username
  • password
  • host

The following secrets are optional:

  • port (default: 8888)
  • host-list (default: "")
  • health (default: www.google.de)
  • log (default: WARNING)
  • health-time (default: 5s)
  • disableAutoChangeMode (default: false)

REST Interface

Cascade comes with a REST Interface which can be used to control the application. Currently the following REST Endpoints are available:

  • /config : is used to return the current configuration
  • /getOnlineCheck : is used to get if the check is used to check for up
  • /getAutoMode : is used to get if automatically switching between modes is activated
  • /addRedirect : adds another redirect rule
  • /setOnlineCheck : used to configure check is used to check for a website being online
  • /setAutoMode : used to disable automatically switching between modes
  • /setCascadeMode : used to force a certain mode

Curl Examples

These examples use curl to use the REST Endpoints

Config

To get the current configuration

curl -D- localhost/config

SetCascadeMode

To set the Mode by hand to DirectMode:

curl -D- --request POST \
  --data '{"cascadeMode":false}' \
  localhost/setCascadeMode

To set the Mode by hand to Cascade mode:

curl -D- --request POST \
  --data '{"cascadeMode":true}' \ 
  localhost/setCascadeMode

SetAutoMode

To disable the automatically switch between modes:

curl -D- --request POST \
  --data '{"autoChangeMode":false}' \
  localhost/setAutoMode

To enable the automatically switch between modes:

curl -D- --request POST \
  --data '{"autoChangeMode":true}' \
  localhost/setAutoMode

will overwrite the setting from file,vault or command line

Systemd

If you want to use the provided service configuration, the program has to be moved to

/usr/local/bin

The configuration has to be moved to the following folder for Ubuntu:

/etc/systemd/system/

Afterwards, systemd has to be restarted as follows:

systemctl daemon-reload
systemctl start cascade

The logs can be viewed by using:

journalctl -f -u cascade

cascade's People

Contributors

azak-azkaran avatar

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.