Vegz78 / ToggleZeroTier

A script to automatically toggle a ZeroTier connection for LAN-over-internet gaming and game streaming, and add it to the routing table for LAN games autodiscovery, from the RetroPie/Emulationstation game menu or from a Linux command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ToggleZeroTier

A script to automatically toggle a ZeroTier LAN-over-internet connection and add it to the routing table directly from a games folder that executes .sh-scripts inside RetroPie/Emulationstation, or from a Linux command line. For LAN gaming OR game streaming remotely over internet, and supports LAN games with broadcast peer games autodiscovery.

An example of use together with RetroPie Netplay can be found in this article. alt text

Added a new 3 step logic instead of the old 2 all-on/all-off, so that one easily can restore ZT broadcast after reboot:
STATE => ACTION

  1. ZT off => Toggle to 2
  2. ZT on & BC off => Toggle to 3
  3. ZT on & BC on => Toggle to 1
    (ZT=ZeroTier, BC=broadcast)

This is a REALLY quick and ugly modifcation of ../gsomoza/ztvpn.sh on GitHub, to allow for execution directly from RetroPie, and adding and removing the ZeroTier network from the routing table, so that ZeroTier peers are discovered automatically by some LAN games. Basically a raw copy with some added sudo and ip route commands...

The script does what it's supposed to on my home system and won't be very actively supported, updated or maintained.

For similar, but a little more complicated, solutions on Windows, see the ZeroTier Knowledgebase

Prerequisites

Features

  • Automatically toggle(connect&disconnect) a ZeroTier connection
  • Add the ZeroTier connection to the routing table, so that certain LAN games that use broadcast network discovery can find the other hosts connected to the ZT-network
  • Can be run directly from the RetroPie games list menus or from the command line.

Setup

1 - Download and copy the script into one of your RetroPie roms folder, typically "/home/pi/RetroPie/roms/..". Make sure it's executable.
Alternatively, in same folder, run:
git clone https://github.com/Vegz78/ToggleZeroTier && sudo chmod +x ./ToggleZeroTier/_ToggleZeroTier.sh

2 - Edit _ToggleZeroTier.sh with the desired global variables correct for your setup(ZeroTier Network ID & Device ID.)

3 - Start RetroPie and navigate to the chosen games list menu.

4 - Run the _ToggleZeroTier entry.

For more detailed setup and usage instructions, check out this article.

Example of sh script games menu in Emulationstation

Edit the file /etc/emulationstation/es_systems.cfg as inspired by TechWizTime.

Add something like this:

  <system>
    <name>Steam</name>
    <fullname>Steam</fullname>
    <path>/home/pi/RetroPie/roms/moonlight</path>
    <extension>.sh .SH</extension>
    <command>%ROM%</command>
    <platform>steam</platform>
    <theme>steam</theme>
  </system>

Images

alt text alt text alt text

About

A script to automatically toggle a ZeroTier connection for LAN-over-internet gaming and game streaming, and add it to the routing table for LAN games autodiscovery, from the RetroPie/Emulationstation game menu or from a Linux command line


Languages

Language:Shell 100.0%