api/pkg/cert/certs.go
Peter Kurfer d70ba748f5 Introduce Lifecycle for every endpoint and manage listeners in the renamed Orchestrator
- merge packages to get a more concise layout because plugins are no more and therefore there's not a lot to be exported
- fix test logger
- rework config parsing to be easier and more transparent
- remove unnecessary APIs because dynamic endpoint handling is rather a won't implement
2021-02-10 20:26:45 +00:00

54 lines
1,003 B
Go

package cert
import (
"crypto/tls"
"strings"
"time"
)
type CurveType string
type TLSVersion string
func (x TLSVersion) Value() string {
return strings.ToUpper(string(x))
}
func (x TLSVersion) TLSVersion() uint16 {
switch TLSVersion(x.Value()) {
case TLSVersionSSL3:
return tls.VersionSSL30
case TLSVersionTLS10:
return tls.VersionTLS10
case TLSVersionTLS11:
return tls.VersionTLS11
case TLSVersionTLS12:
return tls.VersionTLS12
default:
return tls.VersionTLS13
}
}
type File struct {
PublicKeyPath string
PrivateKeyPath string
}
type ValidityDuration struct {
NotBeforeRelative time.Duration
NotAfterRelative time.Duration
}
type ValidityByPurpose struct {
CA ValidityDuration
Server ValidityDuration
}
type CertOptions struct {
RootCACert File
CertCachePath string
Curve CurveType
Validity ValidityByPurpose
IncludeInsecureCipherSuites bool
MinTLSVersion TLSVersion
}