https://github.com/zackproser/procrastiproxy
A simple configurable proxy that blocks distracting hosts
https://github.com/zackproser/procrastiproxy
distraction-blocker focus golang productivity proxy
Last synced: 6 months ago
JSON representation
A simple configurable proxy that blocks distracting hosts
- Host: GitHub
- URL: https://github.com/zackproser/procrastiproxy
- Owner: zackproser
- License: apache-2.0
- Created: 2022-01-24T02:31:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-05T13:08:31.000Z (over 3 years ago)
- Last Synced: 2025-03-25T22:35:12.084Z (6 months ago)
- Topics: distraction-blocker, focus, golang, productivity, proxy
- Language: Go
- Homepage:
- Size: 6.17 MB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
[](https://goreportcard.com/report/github.com/zackproser/procrastiproxy)
[](https://circleci.com/gh/zackproser/procrastiproxy)
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.
```mermaid
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:
```golang
import github.com/zackproser/procrastiproxy
```**Install via Go**
You can install and use procrastiproxy as a command line interface (CLI) tool:
```bash
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 `/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`