Skip to content

Instantly share code, notes, and snippets.

Avatar

Travis LaDuke laduke

  • zerotier
  • California
View GitHub Profile
@laduke
laduke / network-via-fs.md
Last active Dec 17, 2020
zerotier network join via fs
View network-via-fs.md

Typically, you use zerotier-cli to join and leave networks, but you can also write files to the filesystem to do this.

The networks.d subdirectory of the ZeroTier working directory keeps track of which networks are joined and their settings.

The ZeroTier working directory can be found...

  • On Windows: \ProgramData\ZeroTier\One
  • On Mac: /Library/Application Support/ZeroTier/One
  • On Linux: /var/lib/zerotier-one
@laduke
laduke / zerotier-cli-completion.bash
Created Jul 7, 2020
bash completion for zerotier-cli
View zerotier-cli-completion.bash
#compdef zerotier-cli
#autoload
_get_network_ids ()
{
if [[ "$OSTYPE" == "darwin"* ]]; then
COMPREPLY=($(compgen -W "$(ls -1 /Library/Application\ Support/ZeroTier/One/networks.d | cut -c 1-16)" -- ${cur}))
else
COMPREPLY=($(compgen -W "$(ls -1 /var/lib/zerotier-one/networks.d | cut -c 1-16)" -- ${cur}))
View machine.js
const myMachine = Machine({
type: 'parallel',
context: {},
states: {
hi: {
initial: 'no',
states: {
yes: {},
no: { on: { CLICK_ME: 'yes' } }
@laduke
laduke / zerotier-troubleshoot.md
Last active Dec 17, 2020
zerotier-troubleshoot.sh
View zerotier-troubleshoot.md

Collect information helpful for troubleshooting zerotier-one

Run this on Mac or Linux

It will create a text file in the current directory. It won't modify anything.

Make sure you are root

   (set -x; \
 zerotier-cli info -j; \
View heh.js
function h(tag, as, xs) {
var attrs = Object.entries(as).map(([k, v]) => ` ${k}="${v}"`);
return `<${tag}${attrs}>${xs.join("")}</${tag}>`;
}
console.log(
h("div", { id: "foo" }, [
h("p", { class: "big" }, ["hi", h("p", {}, ["3"])]),
h("p", {}, ["bye"])
View controller.org

Set up a controller with curl

1 Find your auth token

the authtoken.secret file

  • On Mac this is in “/Library/Application Support/ZeroTier/One”. also, the installer copies it to ~/Library/Application\ Support/ZeroTier/One
  • Windows this is usually in “\ProgramData\ZeroTier\One”. also, the installer copies it somewhere local to the installing user… I forget
  • On Linux this is usually in “/var/lib/zerotier-one”.
@laduke
laduke / ztv6.md
Last active Jun 30, 2021
ZeroTier 6PLANE and RFC4193 address calculation
View ztv6.md

ZeroTier IPv6 Auto-Assign Addresses

https://www.zerotier.com/manual.shtml#2_2_3

  • A network ID is 16 hex digits (9bee8941b5de0691)
  • A node ID is 10 hex digits (1234512345)

ZeroTier RFC4193 (/128 for each device)

  • fd9b:ee89:41b5:de06:9199:9312:3451:2345

ZeroTier 6PLANE (/80 routable for each device)

View zeroter-controller.md

Find your auth token

the authtoken.secret file

  • On Mac this is in "/Library/Application Support/ZeroTier/One". also, the installer copies it to ~/Library/Application
    Support/ZeroTier/One
  • Windows this is usually in "\ProgramData\ZeroTier\One". also, the installer copies it somewhere local to the installing user... I
@laduke
laduke / html-index.js
Created Jul 10, 2018
simple html index
View html-index.js
var http = require('http')
var { html, title, head, body, div } = require('hyperaxe')
var page = html(
head(title('hi')),
body(
div({ id: 'app' })
)
).outerHTML