@@ -41,26 +41,17 @@ func newRegIdBucketKey(name Name, regId int64) string {
4141 return joinWithColon (name .EnumString (), strconv .FormatInt (regId , 10 ))
4242}
4343
44- // newStringBucketKey validates and returns a bucketKey for limits that use
45- // the 'enum:identValue' or 'enum: domainOrCIDR' bucket key formats.
46- func newStringBucketKey (name Name , value string ) string {
47- return joinWithColon (name .EnumString (), value )
44+ // newDomainOrCIDRBucketKey validates and returns a bucketKey for limits that use
45+ // the 'enum:domainOrCIDR' bucket key formats.
46+ func newDomainOrCIDRBucketKey (name Name , domainOrCIDR string ) string {
47+ return joinWithColon (name .EnumString (), domainOrCIDR )
4848}
4949
5050// NewRegIdIdentValueBucketKey returns a bucketKey for limits that use the
5151// 'enum:regId:identValue' bucket key format. This function is exported for use
5252// by the RA when resetting the account pausing limit.
53- func NewRegIdIdentValueBucketKey (name Name , regId int64 , orderIdent identifier.ACMEIdentifier ) string {
54- return newRegIdStringBucketKey (name , regId , orderIdent .Value )
55- }
56-
57- // newRegIdStringBucketKey returns a bucketKey for limits that use the
58- // 'enum:regId:identValue' or 'enum:regId:domainOrCIDR' bucket key formats.
59- //
60- // This is split out from NewRegIdIdentValueBucketKey so that we can handle an
61- // IP prefix in CIDR notation, which is not a valid identifier value.
62- func newRegIdStringBucketKey (name Name , regId int64 , value string ) string {
63- return joinWithColon (name .EnumString (), strconv .FormatInt (regId , 10 ), value )
53+ func NewRegIdIdentValueBucketKey (name Name , regId int64 , orderIdent string ) string {
54+ return joinWithColon (name .EnumString (), strconv .FormatInt (regId , 10 ), orderIdent )
6455}
6556
6657// newFQDNSetBucketKey validates and returns a bucketKey for limits that use the
@@ -256,7 +247,7 @@ func (builder *TransactionBuilder) FailedAuthorizationsPerDomainPerAccountCheckO
256247 for _ , ident := range orderIdents {
257248 // FailedAuthorizationsPerDomainPerAccount limit uses the
258249 // 'enum:regId:identValue' bucket key format for transactions.
259- perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsPerDomainPerAccount , regId , ident )
250+ perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsPerDomainPerAccount , regId , ident . Value )
260251
261252 // Add a check-only transaction for each per identValue per account
262253 // bucket.
@@ -287,7 +278,7 @@ func (builder *TransactionBuilder) FailedAuthorizationsPerDomainPerAccountSpendO
287278
288279 // FailedAuthorizationsPerDomainPerAccount limit uses the
289280 // 'enum:regId:identValue' bucket key format for transactions.
290- perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsPerDomainPerAccount , regId , orderIdent )
281+ perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsPerDomainPerAccount , regId , orderIdent . Value )
291282 txn , err := newSpendOnlyTransaction (limit , perIdentValuePerAccountBucketKey , 1 )
292283 if err != nil {
293284 return Transaction {}, err
@@ -314,7 +305,7 @@ func (builder *TransactionBuilder) FailedAuthorizationsForPausingPerDomainPerAcc
314305
315306 // FailedAuthorizationsForPausingPerDomainPerAccount limit uses the
316307 // 'enum:regId:identValue' bucket key format for transactions.
317- perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsForPausingPerDomainPerAccount , regId , orderIdent )
308+ perIdentValuePerAccountBucketKey := NewRegIdIdentValueBucketKey (FailedAuthorizationsForPausingPerDomainPerAccount , regId , orderIdent . Value )
318309 txn , err := newTransaction (limit , perIdentValuePerAccountBucketKey , 1 )
319310 if err != nil {
320311 return Transaction {}, err
@@ -354,21 +345,22 @@ func (builder *TransactionBuilder) certificatesPerDomainCheckOnlyTransactions(re
354345 }
355346 }
356347
357- var txns []Transaction
358- covers , err := coveringIdentifiers (orderIdents )
348+ coveringIdents , err := coveringIdentifiers (orderIdents )
359349 if err != nil {
360350 return nil , err
361351 }
362- for _ , name := range covers {
363- perDomainOrCIDRBucketKey := newStringBucketKey (CertificatesPerDomain , name )
352+
353+ var txns []Transaction
354+ for _ , ident := range coveringIdents {
355+ perDomainOrCIDRBucketKey := newDomainOrCIDRBucketKey (CertificatesPerDomain , ident )
364356 if accountOverride {
365357 if ! perAccountLimit .isOverride {
366358 return nil , fmt .Errorf ("shouldn't happen: CertificatesPerDomainPerAccount limit is not an override" )
367359 }
368- perAccountPerDomainOrCIDRKey := newRegIdStringBucketKey (CertificatesPerDomainPerAccount , regId , name )
360+ perAccountPerDomainOrCIDRBucketKey := NewRegIdIdentValueBucketKey (CertificatesPerDomainPerAccount , regId , ident )
369361 // Add a check-only transaction for each per account per identValue
370362 // bucket.
371- txn , err := newCheckOnlyTransaction (perAccountLimit , perAccountPerDomainOrCIDRKey , 1 )
363+ txn , err := newCheckOnlyTransaction (perAccountLimit , perAccountPerDomainOrCIDRBucketKey , 1 )
372364 if err != nil {
373365 if errors .Is (err , errLimitDisabled ) {
374366 continue
@@ -432,21 +424,22 @@ func (builder *TransactionBuilder) CertificatesPerDomainSpendOnlyTransactions(re
432424 }
433425 }
434426
435- var txns []Transaction
436- covers , err := coveringIdentifiers (orderIdents )
427+ coveringIdents , err := coveringIdentifiers (orderIdents )
437428 if err != nil {
438429 return nil , err
439430 }
440- for _ , name := range covers {
441- perDomainOrCIDRBucketKey := newStringBucketKey (CertificatesPerDomain , name )
431+
432+ var txns []Transaction
433+ for _ , ident := range coveringIdents {
434+ perDomainOrCIDRBucketKey := newDomainOrCIDRBucketKey (CertificatesPerDomain , ident )
442435 if accountOverride {
443436 if ! perAccountLimit .isOverride {
444437 return nil , fmt .Errorf ("shouldn't happen: CertificatesPerDomainPerAccount limit is not an override" )
445438 }
446- perAccountPerDomainOrCIDRKey := newRegIdStringBucketKey (CertificatesPerDomainPerAccount , regId , name )
439+ perAccountPerDomainOrCIDRBucketKey := NewRegIdIdentValueBucketKey (CertificatesPerDomainPerAccount , regId , ident )
447440 // Add a spend-only transaction for each per account per
448441 // domainOrCIDR bucket.
449- txn , err := newSpendOnlyTransaction (perAccountLimit , perAccountPerDomainOrCIDRKey , 1 )
442+ txn , err := newSpendOnlyTransaction (perAccountLimit , perAccountPerDomainOrCIDRBucketKey , 1 )
450443 if err != nil {
451444 return nil , err
452445 }
0 commit comments