TLS Support

This PR adds support for connecting to Docker servers using TLS. It adds the following flags to `docker-gen`:

* `-tlscacert file`
* `-tlscert file`
* `-tlskey file`
* `-tlsverify`

These flags correspond to the same flags on the `docker` client.

This PR also switches the handling of the event monitoring stream to use the support for event listeners built into `go-dockerclient`.

I did not yet add handling for the `DOCKER_TLS_VERIFY` or `DOCKER_CERT_PATH` environment variables, since I feel like the whole thing is a bit of a mess. In particular, it's not 100% clear which combination of environment variables should do what (e.g. how should you say that you want to ignore certificates on both ends but still connect with TLS? or when should a tool look for `~/.docker/cert.pem`, etc.).

It's pretty trivial to add this support before merging, but I want to move the discussion forward with some code.

Closes #31.
Yeah. I saw that after we last discussed this PR, but I haven't had the
time to update it yet. Would you like me to close this PR until it's ready
to merge?
On Dec 1, 2014 10:25 PM, "Jason Wilder" <notifications@github.com> wrote:

> In docker-gen.go:
>
> > @@ -225,8 +229,17 @@ func generateFromEvents(client *docker.Client, configs ConfigFile) {
> >
> >  	wg.Add(1)
> >  	defer wg.Done()
> > +
> > +	eventChan := make(chan *docker.APIEvents, 100)
> > +	defer close(eventChan)
> > +
> > +	err := client.AddEventListener((chan<- *docker.APIEvents)(eventChan))
>
> If running w/ -watch and the docker daemon is stopped, L246-247 triggers
> an infinite loop. I think if event == nil, the client and listener need
> to be cleaned up and re-initialized. The previous code had time.Sleep(10
> * time.Second) to prevent hammering the docker daemon and newConn
> established a new client.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jwilder/docker-gen/pull/33/files#r21142018>.
>