(caFile string)
| 65 | } |
| 66 | |
| 67 | func WithCAFile(caFile string) TLSConfigOption { |
| 68 | return func(options *TLSConfigOptions) error { |
| 69 | if caFile == "" { |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | caPEMBlock, err := os.ReadFile(caFile) |
| 74 | if err != nil { |
| 75 | return fmt.Errorf("can't read CA file: %q: %w", caFile, err) |
| 76 | } |
| 77 | |
| 78 | options.caPEMBlock = caPEMBlock |
| 79 | |
| 80 | return nil |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | func NewTLSConfig(options ...TLSConfigOption) (*tls.Config, error) { |
| 85 | to := TLSConfigOptions{} |
no outgoing calls
searching dependent graphs…