Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for mTLS and TLS updates #241

Merged
merged 2 commits into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 31 additions & 1 deletion api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,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