102
}
103
}
105
}
106
107
>
func validateWorkerTLS(cfg *config.WorkerTLS) error {
tls_factory.go
108
>
if cfg.CertFile != "" && cfg.CertData != "" {
109
return fmt.Errorf("cannot specify CertFile and CertData at the same time")
110
}
112
return fmt.Errorf("cannot specify KeyFile and KeyData at the same time")
113
}
115
}
116
117
>
func validateServerTLS(cfg *config.ServerTLS) error {
tls_factory.go
118
>
if cfg.CertFile != "" && cfg.CertData != "" {
119
return fmt.Errorf("cannot specify CertFile and CertData at the same time")
120
}
122
return fmt.Errorf("cannot specify KeyFile and KeyData at the same time")
123
}
124
>
if err := validateCAs(cfg.ClientCAData); err != nil {
tls_factory.go
125
return fmt.Errorf("invalid ServerTLS.ClientCAData: %w", err)
126
}
127
>
if err := validateCAs(cfg.ClientCAFiles); err != nil {
tls_factory.go
128
return fmt.Errorf("invalid ServerTLS.ClientCAFiles: %w", err)
129
}
130
>
if len(cfg.ClientCAFiles) > 0 && len(cfg.ClientCAData) > 0 {
tls_factory.go
131
return fmt.Errorf("cannot specify ClientCAFiles and ClientCAData at the same time")
132
}
134
}
135
136
>
func validateClientTLS(cfg *config.ClientTLS) error {
tls_factory.go
137
>
if err := validateCAs(cfg.RootCAData); err != nil {
138
return fmt.Errorf("invalid ClientTLS.RootCAData: %w", err)
139
}
140
>
if err := validateCAs(cfg.RootCAFiles); err != nil {
tls_factory.go
141
return fmt.Errorf("invalid ClientTLS.RootCAFiles: %w", err)
142
}
143
>
if len(cfg.RootCAData) > 0 && len(cfg.RootCAFiles) > 0 {
tls_factory.go
144
return fmt.Errorf("cannot specify RootCAFiles and RootCAData at the same time")
145
}
147
}
148
150
>
for _, ca := range cas {
151
if strings.TrimSpace(ca) == "" {
152
return fmt.Errorf("CA cannot be empty string")
153
}
154
}
156
}