Add TLS support

Awesome!!

On Friday, November 7, 2014, oxtoacart <notifications@github.com> wrote:

> In server.go:
>
> > +		return listenTLS(addr, pkfile, certfile)
> > +	} else {
> > +		return net.Listen("tcp", addr)
> > +	}
> > +}
> > +
> > +func listenTLS(addr string, pkfile string, certfile string) (net.Listener, error) {
> > +	cert, err := tls.LoadX509KeyPair(certfile, pkfile)
> > +	if err != nil {
> > +		return nil, fmt.Errorf("Unable to load cert and pk: %s", err)
> > +	}
> > +
> > +	cfg := tlsdefaults.Server()
> > +	cfg.MinVersion = tls.VersionTLS12 // force newest available version of TLS
> > +	cfg.Certificates = []tls.Certificate{cert}
> > +	return tls.Listen("tcp", addr, cfg)
>
> @myleshorton <https://github.com/myleshorton> I added a new project
> getlantern/tlsdefaults <https://github.com/getlantern/tlsdefaults> that
> provides sensible defaults and I'm now using that here. One of the defaults
> is to specify a minimum TLS version of 1.0, but as you pointed out we
> control both sides here, so I'm forcing TLS 1.2.
>
> I also moved the cipher suite preferences into tlsdefaults.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/getlantern/waddell/pull/1/files#r20043671>.
>


-- 
--
President
Brave New Software Project, Inc.
https://www.getlantern.org
pgp A998 2B6E EF1C 373E 723F A813 045D A255 901A FD89