@@ -34,12 +34,12 @@ var (
34
34
)
35
35
36
36
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"`
39
39
Users map [string ]config_util.Secret `yaml:"basic_auth_users"`
40
40
}
41
41
42
- type TLSStruct struct {
42
+ type TLSConfig struct {
43
43
TLSCertPath string `yaml:"cert_file"`
44
44
TLSKeyPath string `yaml:"key_file"`
45
45
ClientAuth string `yaml:"client_auth_type"`
@@ -52,13 +52,13 @@ type TLSStruct struct {
52
52
}
53
53
54
54
// SetDirectory joins any relative file paths with dir.
55
- func (t * TLSStruct ) SetDirectory (dir string ) {
55
+ func (t * TLSConfig ) SetDirectory (dir string ) {
56
56
t .TLSCertPath = config_util .JoinDir (dir , t .TLSCertPath )
57
57
t .TLSKeyPath = config_util .JoinDir (dir , t .TLSKeyPath )
58
58
t .ClientCAs = config_util .JoinDir (dir , t .ClientCAs )
59
59
}
60
60
61
- type HTTPStruct struct {
61
+ type HTTPConfig struct {
62
62
HTTP2 bool `yaml:"http2"`
63
63
Header map [string ]string `yaml:"headers,omitempty"`
64
64
}
@@ -69,12 +69,12 @@ func getConfig(configPath string) (*Config, error) {
69
69
return nil , err
70
70
}
71
71
c := & Config {
72
- TLSConfig : TLSStruct {
72
+ TLSConfig : TLSConfig {
73
73
MinVersion : tls .VersionTLS12 ,
74
74
MaxVersion : tls .VersionTLS13 ,
75
75
PreferServerCipherSuites : true ,
76
76
},
77
- HTTPConfig : HTTPStruct {HTTP2 : true },
77
+ HTTPConfig : HTTPConfig {HTTP2 : true },
78
78
}
79
79
err = yaml .UnmarshalStrict (content , c )
80
80
if err == nil {
@@ -92,8 +92,8 @@ func getTLSConfig(configPath string) (*tls.Config, error) {
92
92
return ConfigToTLSConfig (& c .TLSConfig )
93
93
}
94
94
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 ) {
97
97
if c .TLSCertPath == "" && c .TLSKeyPath == "" && c .ClientAuth == "" && c .ClientCAs == "" {
98
98
return nil , errNoTLSConfig
99
99
}
0 commit comments