Coder Social home page Coder Social logo

procrastiproxy's Introduction

Overview

Go Report Card CircleCI

Procrastiproxy Open-Source reverse proxy

Procrastiproxy is a simple, configurable proxy that helps you focus by blocking distracting websites.

curl https://raw.githubusercontent.com/zackproser/procrastiproxy/main/install.sh | bash

Example: block reddit and twitter during work hours

procrastiproxy --block reddit.com,twitter.com

Procrastiproxy implements an in-memory, mutable list for tracking hosts that should be blocked. This in-memory list allows for fast (O(1) or "constant time") look-ups of blocked hosts.

graph TD
A[User] -->|Itches to browse something distracting| B(GET reddit.com/)
B --> C(Procrastiproxy)
C --> D{Should this request be allowed?}
D -->|It's not working hours| E(Allow Request)
D -->|It's time to work!| F(Access denied!)

Getting started

Install with one command

To install procrastiproxy as a command-line interface (CLI) tool, you can execute the install script:

curl https://raw.githubusercontent.com/zackproser/procrastiproxy/main/install.sh | bash

Install as a library

You can import procrastiproxy into your own project:

import github.com/zackproser/procrastiproxy

Install via Go

You can install and use procrastiproxy as a command line interface (CLI) tool:

go install github.com/zackproser/procrastiproxy

Build from source and run locally

go build -o procrastiproxy ./cmd

./procrastiproxy --port 8001

Features

Configurable and dynamic block list

The block list is kept in-memory and is implemented as a map for fast lookups. You can set your baseline block list in .procrastiproxy.yaml. It can be modified at runtime via the admin control endpoints described below.

Admin control

Make a request to the <server-root>/admin/ path, passing either block or unblock followed by a host, like so:

Add a new host to the block list

curl http://localhost:8001/admin/block/reddit.com

Remove a host from the block list

curl http://localhost:8001/admin/unblock/reddit.com

Office hours

If a request is made to procrastiproxy within the configured office hours, the request will be examined and blocked if its host is on the block list. If a request is made to procrastiproxy outside of the configured office hours, it will be allowed.

Running tests

Procrastiproxy comes complete with tests to verify its functionality.

go test

procrastiproxy's People

Contributors

zackproser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

icodein

procrastiproxy's Issues

Logs

Need to know it started up - otherwise, just when errors occur.

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.