Skip to content
This repository was archived by the owner on May 27, 2019. It is now read-only.

Commit a7da253

Browse files
committed
ref(*): fix new linter errors
1 parent 72251f4 commit a7da253

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

model/model.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type RouterConfig struct {
5353
AppConfigs []*AppConfig
5454
BuilderConfig *BuilderConfig
5555
PlatformCertificate *Certificate
56-
Http2Enabled bool `key:"http2Enabled" constraint:"(?i)^(true|false)$"`
56+
HTTP2Enabled bool `key:"http2Enabled" constraint:"(?i)^(true|false)$"`
5757
}
5858

5959
func newRouterConfig() *RouterConfig {
@@ -72,7 +72,7 @@ func newRouterConfig() *RouterConfig {
7272
EnforceWhitelists: false,
7373
WhitelistMode: "extend",
7474
SSLConfig: newSSLConfig(),
75-
Http2Enabled: true,
75+
HTTP2Enabled: true,
7676
}
7777
}
7878

@@ -165,15 +165,15 @@ type SSLConfig struct {
165165

166166
func newSSLConfig() *SSLConfig {
167167
return &SSLConfig{
168-
Enforce: false,
169-
Protocols: "TLSv1 TLSv1.1 TLSv1.2",
168+
Enforce: false,
169+
Protocols: "TLSv1 TLSv1.1 TLSv1.2",
170170
// Default cipher suite:
171171
// - Prefer 128-Bit over 256-Bit encryptions (lower overhead)
172172
// - Prefer GCM over EDH over RSA auth (for Forward Secrecy)
173173
// - Fallback to 112-Bit 3DES (mainly for IE 8 compatibility)
174174
// Compatible: Firefox 1, Chrome 1, IE 7, Opera 5, Safari 1, Windows XP IE8, Android 2.3, Java 7
175175
// Incompatible: Windows XP IE6, Java 6
176-
// Source: https://wiki.mozilla.org/Security/Server_Side_TLS (intermediate compatiblity)
176+
// Source: https://wiki.mozilla.org/Security/Server_Side_TLS (intermediate compatibility)
177177
Ciphers: "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS",
178178
SessionTimeout: "10m",
179179
UseSessionTickets: true,

model/model_validation_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ func TestValidWhitelistMode(t *testing.T) {
127127
testValidValues(t, newTestRouterConfig, "WhitelistMode", "whitelistMode", []string{"extend", "override"})
128128
}
129129

130-
func TestValidHttp2Enabled(t *testing.T) {
131-
testValidValues(t, newTestRouterConfig, "HttpEnabled", "http2Enabled", []string{"true", "false", "TRUE", "FALSE"})
130+
func TestValidHTTP2Enabled(t *testing.T) {
131+
testValidValues(t, newTestRouterConfig, "HttpEnabled", "http2Enabled", []string{"true", "false", "TRUE", "FALSE"})
132132
}
133133

134-
func TestInvalidHttp2Enabled(t *testing.T) {
135-
testInvalidValues(t, newTestRouterConfig, "Http2Enabled", "http2Enabled", []string{"0", "-1", "foobar"})
134+
func TestInvalidHTTP2Enabled(t *testing.T) {
135+
testInvalidValues(t, newTestRouterConfig, "HTTP2Enabled", "http2Enabled", []string{"0", "-1", "foobar"})
136136
}
137137

138138
func TestInvalidGzipEnabled(t *testing.T) {

nginx/config.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ http {
115115
# Default server handles requests for unmapped hostnames, including healthchecks
116116
server {
117117
listen 8080 default_server reuseport{{ if $routerConfig.UseProxyProtocol }} proxy_protocol{{ end }};
118-
listen 6443 default_server ssl {{ if $routerConfig.Http2Enabled }}http2{{ end }} {{ if $routerConfig.UseProxyProtocol }}proxy_protocol{{ end }};
118+
listen 6443 default_server ssl {{ if $routerConfig.HTTP2Enabled }}http2{{ end }} {{ if $routerConfig.UseProxyProtocol }}proxy_protocol{{ end }};
119119
set $app_name "router-default-vhost";
120120
{{ if $routerConfig.PlatformCertificate }}
121121
ssl_protocols {{ $sslConfig.Protocols }};
@@ -166,7 +166,7 @@ http {
166166
set $app_name "{{ $appConfig.Name }}";
167167
168168
{{ if index $appConfig.Certificates $domain }}
169-
listen 6443 ssl {{ if $routerConfig.Http2Enabled }}http2{{ end }} {{ if $routerConfig.UseProxyProtocol }}proxy_protocol{{ end }};
169+
listen 6443 ssl {{ if $routerConfig.HTTP2Enabled }}http2{{ end }} {{ if $routerConfig.UseProxyProtocol }}proxy_protocol{{ end }};
170170
ssl_protocols {{ $sslConfig.Protocols }};
171171
{{ if ne $sslConfig.Ciphers "" }}ssl_ciphers {{ $sslConfig.Ciphers }};{{ end }}
172172
ssl_prefer_server_ciphers on;
@@ -311,8 +311,5 @@ func WriteConfig(routerConfig *model.RouterConfig, filePath string) error {
311311
return err
312312
}
313313
err = tmpl.Execute(file, routerConfig)
314-
if err != nil {
315-
return err
316-
}
317-
return nil
314+
return err
318315
}

0 commit comments

Comments
 (0)