Revert "Package ca-certificates.crt"

This reverts commit 8b2467e7e0.
This commit is contained in:
Ian Gulliver
2023-06-11 17:36:37 -07:00
parent 8b2467e7e0
commit b11c9cc7de
2 changed files with 0 additions and 3538 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,6 @@ package elect
import ( import (
"crypto/hmac" "crypto/hmac"
"crypto/tls"
"crypto/x509"
_ "embed"
"encoding/json" "encoding/json"
"log" "log"
"time" "time"
@@ -41,13 +38,9 @@ type voteResponse struct {
ResponseSent time.Time `json:"responseSent"` ResponseSent time.Time `json:"responseSent"`
} }
//go:embed ca-certificates.crt
var caCertificates []byte
func NewVoter(url string, signingKey string) *Voter { func NewVoter(url string, signingKey string) *Voter {
v := &Voter{ v := &Voter{
client: resty.New(). client: resty.New().
SetTLSClientConfig(getTLSClientConfig()).
SetCloseConnection(true). SetCloseConnection(true).
SetBaseURL(url), SetBaseURL(url),
signingKey: []byte(signingKey), signingKey: []byte(signingKey),
@@ -174,17 +167,3 @@ func (v *Voter) sendVote() {
func (v *Voter) log(format string, args ...any) { func (v *Voter) log(format string, args ...any) {
log.Printf("[voter] "+format, args...) log.Printf("[voter] "+format, args...)
} }
func getTLSClientConfig() *tls.Config {
pool := x509.NewCertPool()
ok := pool.AppendCertsFromPEM(caCertificates)
if !ok {
panic("invalid ca-certificates")
}
return &tls.Config{
MinVersion: tls.VersionTLS12,
RootCAs: pool,
}
}