Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions cmd/admin/dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"

"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/prototext"
Expand All @@ -12,6 +13,8 @@ import (
sapb "github.com/letsencrypt/boulder/sa/proto"
)

var _ rapb.RegistrationAuthorityClient = (*dryRunRAC)(nil)

type dryRunRAC struct {
rapb.RegistrationAuthorityClient
log blog.Logger
Expand All @@ -26,6 +29,8 @@ func (d dryRunRAC) AdministrativelyRevokeCertificate(_ context.Context, req *rap
return &emptypb.Empty{}, nil
}

var _ rapb.RegistrationAuthorityClient = (*dryRunRAC)(nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates line 16 above. Perhaps it was meant to apply to dryRunSAC?

Also the PR title says RAC but the PR description says SAC.


type dryRunSAC struct {
sapb.StorageAuthorityClient
log blog.Logger
Expand All @@ -35,3 +40,38 @@ func (d dryRunSAC) AddBlockedKey(_ context.Context, req *sapb.AddBlockedKeyReque
d.log.Infof("dry-run: Block SPKI hash %x by %s %s", req.KeyHash, req.Comment, req.Source)
return &emptypb.Empty{}, nil
}

func (d dryRunSAC) AddRateLimitOverride(_ context.Context, req *sapb.AddRateLimitOverrideRequest, _ ...grpc.CallOption) (*sapb.AddRateLimitOverrideResponse, error) {
b, err := prototext.Marshal(req)
if err != nil {
return nil, err
}
d.log.Infof("dry-run: %#v", string(b))
return &sapb.AddRateLimitOverrideResponse{
Inserted: true,
Enabled: true,
}, nil
}

func (d dryRunSAC) DisableRateLimitOverride(_ context.Context, req *sapb.DisableRateLimitOverrideRequest, _ ...grpc.CallOption) (*emptypb.Empty, error) {
b, err := prototext.Marshal(req)
if err != nil {
return nil, err
}
d.log.Infof("dry-run: %#v", string(b))
return &emptypb.Empty{}, nil
}

func (d dryRunSAC) EnableRateLimitOverride(_ context.Context, req *sapb.EnableRateLimitOverrideRequest, _ ...grpc.CallOption) (*emptypb.Empty, error) {
b, err := prototext.Marshal(req)
if err != nil {
return nil, err
}
d.log.Infof("dry-run: %#v", string(b))
return &emptypb.Empty{}, nil
}

func (d dryRunSAC) GetEnabledRateLimitOverrides(ctx context.Context, _ *emptypb.Empty, _ ...grpc.CallOption) (grpc.ServerStreamingClient[sapb.RateLimitOverrideResponse], error) {
d.log.Info("dry-run: GetEnabledRateLimitOverrides")
return nil, errors.New("dry-run mode is not enabled for dump-limit-overrides")
}