@@ -17,7 +17,7 @@ limitations under the License.
17
17
package crossplane
18
18
19
19
import (
20
- "crypto/sha1"
20
+ "crypto/sha1" //nolint: gosec // We cannot move away from sha1
21
21
"encoding/base64"
22
22
"encoding/hex"
23
23
"fmt"
62
62
type seconds int
63
63
type minutes int
64
64
65
- func buildDirectiveWithComment (directive string , comment string , args ... any ) * ngx_crossplane.Directive {
65
+ func buildDirectiveWithComment (directive , comment string , args ... any ) * ngx_crossplane.Directive {
66
66
dir := buildDirective (directive , args ... )
67
67
dir .Comment = ptr .To (comment )
68
68
return dir
@@ -213,25 +213,25 @@ func buildServerName(hostname string) string {
213
213
return `~^(?<subdomain>[\w-]+)\.` + strings .Join (parts , "\\ ." ) + `$`
214
214
}
215
215
216
- func buildListener (tc config.TemplateConfig , hostname string ) ngx_crossplane.Directives {
216
+ func buildListener (tc * config.TemplateConfig , hostname string ) ngx_crossplane.Directives {
217
217
listenDirectives := make (ngx_crossplane.Directives , 0 )
218
218
219
- co := commonListenOptions (& tc , hostname )
219
+ co := commonListenOptions (tc , hostname )
220
220
221
221
addrV4 := []string {"" }
222
222
if len (tc .Cfg .BindAddressIpv4 ) > 0 {
223
223
addrV4 = tc .Cfg .BindAddressIpv4
224
224
}
225
- listenDirectives = append (listenDirectives , httpListener (addrV4 , co , & tc , false )... )
226
- listenDirectives = append (listenDirectives , httpListener (addrV4 , co , & tc , true )... )
225
+ listenDirectives = append (listenDirectives , httpListener (addrV4 , co , tc , false )... )
226
+ listenDirectives = append (listenDirectives , httpListener (addrV4 , co , tc , true )... )
227
227
228
228
if tc .IsIPV6Enabled {
229
229
addrV6 := []string {"[::]" }
230
230
if len (tc .Cfg .BindAddressIpv6 ) > 0 {
231
231
addrV6 = tc .Cfg .BindAddressIpv6
232
232
}
233
- listenDirectives = append (listenDirectives , httpListener (addrV6 , co , & tc , false )... )
234
- listenDirectives = append (listenDirectives , httpListener (addrV6 , co , & tc , true )... )
233
+ listenDirectives = append (listenDirectives , httpListener (addrV6 , co , tc , false )... )
234
+ listenDirectives = append (listenDirectives , httpListener (addrV6 , co , tc , true )... )
235
235
}
236
236
237
237
return listenDirectives
@@ -258,7 +258,7 @@ func commonListenOptions(template *config.TemplateConfig, hostname string) []str
258
258
return out
259
259
}
260
260
261
- func httpListener (addresses [] string , co []string , tc * config.TemplateConfig , ssl bool ) ngx_crossplane.Directives {
261
+ func httpListener (addresses , co []string , tc * config.TemplateConfig , ssl bool ) ngx_crossplane.Directives {
262
262
listeners := make (ngx_crossplane.Directives , 0 )
263
263
port := tc .ListenPorts .HTTP
264
264
isTLSProxy := tc .IsSSLPassthroughEnabled
@@ -400,7 +400,7 @@ func changeHostPort(newURL, value string) string {
400
400
}
401
401
402
402
func buildAuthSignURLLocation (location , authSignURL string ) string {
403
- hasher := sha1 .New () // #nosec
403
+ hasher := sha1 .New () //nolint: gosec // We cannot move away from sha1
404
404
hasher .Write ([]byte (location ))
405
405
hasher .Write ([]byte (authSignURL ))
406
406
return "@" + hex .EncodeToString (hasher .Sum (nil ))
@@ -558,7 +558,6 @@ func buildProxyPass(backends []*ingress.Backend, location *ingress.Location) ngx
558
558
}
559
559
560
560
func buildGeoIPDirectives (reloadTime int , files []string ) ngx_crossplane.Directives {
561
-
562
561
directives := make (ngx_crossplane.Directives , 0 )
563
562
buildGeoIPBlock := func (file string , directives ngx_crossplane.Directives ) * ngx_crossplane.Directive {
564
563
if reloadTime > 0 && file != "GeoIP2-Connection-Type.mmdb" {
0 commit comments