Share your scripts

If you have created nice scripts to store and load beacons on some service, please consider sharing then, so I can present them here.

Beacons

Beacons are a way to publish and retrieve addresses of nodes outside of the VpnCloud network in order to find new peers. This can be very helpful in cases where all nodes of the network have dynamic addresses or when the nodes with static addresses are not always reachable.

The main idea behind beacons is that VpnCloud provides means of exporting and importing beacons from files of by executing scripts, and the user is responsible for publishing and retrieving them on other nodes.

The beacons have some useful properties to help users:

  • The beacons are encrypted so only nodes with the same network magic (--magic) and shared key (--shared-key) can read the information in it. This makes it possible to publish beacons without fear of information leaks.
  • Beacons are highly compressed and so short that they can be shared on almost any medium. They are always shorter than 100 characters.
  • The beacons consist only of alphanumeric characters so they can be published on any location that supports text. VpnCloud will ignore any non-alphanumeric characters when searching for beacons, so users can add spaces, line breaks, etc. as they wish.
  • Beacons start and end with a prefix and suffix known by all nodes sharing the same magic and shared key, so they can be detected efficiently even in huge texts.
  • Each beacon contains a timestamp that ensures that outdated beacons are ignored by other nodes.
  • Beacons contain a small checksum to help detect and ignore invalid beacons.

A beacon can look like this example: juWwKjF5qZG7PE5imnpi5XARaXnP3UsMsGBLxM4FNFDzvjlKt1SO55LN. This beacon contains 3 addresses, a timestamp and checksum and is guarded by the prefix juWwK and the suffix O55LN so it can be easily found by other nodes.

Using beacons

VpnCloud supports beacons via the parameters --beacon-store, --beacon-load, and --beacon-interval.

The interval is set in seconds and determines how often VpnCloud will search for beacons and write out its own beacon (if enabled via the other two parameters).

The store and load parameters enable beacon storing/loading and define a filename to store the beacon into or load the beacon from.

Instead of using files, VpnCloud also supports calling commands to store and load beacons. If the argument starts with a pipe character |, the rest of the argument is interpreted as a shell command which is passed to sh. In that command, the following variables can be used:

  • $begin: The prefix of the beacon
  • $end: The suffix of the beacon
  • $data: The inner data part of the beacon (do not use this without the prefix and the suffix)
  • $beacon: The full beacon with prefix and suffix. The variables $data and $beacon can only be used when storing a beacon, not when searching for one during load.