From 24148a9ace64b41302a2c6fbebd2cd9f1656ac40 Mon Sep 17 00:00:00 2001 From: Samantha Date: Fri, 22 Nov 2024 16:03:10 -0500 Subject: [PATCH] Address comments. --- cmd/boulder-va/main.go | 36 +++++++++++++++++++++++++++++++++++- cmd/config.go | 34 ---------------------------------- va/va_test.go | 14 +++++++------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cmd/boulder-va/main.go b/cmd/boulder-va/main.go index 3854aa2132c..72ab5dbd3eb 100644 --- a/cmd/boulder-va/main.go +++ b/cmd/boulder-va/main.go @@ -15,10 +15,44 @@ import ( vapb "github.com/letsencrypt/boulder/va/proto" ) +// RemoteVAGRPCClientConfig contains the information necessary to setup a gRPC +// client connection. The following GRPC client configuration field combinations +// are allowed: +// +// ServerIPAddresses, [Timeout] +// ServerAddress, DNSAuthority, [Timeout], [HostOverride] +// SRVLookup, DNSAuthority, [Timeout], [HostOverride], [SRVResolver] +// SRVLookups, DNSAuthority, [Timeout], [HostOverride], [SRVResolver] +type RemoteVAGRPCClientConfig struct { + cmd.GRPCClientConfig + // Perspective uniquely identifies the Network Perspective used to + // perform the validation, as specified in BRs Section 5.4.1, + // Requirement 2.7 ("Multi-Perspective Issuance Corroboration attempts + // from each Network Perspective"). It should uniquely identify a group + // of RVAs deployed in the same datacenter. + // + // TODO(#7615): Make mandatory. + Perspective string `validate:"omitempty"` + + // RIR indicates the Regional Internet Registry where this RVA is + // located. This field is used to identify the RIR region from which a + // given validation was performed, as specified in the "Phased + // Implementation Timeline" in BRs Section 3.2.2.9. It must be one of + // the following values: + // - ARIN + // - RIPE + // - APNIC + // - LACNIC + // - AfriNIC + // + // TODO(#7615): Make mandatory. + RIR string `validate:"omitempty,oneof=ARIN RIPE APNIC LACNIC AfriNIC"` +} + type Config struct { VA struct { vaConfig.Common - RemoteVAs []cmd.RemoteVAGRPCClientConfig `validate:"omitempty,dive"` + RemoteVAs []RemoteVAGRPCClientConfig `validate:"omitempty,dive"` // Deprecated and ignored MaxRemoteValidationFailures int `validate:"omitempty,min=0,required_with=RemoteVAs"` Features features.Config diff --git a/cmd/config.go b/cmd/config.go index 1d868632f9b..9aaa6836f52 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -442,40 +442,6 @@ func (c *GRPCClientConfig) makeSRVScheme() (string, error) { return c.SRVResolver, nil } -// RemoteVAGRPCClientConfig contains the information necessary to setup a gRPC -// client connection. The following GRPC client configuration field combinations -// are allowed: -// -// ServerIPAddresses, [Timeout] -// ServerAddress, DNSAuthority, [Timeout], [HostOverride] -// SRVLookup, DNSAuthority, [Timeout], [HostOverride], [SRVResolver] -// SRVLookups, DNSAuthority, [Timeout], [HostOverride], [SRVResolver] -type RemoteVAGRPCClientConfig struct { - GRPCClientConfig - // Perspective uniquely identifies the Network Perspective used to - // perform the validation, as specified in BRs Section 5.4.1, - // Requirement 2.7 ("Multi-Perspective Issuance Corroboration attempts - // from each Network Perspective"). It should uniquely identify a group - // of RVAs deployed in the same datacenter. - // - // TODO(#7615): Make mandatory. - Perspective string `validate:"omitempty"` - - // RIR indicates the Regional Internet Registry where this RVA is - // located. This field is used to identify the RIR region from which a - // given validation was performed, as specified in the "Phased - // Implementation Timeline" in BRs Section 3.2.2.9. It must be one of - // the following values: - // - ARIN - // - RIPE - // - APNIC - // - LACNIC - // - AfriNIC - // - // TODO(#7615): Make mandatory. - RIR string `validate:"omitempty,oneof=ARIN RIPE APNIC LACNIC AfriNIC"` -} - // GRPCServerConfig contains the information needed to start a gRPC server. type GRPCServerConfig struct { Address string `json:"address" validate:"omitempty,hostname_port"` diff --git a/va/va_test.go b/va/va_test.go index 10c608f8961..33701d95e63 100644 --- a/va/va_test.go +++ b/va/va_test.go @@ -231,7 +231,7 @@ type multiSrv struct { } const ( - slow = "slow remote" + slowUA = "slow remote" slowRemoteSleepMillis = 1000 ) @@ -243,7 +243,7 @@ func httpMultiSrv(t *testing.T, token string, allowedUAs map[string]bool) *multi ms := &multiSrv{server, sync.Mutex{}, allowedUAs} m.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - if r.UserAgent() == slow { + if r.UserAgent() == slowUA { time.Sleep(slowRemoteSleepMillis) } ms.mu.Lock() @@ -659,15 +659,15 @@ func TestMultiVAEarlyReturn(t *testing.T) { }{ { remoteConfs: []remoteConf{ - {ua: slow, rir: arin}, + {ua: slowUA, rir: arin}, {ua: pass, rir: ripe}, {ua: fail, rir: apnic}, }, }, { remoteConfs: []remoteConf{ - {ua: slow, rir: arin}, - {ua: slow, rir: ripe}, + {ua: slowUA, rir: arin}, + {ua: slowUA, rir: ripe}, {ua: pass, rir: apnic}, {ua: pass, rir: arin}, {ua: fail, rir: ripe}, @@ -675,8 +675,8 @@ func TestMultiVAEarlyReturn(t *testing.T) { }, { remoteConfs: []remoteConf{ - {ua: slow, rir: arin}, - {ua: slow, rir: ripe}, + {ua: slowUA, rir: arin}, + {ua: slowUA, rir: ripe}, {ua: pass, rir: apnic}, {ua: pass, rir: arin}, {ua: fail, rir: ripe},