Skip to content

Commit 38afac5

Browse files
authored
Rename department of redundancy (#114)
Rename `Struct` to `Config` to make the struct naming less redundant. Signed-off-by: SuperQ <[email protected]> Signed-off-by: SuperQ <[email protected]>
1 parent 49aa994 commit 38afac5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

web/tls_config.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ var (
3434
)
3535

3636
type Config struct {
37-
TLSConfig TLSStruct `yaml:"tls_server_config"`
38-
HTTPConfig HTTPStruct `yaml:"http_server_config"`
37+
TLSConfig TLSConfig `yaml:"tls_server_config"`
38+
HTTPConfig HTTPConfig `yaml:"http_server_config"`
3939
Users map[string]config_util.Secret `yaml:"basic_auth_users"`
4040
}
4141

42-
type TLSStruct struct {
42+
type TLSConfig struct {
4343
TLSCertPath string `yaml:"cert_file"`
4444
TLSKeyPath string `yaml:"key_file"`
4545
ClientAuth string `yaml:"client_auth_type"`
@@ -52,13 +52,13 @@ type TLSStruct struct {
5252
}
5353

5454
// SetDirectory joins any relative file paths with dir.
55-
func (t *TLSStruct) SetDirectory(dir string) {
55+
func (t *TLSConfig) SetDirectory(dir string) {
5656
t.TLSCertPath = config_util.JoinDir(dir, t.TLSCertPath)
5757
t.TLSKeyPath = config_util.JoinDir(dir, t.TLSKeyPath)
5858
t.ClientCAs = config_util.JoinDir(dir, t.ClientCAs)
5959
}
6060

61-
type HTTPStruct struct {
61+
type HTTPConfig struct {
6262
HTTP2 bool `yaml:"http2"`
6363
Header map[string]string `yaml:"headers,omitempty"`
6464
}
@@ -69,12 +69,12 @@ func getConfig(configPath string) (*Config, error) {
6969
return nil, err
7070
}
7171
c := &Config{
72-
TLSConfig: TLSStruct{
72+
TLSConfig: TLSConfig{
7373
MinVersion: tls.VersionTLS12,
7474
MaxVersion: tls.VersionTLS13,
7575
PreferServerCipherSuites: true,
7676
},
77-
HTTPConfig: HTTPStruct{HTTP2: true},
77+
HTTPConfig: HTTPConfig{HTTP2: true},
7878
}
7979
err = yaml.UnmarshalStrict(content, c)
8080
if err == nil {
@@ -92,8 +92,8 @@ func getTLSConfig(configPath string) (*tls.Config, error) {
9292
return ConfigToTLSConfig(&c.TLSConfig)
9393
}
9494

95-
// ConfigToTLSConfig generates the golang tls.Config from the TLSStruct config.
96-
func ConfigToTLSConfig(c *TLSStruct) (*tls.Config, error) {
95+
// ConfigToTLSConfig generates the golang tls.Config from the TLSConfig struct.
96+
func ConfigToTLSConfig(c *TLSConfig) (*tls.Config, error) {
9797
if c.TLSCertPath == "" && c.TLSKeyPath == "" && c.ClientAuth == "" && c.ClientCAs == "" {
9898
return nil, errNoTLSConfig
9999
}

0 commit comments

Comments
 (0)