Skip to content

Commit

Permalink
🩹 Fix: rename WithTlsConfig method to WithTLSConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
beyazit committed Aug 10, 2023
1 parent 44acb06 commit 1774b1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/api/middleware/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ After you initiate your Fiber app, you can use the following possibilities:

```go
// if target https site uses a self-signed certificate, you should
// call WithTlsConfig before Do and Forward
proxy.WithTlsConfig(&tls.Config{
// call WithTLSConfig before Do and Forward
proxy.WithTLSConfig(&tls.Config{
InsecureSkipVerify: true,
})
// if you need to use global self-custom client, you should use proxy.WithClient.
Expand Down
6 changes: 3 additions & 3 deletions middleware/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ var client = &fasthttp.Client{

var lock sync.RWMutex

// WithTlsConfig update http client with a user specified tls.config
// WithTLSConfig update http client with a user specified tls.config
// This function should be called before Do and Forward.
// Deprecated: use WithClient instead.
//
//nolint:stylecheck,revive // TODO: Rename to "WithTLSConfig" in v3
func WithTlsConfig(tlsConfig *tls.Config) {
//nolint:stylecheck,revive

Check failure on line 112 in middleware/proxy/proxy.go

View workflow job for this annotation

GitHub Actions / lint

directive `//nolint:stylecheck,revive` is unused for linter "stylecheck" (nolintlint)
func WithTLSConfig(tlsConfig *tls.Config) {
client.TLSConfig = tlsConfig
}

Expand Down
14 changes: 7 additions & 7 deletions middleware/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func Test_Proxy(t *testing.T) {
require.Equal(t, fiber.StatusTeapot, resp.StatusCode)
}

// go test -run Test_Proxy_Balancer_WithTlsConfig
func Test_Proxy_Balancer_WithTlsConfig(t *testing.T) {
// go test -run Test_Proxy_Balancer_WithTLSConfig
func Test_Proxy_Balancer_WithTLSConfig(t *testing.T) {
t.Parallel()

serverTLSConf, _, err := tlstest.GetTLSConfigs()
Expand Down Expand Up @@ -144,8 +144,8 @@ func Test_Proxy_Balancer_WithTlsConfig(t *testing.T) {
require.Equal(t, "tls balancer", body)
}

// go test -run Test_Proxy_Forward_WithTlsConfig_To_Http
func Test_Proxy_Forward_WithTlsConfig_To_Http(t *testing.T) {
// go test -run Test_Proxy_Forward_WithTLSConfig_To_Http
func Test_Proxy_Forward_WithTLSConfig_To_Http(t *testing.T) {
t.Parallel()

_, targetAddr := createProxyTestServer(t, func(c fiber.Ctx) error {
Expand Down Expand Up @@ -203,8 +203,8 @@ func Test_Proxy_Forward(t *testing.T) {
require.Equal(t, "forwarded", string(b))
}

// go test -run Test_Proxy_Forward_WithTlsConfig
func Test_Proxy_Forward_WithTlsConfig(t *testing.T) {
// go test -run Test_Proxy_Forward_WithTLSConfig
func Test_Proxy_Forward_WithTLSConfig(t *testing.T) {
t.Parallel()

serverTLSConf, _, err := tlstest.GetTLSConfigs()
Expand All @@ -225,7 +225,7 @@ func Test_Proxy_Forward_WithTlsConfig(t *testing.T) {
clientTLSConf := &tls.Config{InsecureSkipVerify: true} //nolint:gosec // We're in a test func, so this is fine

// disable certificate verification
WithTlsConfig(clientTLSConf)
WithTLSConfig(clientTLSConf)
app.Use(Forward("https://" + addr + "/tlsfwd"))

go func() {
Expand Down

0 comments on commit 1774b1c

Please sign in to comment.