snow: Application Development

Application Development

Snow can be used with most existing applications. However, application developers who can assume the existence of snow can save themselves a lot of trouble dealing with NAT traversal and X.509. Just use the endpoints' key names where you would have used their IP addresses.

Key Discovery

When snow is installed the special name "local.key" will resolve to the snow IP address of the local machine. A reverse lookup on that address will provide the key of the local machine.

When a snow peer initiates a connection to your application you will see its locally assigned IP address. This can be converted back to a key name using reverse name resolution (e.g. gethostbyaddr()/getnameinfo()). However, realize that any network on the internet can set the reverse lookup for their own IP address(es) to any name including a key name. It is important to verify that the key name is correct by doing a forward lookup on the key name (e.g. gethostbyname()/getaddrinfo()) and checking that the address matches.

Address Lifetime

When you resolve a key name an address is assigned to that key. The address remains assigned to the key as long as there is traffic, but never for less time than the TTL on the DNS record and never for less than 5 minutes (and generally for much longer than that). If your application is of the type that makes long-lived connections that see no traffic for long periods of time you have a few reasonable options.

The first is to do what all applications should be doing already, which is to check that the DNS TTL hasn't expired before sending data to a peer, or if it has then resolve the name again to check that the address hasn't changed. Unfortunately some name resolution APIs don't provide easy access to the TTL. A reasonable alternative is to resolve the name again before sending data if no data has been sent for five minutes. Key resolution requests have very little overhead when the peer is already connected. Finally, there is always the caveman solution of sending a keepalive every five minutes.

Licensing

Snow is a program, not a library. This makes it possible to use snow to resolve key names without making your application a derivative work, which means you can distribute your independent application under a different license than the one used for snow.

[snow] [How it works] [How to use it] [How to install it] [Advanced Configuration] [App Development] [Read the FAQ]