Documentation ¶
Overview ¶
Nox is a tool for making nox connections.
$ nox usage: nox { init | privkey | pubkey | genkeys | listen | dial | remotestatic}
In the example below, we will create ".nox" directories with "nox init". Then start a server with "nox listen" and make a connection with "nox dial".
Init ¶
Make two directories, one for the client and one for the server, and run "nox init":
$ cd client client$ nox init init: created .nox/private_key init: created .nox/known_hosts $ cd server server$ nox init init: created .nox/private_key init: created .nox/known_hosts
Pubkey ¶
We need to configure the server to accept the public key of the client. Add a line to the server's ".nox/known_hosts" file. It requires three space-separated fields: "nox0" (protocol version), "*" (any network address), public key:
client$ nox pubkey < .nox/private_key byX6M3L2qCU4yAFotRhI1dKOffrU7drs4W7-iIY-1Qc server$ echo 'nox0 * byX6M3L2qCU4yAFotRhI1dKOffrU7drs4W7-iIY-1Qc' >>.nox/known_hosts
Listen ¶
Start a server that just echoes back everything it reads:
server$ nox listen localhost:1047 cat listen: listening on localhost:1047, local static public key dveY0PXJfUQn84FOdV3MCCCRz6Na7SccQH_Shcj-Qg4
Because of the default nox address policy "+fs+known", the server found ".nox/private_key". For incoming connections it will check the ".nox/known_hosts".
Dial ¶
Connect to the server:
client$ nox dial localhost:1047+fs+tofu dial: connected to localhost:1047, static public key local byX6M3L2qCU4yAFotRhI1dKOffrU7drs4W7-iIY-1Qc, remote dveY0PXJfUQn84FOdV3MCCCRz6Na7SccQH_Shcj-Qg4
Now type anything and you'll see it echoed back to you by the server.
The connection from client to server succeeded because of the "tofu" directive: Trust on first use. The client added the public key to its ".nox/known_hosts" file and will be verified in later connections:
client$ cat .nox/known_hosts nox0 localhost:1047 dveY0PXJfUQn84FOdV3MCCCRz6Na7SccQH_Shcj-Qg4
Remotestatic ¶
To find the remote static public key, you can perform a handshake, learn the remote key and close the connection. Remotestatic does this and prints it in a form suitable for adding to a "known_hosts" file:
$ nox remotestatic localhost:1047 nox0 localhost:1047 dveY0PXJfUQn84FOdV3MCCCRz6Na7SccQH_Shcj-Qg4
Privkey ¶
Command privkey prints a new private key to stdout.
$ nox privkey gIJoUNK0wVl1ASAZstVR2KAoIREkLduv29TMW0X_HGU
Genkeys ¶
Command genkeys prints a keypair and example nox addresses. These can be used to quickly set up a nox connection without the use for a ".nox" directory:
$ nox genkeys [...] local to remote: localhost:1047+sF8XgswdnBscEhCL24m3dgiQw7HEH0ezt_tq3jbKOr4+YNrfnE9BMY0jZEq-KI8p-CkGlI0nQ-Q9I8Uf7-kRjw4 remote to local: localhost:1047+Pv1yEwpRnbwNc9O-CCPseDN96Fb7DSKllpBs0DyhDxU+Q3gfkda4WVqhDAD7ypqLHVVknJSFxIUHAfIJBchFfi8
Start the listener:
$ nox listen localhost:1047+sF8XgswdnBscEhCL24m3dgiQw7HEH0ezt_tq3jbKOr4+YNrfnE9BMY0jZEq-KI8p-CkGlI0nQ-Q9I8Uf7-kRjw4 cat listen: listening on localhost:1047, local static public key Q3gfkda4WVqhDAD7ypqLHVVknJSFxIUHAfIJBchFfi8
And connect:
$ nox dial localhost:1047+Pv1yEwpRnbwNc9O-CCPseDN96Fb7DSKllpBs0DyhDxU+Q3gfkda4WVqhDAD7ypqLHVVknJSFxIUHAfIJBchFfi8 dial: connected to localhost:1047, static public key local YNrfnE9BMY0jZEq-KI8p-CkGlI0nQ-Q9I8Uf7-kRjw4, remote Q3gfkda4WVqhDAD7ypqLHVVknJSFxIUHAfIJBchFfi8