mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
87 lines
2.1 KiB
Go
87 lines
2.1 KiB
Go
package encryption
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"crypto/x509"
|
|
"time"
|
|
|
|
"go.temporal.io/server/common/config"
|
|
)
|
|
|
|
type TestDynamicCertProvider struct {
|
|
serverCerts []*tls.Certificate
|
|
caCerts *x509.CertPool
|
|
wrongCACerts *x509.CertPool
|
|
serverCertIndex int
|
|
config *config.GroupTLS
|
|
serverName string
|
|
}
|
|
|
|
var _ CertProvider = (*TestDynamicCertProvider)(nil)
|
|
var _ PerHostCertProviderMap = (*TestDynamicCertProvider)(nil)
|
|
|
|
func NewTestDynamicCertProvider(
|
|
serverCerts []*tls.Certificate,
|
|
caCerts *x509.CertPool,
|
|
wrongCACerts *x509.CertPool,
|
|
config config.GroupTLS) *TestDynamicCertProvider {
|
|
|
|
return &TestDynamicCertProvider{
|
|
serverCerts: serverCerts,
|
|
caCerts: caCerts,
|
|
wrongCACerts: wrongCACerts,
|
|
config: &config,
|
|
serverName: "127.0.0.1",
|
|
}
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) FetchServerCertificate() (*tls.Certificate, error) {
|
|
i := t.serverCertIndex % len(t.serverCerts)
|
|
t.serverCertIndex++
|
|
return t.serverCerts[i], nil
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) FetchClientCAs() (*x509.CertPool, error) {
|
|
panic("not implemented")
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) GetSettings() *config.GroupTLS {
|
|
return t.config
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) FetchClientCertificate(_ bool) (*tls.Certificate, error) {
|
|
panic("not implemented")
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) FetchServerRootCAsForClient(_ bool) (*x509.CertPool, error) {
|
|
return t.caCerts, nil
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) GetCertProvider(hostName string) (CertProvider, bool, error) {
|
|
if hostName == "localhost" {
|
|
return t, false, nil
|
|
}
|
|
return nil, false, nil
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) SwitchToWrongServerRootCACerts() {
|
|
t.caCerts = t.wrongCACerts
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) SetServerName(serverName string) {
|
|
t.serverName = serverName
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) GetExpiringCerts(_ time.Duration,
|
|
) (expiring CertExpirationMap, expired CertExpirationMap, err error) {
|
|
panic("not implemented")
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) Initialize(refreshInterval time.Duration) {
|
|
panic("implement me")
|
|
}
|
|
|
|
func (t *TestDynamicCertProvider) NumberOfHosts() int {
|
|
return 1
|
|
}
|