Inferno Is Cool
Table of Contents
The Inferno operating system works according to those three principles, herited from Plan 9:
- Every resource is a file (e.g. the network, the screen, the mouse).
- Each process gets its own view of the filesystem (this is called a namespace).
- One can import and export any part of the filesystem, using a protocol called 9P, locally or remotely.
It is hard for beginners to understand how powerful this set of abstraction is. Here is a collected list of small examples that hopefully drives the point home, and will help make the awesomeness of Inferno click for you.
1. VPN
First, let's write a little script that queries ifconfig.io for our IP address:
#!/dis/sh dial -A tcp!ifconfig.io!80 { echo GET / HTTP/1.1 echo Host: ifconfig.io echo User-Agent: curl echo Connection: close echo echo grep '^[0-9].*' >[1=2]}
Let's save that under my-ip and run chmod +x
on it.
On the server, run:
my-ip # Prints, e.g. 51.178.183.202 listen -v 'tcp!*!styx' {export /net&}
Now, on the client, run
my-ip # Prints, e.g. 90.25.138.172 mount -c 'tcp!51.178.183.202!styx' /n/51.178.183.202 bind -c /n/51.178.183.202 /net my-ip # Now prints 51.178.183.202
From now on any connection from the client will be sent, encrypted, to the server. From the point of view of the final endpoint, the connection will appear to come from the server instead of the client. This is a VPN. In 1 line of server code, and 2 lines of client code.
For comparison, WireGuard is more than 100.000 lines of kernel code.
I'll add more examples later.