robfig/revel — pull request #508 by pushrax (2014-02-16 01:01:30+00:00)
Title: Support arbitrary network types (fixes unix socket support)

#267 was supposed to introduce unix socket support, however it continued to use `ListenAndServe` which hardcodes the `tcp` transport.

This PR allows specifying the network type in the address string, like `unix:/tmp/some.socket` or `tcp6:::`, and passes it along to the `net.Listen` call. Since the old behaviour was broken in this case, I'm not concerned about backwards compatibility of specifying an address of `/tmp/some.socket`.

Some notes:
- The implementation of `ListenAndServeTLS` is relatively lengthy, and I didn't want to duplicate it in Revel. Since it would be very strange to listen on a unix socket with SSL, I decided to forgo support for it and throw an error if attempted.
- This won't work with `revel run`, only `revel build` as the harness does its own thing when using the `run` command. It may be worth refactoring the behaviour to be shared between the two at some point, but for now it seems reasonable that you'd only need fine-grained control over the transport in production (where you would use `revel build`).

cc @xthexder