From b129f5b8662ca40f36c9d2e5e96561a0ec0e2859 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Fri, 19 Aug 2016 22:50:05 -0600 Subject: [PATCH] Updated Writing a Plugin: Server Type (markdown) --- Writing-a-Plugin:-Server-Type.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Writing-a-Plugin:-Server-Type.md b/Writing-a-Plugin:-Server-Type.md index 94e70ac..ac7360a 100644 --- a/Writing-a-Plugin:-Server-Type.md +++ b/Writing-a-Plugin:-Server-Type.md @@ -92,7 +92,7 @@ Server types that _can_ use TLS should enable TLS automatically before we add it - Call [`RegisterConfigGetter()`](https://godoc.org/github.com/mholt/caddy/caddytls#RegisterConfigGetter) in your package's init() so that the caddytls package knows how to ask for a config when it is parsing the Caddyfile for your server type. (Your "config getter" will have to make a new `caddytls.Config` if one does not already exist for the given Controller.) - Add the `tls` directive to your server type's list of directives. Usually it goes near the front of the list. -When you are instantiating your actual server value and need a [`tls.Config`](https://golang.org/pkg/crypto/tls/#Config), you can call `caddytls.MakeTLSConfig(tlsConfigs)` where `tlsConfigs` is a `[]caddytls.Config`. This function will convert a list of Caddy TLS configs to a single standard library tls.Config for you. You can then use this in a call to [`tls.NewListener()`](https://golang.org/pkg/crypto/tls/#NewListener). +When you are instantiating your actual server value and need a [`tls.Config`](https://golang.org/pkg/crypto/tls/#Config), you can call [`caddytls.MakeTLSConfig(tlsConfigs)`](https://godoc.org/github.com/mholt/caddy/caddytls#MakeTLSConfig) where `tlsConfigs` is a `[]caddytls.Config`. This function will convert a list of Caddy TLS configs to a single standard library tls.Config for you. You can then use this in a call to [`tls.NewListener()`](https://golang.org/pkg/crypto/tls/#NewListener). Finally, you typically want to enable TLS while the Caddyfile is being parsed. For example, the HTTP server configures HTTPS right after the `tls` directive is executed. You should use your package's `init()` function to register a parsing callback that goes through the configurations and configures TLS: