askrobots / network-computer
Public
Your phone is the terminal. Stream a Linux/Mac desktop to an iPhone over WebRTC through NAT, with audio and input. Open source, single binaries.
Dan Quellhorst
Firefox policy: no WebRTC mDNS (a page using WebRTC made Firefox listen on UDP 5353)
a1d92f3
1 month, 3 weeks ago
History
dns-park.sh · 1.5 KB · 26 lines
| 1 | #!/bin/sh |
| 2 | # Park the A record <fqdn> at 127.0.0.1 (ttl 60) if it still points at <ip>. |
| 3 | # Run when a computer is destroyed. Two dangers this avoids: |
| 4 | # - a record left pointing at a released IP: DigitalOcean may give that IP to |
| 5 | # someone else, who could then serve (and get a certificate for) the name; |
| 6 | # - deleting the record instead: resolvers cache "no such name" for the zone's |
| 7 | # negative TTL (30 minutes on DigitalOcean), so clients that retried while |
| 8 | # the desk was down could not reach it for up to 30 minutes after "up". |
| 9 | # 127.0.0.1 belongs to nobody else, and a 60 s positive answer is re-checked |
| 10 | # quickly once "up" points the record at the new computer. |
| 11 | # |
| 12 | # infra/dns-park.sh nc.example.com 203.0.113.5 |
| 13 | set -e |
| 14 | FQDN=${1:?usage: dns-park.sh <fqdn> <ip>}; IP=${2:?usage: dns-park.sh <fqdn> <ip>} |
| 15 | ZONE=$(doctl compute domain list --format Domain --no-header | awk -v f="$FQDN" ' |
| 16 | { z=$1; n=length(z) |
| 17 | if (length(f) > n && substr(f, length(f)-n) == "." z && n > best) { best=n; zone=z } } |
| 18 | END { print zone }') |
| 19 | [ -n "$ZONE" ] || { echo "no DigitalOcean DNS zone for $FQDN; update its A record at your provider"; exit 0; } |
| 20 | REC=${FQDN%."$ZONE"} |
| 21 | doctl compute domain records list "$ZONE" --format ID,Type,Name,Data --no-header | |
| 22 | awk -v n="$REC" -v ip="$IP" '$2=="A" && $3==n && $4==ip {print $1}' | |
| 23 | while read -r id; do |
| 24 | doctl compute domain records update "$ZONE" --record-id "$id" --record-data 127.0.0.1 --record-ttl 60 >/dev/null |
| 25 | echo "parked $FQDN at 127.0.0.1 (was $IP)" |
| 26 | done |