Modularize proxy.

Convert the `proxy.js` program into a module. It still runs as a program
when invoked as a program, but it now exports its logic as a function.

Closes #21.
Tidy `proxy.js`.

Wrapped long lines. Removed useless return statements.
Merge branch `proxy` into `master`.