Skip to main content

A simple python Wake-on-LAN proxy

Project description

Wake-on-LAN redirect proxy

Brutally simple, single file, Fast API based proxy service. Create a simple path and/or hostname based redirects that send WoL packets if target URL is not reachable. Only works for HTTP(S) redirects.

Great complement for a simple auto-suspend setup, e.g. your home jellyfin server or any other HTTP service.

That's it!

Install

# 1. install script - install wol-proxy into a new virtualenv inside your $HOME
 curl https://raw.githubusercontent.com/xyzjonas/wol-redirect-proxy/main/install.sh | bash
# 2. from PyPi
pip install wol-redirect-proxy
# 3. from source using Poetry
poetry install

...and run

wol-proxy --host "0.0.0.0" --port 12345
wol-proxy --help

Configuration

Specify a list of proxy mappings using a yaml config, e.g.:

#  This will WoL redirect any HTTP request and carry over the path.
#  e.g.: POST: http://my-proxy.home/login -> POST "http://my-jellyfin.home:8096/login"

targets:
- handler: "wol"
  source_url: "http://my-proxy.home/*"
  target_url: "http://my-jellyfin.home:8096"
  methods: [GET, POST, DELETE, PATCH]
  options:
    mac: "75:55:39:a4:33:27"
    timeout_s: 2
#  Multiple redirects to different services by hostname
#  (requires working DNS setup)

targets:
- handler: "plain"
  source_url: "http://jellyfin.home/*"
  target_url: "http://192.168.0.124:8096"
  methods: [GET, POST, DELETE, PATCH]
  
- handler: "plain"
  source_url: "http://nextcloud.home/*"
  target_url: "http://192.168.0.129:8080"
  methods: [GET, POST]
  
- handler: "plain"
  source_url: "http://torrent-box.home/*"
  target_url: "http://192.168.0.135:8080"
  methods: [GET, POST]

Use as a systemd service

# use install script and follow instructions
curl https://raw.githubusercontent.com/xyzjonas/wol-redirect-proxy/main/install.sh | bash
# use the sample systemd unit file
git clone https://github.com/jonasbrauer/wol-redirect-proxy.git && cd wol-redirect-proxy 
sudo cp sample-systemd.unit /etc/systemd/system/wol-redirect-proxy.service  # ...and edit user/group
sudo systemctl daemon-reload
sudo systemctl enable --now wol-redirect-proxy.service
sudo systemctl status wol-redirect-proxy.service

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wol_redirect_proxy-1.0.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

wol_redirect_proxy-1.0.1-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page