Skip to content

Commit

Permalink
Merge pull request #241 from efectn/add-mtls
Browse files Browse the repository at this point in the history
Add docs for mTLS and TLS updates
  • Loading branch information
ReneWerner87 committed Feb 28, 2022
2 parents 5d28769 + 9f7fa43 commit 743460c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,44 @@ Using `ListenTLS` defaults to the following config \( use `Listener` to provide
```go
&tls.Config{
MinVersion: tls.VersionTLS12,
PreferServerCipherSuites: true,
Certificates: []tls.Certificate{
cert,
},
}
```
{% endcode %}

## ListenMutualTLS

ListenMutualTLS serves HTTPs requests from the given address using certFile, keyFile and clientCertFile are the paths to TLS certificate and key file

{% code title="Signature" %}
```go
func (app *App) ListenMutualTLS(addr, certFile, keyFile, clientCertFile string) error
```
{% endcode %}

{% code title="Examples" %}
```go
app.ListenMutualTLS(":443", "./cert.pem", "./cert.key", "./ca-chain-cert.pem");
```
{% endcode %}

Using `ListenMutualTLS` defaults to the following config \( use `Listener` to provide your own config \)

{% code title="Default \*tls.Config" %}
```go
&tls.Config{
MinVersion: tls.VersionTLS12,
ClientAuth: tls.RequireAndVerifyClientCert,
ClientCAs: clientCertPool,
Certificates: []tls.Certificate{
cert,
},
}
```
{% endcode %}

## Listener

You can pass your own [`net.Listener`](https://golang.org/pkg/net/#Listener) using the `Listener` method. This method can be used to enable **TLS/HTTPS** with a custom tls.Config.
Expand Down

0 comments on commit 743460c

Please sign in to comment.