repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
letsencrypt/boulder
mocks/ca.go
IssuePrecertificate
func (ca *MockCA) IssuePrecertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (*caPB.IssuePrecertificateResponse, error) { if ca.PEM == nil { return nil, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate") } block, _ := pem.Decode(ca.PEM) cert, err := x509.ParseCertificate(b...
go
func (ca *MockCA) IssuePrecertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (*caPB.IssuePrecertificateResponse, error) { if ca.PEM == nil { return nil, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate") } block, _ := pem.Decode(ca.PEM) cert, err := x509.ParseCertificate(b...
[ "func", "(", "ca", "*", "MockCA", ")", "IssuePrecertificate", "(", "ctx", "context", ".", "Context", ",", "_", "*", "caPB", ".", "IssueCertificateRequest", ")", "(", "*", "caPB", ".", "IssuePrecertificateResponse", ",", "error", ")", "{", "if", "ca", ".", ...
// IssuePrecertificate is a mock
[ "IssuePrecertificate", "is", "a", "mock" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/ca.go#L37-L49
train
letsencrypt/boulder
mocks/ca.go
IssueCertificateForPrecertificate
func (ca *MockCA) IssueCertificateForPrecertificate(ctx context.Context, req *caPB.IssueCertificateForPrecertificateRequest) (core.Certificate, error) { return core.Certificate{DER: req.DER}, nil }
go
func (ca *MockCA) IssueCertificateForPrecertificate(ctx context.Context, req *caPB.IssueCertificateForPrecertificateRequest) (core.Certificate, error) { return core.Certificate{DER: req.DER}, nil }
[ "func", "(", "ca", "*", "MockCA", ")", "IssueCertificateForPrecertificate", "(", "ctx", "context", ".", "Context", ",", "req", "*", "caPB", ".", "IssueCertificateForPrecertificateRequest", ")", "(", "core", ".", "Certificate", ",", "error", ")", "{", "return", ...
// IssueCertificateForPrecertificate is a mock
[ "IssueCertificateForPrecertificate", "is", "a", "mock" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/ca.go#L52-L54
train
letsencrypt/boulder
mocks/ca.go
GenerateOCSP
func (ca *MockCA) GenerateOCSP(ctx context.Context, xferObj core.OCSPSigningRequest) (ocsp []byte, err error) { return }
go
func (ca *MockCA) GenerateOCSP(ctx context.Context, xferObj core.OCSPSigningRequest) (ocsp []byte, err error) { return }
[ "func", "(", "ca", "*", "MockCA", ")", "GenerateOCSP", "(", "ctx", "context", ".", "Context", ",", "xferObj", "core", ".", "OCSPSigningRequest", ")", "(", "ocsp", "[", "]", "byte", ",", "err", "error", ")", "{", "return", "\n", "}" ]
// GenerateOCSP is a mock
[ "GenerateOCSP", "is", "a", "mock" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/ca.go#L57-L59
train
letsencrypt/boulder
va/tlsalpn.go
tlsDial
func (va *ValidationAuthorityImpl) tlsDial(ctx context.Context, hostPort string, config *tls.Config) (*tls.Conn, error) { ctx, cancel := context.WithTimeout(ctx, va.singleDialTimeout) defer cancel() dialer := &net.Dialer{} netConn, err := dialer.DialContext(ctx, "tcp", hostPort) if err != nil { return nil, err ...
go
func (va *ValidationAuthorityImpl) tlsDial(ctx context.Context, hostPort string, config *tls.Config) (*tls.Conn, error) { ctx, cancel := context.WithTimeout(ctx, va.singleDialTimeout) defer cancel() dialer := &net.Dialer{} netConn, err := dialer.DialContext(ctx, "tcp", hostPort) if err != nil { return nil, err ...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "tlsDial", "(", "ctx", "context", ".", "Context", ",", "hostPort", "string", ",", "config", "*", "tls", ".", "Config", ")", "(", "*", "tls", ".", "Conn", ",", "error", ")", "{", "ctx", ",", "can...
// tlsDial does the equivalent of tls.Dial, but obeying a context. Once // tls.DialContextWithDialer is available, switch to that.
[ "tlsDial", "does", "the", "equivalent", "of", "tls", ".", "Dial", "but", "obeying", "a", "context", ".", "Once", "tls", ".", "DialContextWithDialer", "is", "available", "switch", "to", "that", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/tlsalpn.go#L154-L174
train
letsencrypt/boulder
va/va.go
NewValidationAuthorityImpl
func NewValidationAuthorityImpl( pc *cmd.PortConfig, resolver bdns.DNSClient, remoteVAs []RemoteVA, maxRemoteFailures int, userAgent string, issuerDomain string, stats metrics.Scope, clk clock.Clock, logger blog.Logger, accountURIPrefixes []string, ) (*ValidationAuthorityImpl, error) { if pc.HTTPPort == 0 { ...
go
func NewValidationAuthorityImpl( pc *cmd.PortConfig, resolver bdns.DNSClient, remoteVAs []RemoteVA, maxRemoteFailures int, userAgent string, issuerDomain string, stats metrics.Scope, clk clock.Clock, logger blog.Logger, accountURIPrefixes []string, ) (*ValidationAuthorityImpl, error) { if pc.HTTPPort == 0 { ...
[ "func", "NewValidationAuthorityImpl", "(", "pc", "*", "cmd", ".", "PortConfig", ",", "resolver", "bdns", ".", "DNSClient", ",", "remoteVAs", "[", "]", "RemoteVA", ",", "maxRemoteFailures", "int", ",", "userAgent", "string", ",", "issuerDomain", "string", ",", ...
// NewValidationAuthorityImpl constructs a new VA
[ "NewValidationAuthorityImpl", "constructs", "a", "new", "VA" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/va.go#L160-L206
train
letsencrypt/boulder
va/va.go
detailedError
func detailedError(err error) *probs.ProblemDetails { // net/http wraps net.OpError in a url.Error. Unwrap them. if urlErr, ok := err.(*url.Error); ok { prob := detailedError(urlErr.Err) prob.Detail = fmt.Sprintf("Fetching %s: %s", urlErr.URL, prob.Detail) return prob } if tlsErr, ok := err.(tls.RecordHeader...
go
func detailedError(err error) *probs.ProblemDetails { // net/http wraps net.OpError in a url.Error. Unwrap them. if urlErr, ok := err.(*url.Error); ok { prob := detailedError(urlErr.Err) prob.Detail = fmt.Sprintf("Fetching %s: %s", urlErr.URL, prob.Detail) return prob } if tlsErr, ok := err.(tls.RecordHeader...
[ "func", "detailedError", "(", "err", "error", ")", "*", "probs", ".", "ProblemDetails", "{", "// net/http wraps net.OpError in a url.Error. Unwrap them.", "if", "urlErr", ",", "ok", ":=", "err", ".", "(", "*", "url", ".", "Error", ")", ";", "ok", "{", "prob", ...
// detailedError returns a ProblemDetails corresponding to an error // that occurred during HTTP-01 or TLS-ALPN domain validation. Specifically it // tries to unwrap known Go error types and present something a little more // meaningful. It additionally handles `berrors.ConnectionFailure` errors by // passing through t...
[ "detailedError", "returns", "a", "ProblemDetails", "corresponding", "to", "an", "error", "that", "occurred", "during", "HTTP", "-", "01", "or", "TLS", "-", "ALPN", "domain", "validation", ".", "Specifically", "it", "tries", "to", "unwrap", "known", "Go", "erro...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/va.go#L223-L270
train
letsencrypt/boulder
va/va.go
validate
func (va *ValidationAuthorityImpl) validate( ctx context.Context, identifier core.AcmeIdentifier, challenge core.Challenge, authz core.Authorization, ) ([]core.ValidationRecord, *probs.ProblemDetails) { // If the identifier is a wildcard domain we need to validate the base // domain by removing the "*." wildcard...
go
func (va *ValidationAuthorityImpl) validate( ctx context.Context, identifier core.AcmeIdentifier, challenge core.Challenge, authz core.Authorization, ) ([]core.ValidationRecord, *probs.ProblemDetails) { // If the identifier is a wildcard domain we need to validate the base // domain by removing the "*." wildcard...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "validate", "(", "ctx", "context", ".", "Context", ",", "identifier", "core", ".", "AcmeIdentifier", ",", "challenge", "core", ".", "Challenge", ",", "authz", "core", ".", "Authorization", ",", ")", "("...
// validate performs a challenge validation and, in parallel, // checks CAA and GSB for the identifier. If any of those steps fails, it // returns a ProblemDetails plus the validation records created during the // validation attempt.
[ "validate", "performs", "a", "challenge", "validation", "and", "in", "parallel", "checks", "CAA", "and", "GSB", "for", "the", "identifier", ".", "If", "any", "of", "those", "steps", "fails", "it", "returns", "a", "ProblemDetails", "plus", "the", "validation", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/va.go#L276-L316
train
letsencrypt/boulder
va/va.go
processRemoteResults
func (va *ValidationAuthorityImpl) processRemoteResults( domain string, challengeType string, primaryResult *probs.ProblemDetails, remoteErrors chan *probs.ProblemDetails, numRemoteVAs int) *probs.ProblemDetails { state := "failure" start := va.clk.Now() defer func() { va.metrics.remoteValidationTime.With(p...
go
func (va *ValidationAuthorityImpl) processRemoteResults( domain string, challengeType string, primaryResult *probs.ProblemDetails, remoteErrors chan *probs.ProblemDetails, numRemoteVAs int) *probs.ProblemDetails { state := "failure" start := va.clk.Now() defer func() { va.metrics.remoteValidationTime.With(p...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "processRemoteResults", "(", "domain", "string", ",", "challengeType", "string", ",", "primaryResult", "*", "probs", ".", "ProblemDetails", ",", "remoteErrors", "chan", "*", "probs", ".", "ProblemDetails", ",...
// processRemoteResults evaluates a primary VA result, and a channel of remote // VA problems to produce a single overall validation result based on configured // feature flags. The overall result is calculated based on the VA's configured // `maxRemoteFailures` value. // // If the `MultiVAFullResults` feature is enabl...
[ "processRemoteResults", "evaluates", "a", "primary", "VA", "result", "and", "a", "channel", "of", "remote", "VA", "problems", "to", "produce", "a", "single", "overall", "validation", "result", "based", "on", "configured", "feature", "flags", ".", "The", "overall...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/va.go#L407-L482
train
letsencrypt/boulder
va/va.go
logRemoteValidationDifferentials
func (va *ValidationAuthorityImpl) logRemoteValidationDifferentials( domain string, primaryResult *probs.ProblemDetails, remoteProbs []*probs.ProblemDetails) { var successes []*probs.ProblemDetails var failures []*probs.ProblemDetails allEqual := true for _, e := range remoteProbs { if e != primaryResult { ...
go
func (va *ValidationAuthorityImpl) logRemoteValidationDifferentials( domain string, primaryResult *probs.ProblemDetails, remoteProbs []*probs.ProblemDetails) { var successes []*probs.ProblemDetails var failures []*probs.ProblemDetails allEqual := true for _, e := range remoteProbs { if e != primaryResult { ...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "logRemoteValidationDifferentials", "(", "domain", "string", ",", "primaryResult", "*", "probs", ".", "ProblemDetails", ",", "remoteProbs", "[", "]", "*", "probs", ".", "ProblemDetails", ")", "{", "var", "s...
// logRemoteValidationDifferentials is called by `processRemoteResults` when the // `MultiVAFullResults` feature flag is enabled. It produces a JSON log line // that contains the primary VA result and the results each remote VA returned.
[ "logRemoteValidationDifferentials", "is", "called", "by", "processRemoteResults", "when", "the", "MultiVAFullResults", "feature", "flag", "is", "enabled", ".", "It", "produces", "a", "JSON", "log", "line", "that", "contains", "the", "primary", "VA", "result", "and",...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/va.go#L487-L542
train
letsencrypt/boulder
errors/errors.go
New
func New(errType ErrorType, msg string, args ...interface{}) error { return &BoulderError{ Type: errType, Detail: fmt.Sprintf(msg, args...), } }
go
func New(errType ErrorType, msg string, args ...interface{}) error { return &BoulderError{ Type: errType, Detail: fmt.Sprintf(msg, args...), } }
[ "func", "New", "(", "errType", "ErrorType", ",", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "error", "{", "return", "&", "BoulderError", "{", "Type", ":", "errType", ",", "Detail", ":", "fmt", ".", "Sprintf", "(", "msg", ",", "a...
// New is a convenience function for creating a new BoulderError
[ "New", "is", "a", "convenience", "function", "for", "creating", "a", "new", "BoulderError" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/errors/errors.go#L36-L41
train
letsencrypt/boulder
errors/errors.go
Is
func Is(err error, errType ErrorType) bool { bErr, ok := err.(*BoulderError) if !ok { return false } return bErr.Type == errType }
go
func Is(err error, errType ErrorType) bool { bErr, ok := err.(*BoulderError) if !ok { return false } return bErr.Type == errType }
[ "func", "Is", "(", "err", "error", ",", "errType", "ErrorType", ")", "bool", "{", "bErr", ",", "ok", ":=", "err", ".", "(", "*", "BoulderError", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "return", "bErr", ".", "Type", "...
// Is is a convenience function for testing the internal type of an BoulderError
[ "Is", "is", "a", "convenience", "function", "for", "testing", "the", "internal", "type", "of", "an", "BoulderError" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/errors/errors.go#L44-L50
train
letsencrypt/boulder
reloader/reloader.go
New
func New(filename string, dataCallback func([]byte) error, errorCallback func(error)) (*Reloader, error) { if errorCallback == nil { errorCallback = func(e error) {} } fileInfo, err := os.Stat(filename) if err != nil { return nil, err } b, err := readFile(filename) if err != nil { return nil, err } stopC...
go
func New(filename string, dataCallback func([]byte) error, errorCallback func(error)) (*Reloader, error) { if errorCallback == nil { errorCallback = func(e error) {} } fileInfo, err := os.Stat(filename) if err != nil { return nil, err } b, err := readFile(filename) if err != nil { return nil, err } stopC...
[ "func", "New", "(", "filename", "string", ",", "dataCallback", "func", "(", "[", "]", "byte", ")", "error", ",", "errorCallback", "func", "(", "error", ")", ")", "(", "*", "Reloader", ",", "error", ")", "{", "if", "errorCallback", "==", "nil", "{", "...
// New loads the filename provided, and calls the callback. It then spawns a // goroutine to check for updates to that file, calling the callback again with // any new contents. The first load, and the first call to callback, are run // synchronously, so it is easy for the caller to check for errors and fail // fast. ...
[ "New", "loads", "the", "filename", "provided", "and", "calls", "the", "callback", ".", "It", "then", "spawns", "a", "goroutine", "to", "check", "for", "updates", "to", "that", "file", "calling", "the", "callback", "again", "with", "any", "new", "contents", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/reloader/reloader.go#L35-L84
train
letsencrypt/boulder
va/dns.go
availableAddresses
func availableAddresses(allAddrs []net.IP) (v4 []net.IP, v6 []net.IP) { for _, addr := range allAddrs { if addr.To4() != nil { v4 = append(v4, addr) } else { v6 = append(v6, addr) } } return }
go
func availableAddresses(allAddrs []net.IP) (v4 []net.IP, v6 []net.IP) { for _, addr := range allAddrs { if addr.To4() != nil { v4 = append(v4, addr) } else { v6 = append(v6, addr) } } return }
[ "func", "availableAddresses", "(", "allAddrs", "[", "]", "net", ".", "IP", ")", "(", "v4", "[", "]", "net", ".", "IP", ",", "v6", "[", "]", "net", ".", "IP", ")", "{", "for", "_", ",", "addr", ":=", "range", "allAddrs", "{", "if", "addr", ".", ...
// availableAddresses takes a ValidationRecord and splits the AddressesResolved // into a list of IPv4 and IPv6 addresses.
[ "availableAddresses", "takes", "a", "ValidationRecord", "and", "splits", "the", "AddressesResolved", "into", "a", "list", "of", "IPv4", "and", "IPv6", "addresses", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/dns.go#L35-L44
train
letsencrypt/boulder
cmd/boulder-wfe2/main.go
loadCertificateFile
func loadCertificateFile(aiaIssuerURL, certFile string) ([]byte, error) { pemBytes, err := ioutil.ReadFile(certFile) if err != nil { return nil, fmt.Errorf( "CertificateChain entry for AIA issuer url %q has an "+ "invalid chain file: %q - error reading contents: %s", aiaIssuerURL, certFile, err) } if by...
go
func loadCertificateFile(aiaIssuerURL, certFile string) ([]byte, error) { pemBytes, err := ioutil.ReadFile(certFile) if err != nil { return nil, fmt.Errorf( "CertificateChain entry for AIA issuer url %q has an "+ "invalid chain file: %q - error reading contents: %s", aiaIssuerURL, certFile, err) } if by...
[ "func", "loadCertificateFile", "(", "aiaIssuerURL", ",", "certFile", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pemBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "certFile", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// loadCertificateFile loads a PEM certificate from the certFile provided. It // validates that the PEM is well-formed with no leftover bytes, and contains // only a well-formed X509 certificate. If the cert file meets these // requirements the PEM bytes from the file are returned, otherwise an error is // returned. If...
[ "loadCertificateFile", "loads", "a", "PEM", "certificate", "from", "the", "certFile", "provided", ".", "It", "validates", "that", "the", "PEM", "is", "well", "-", "formed", "with", "no", "leftover", "bytes", "and", "contains", "only", "a", "well", "-", "form...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/boulder-wfe2/main.go#L88-L139
train
letsencrypt/boulder
cmd/boulder-wfe2/main.go
loadCertificateChains
func loadCertificateChains(chainConfig map[string][]string) (map[string][]byte, error) { results := make(map[string][]byte, len(chainConfig)) // For each AIA Issuer URL we need to read the chain cert files for aiaIssuerURL, certFiles := range chainConfig { var buffer bytes.Buffer // There must be at least one ...
go
func loadCertificateChains(chainConfig map[string][]string) (map[string][]byte, error) { results := make(map[string][]byte, len(chainConfig)) // For each AIA Issuer URL we need to read the chain cert files for aiaIssuerURL, certFiles := range chainConfig { var buffer bytes.Buffer // There must be at least one ...
[ "func", "loadCertificateChains", "(", "chainConfig", "map", "[", "string", "]", "[", "]", "string", ")", "(", "map", "[", "string", "]", "[", "]", "byte", ",", "error", ")", "{", "results", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "b...
// loadCertificateChains processes the provided chainConfig of AIA Issuer URLs // and cert filenames. For each AIA issuer URL all of its cert filenames are // read, validated as PEM certificates, and concatenated together separated by // newlines. The combined PEM certificate chain contents for each are returned // in ...
[ "loadCertificateChains", "processes", "the", "provided", "chainConfig", "of", "AIA", "Issuer", "URLs", "and", "cert", "filenames", ".", "For", "each", "AIA", "issuer", "URL", "all", "of", "its", "cert", "filenames", "are", "read", "validated", "as", "PEM", "ce...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/boulder-wfe2/main.go#L146-L181
train
letsencrypt/boulder
publisher/mock_publisher/mock_publisher.go
NewMockPublisher
func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher { mock := &MockPublisher{ctrl: ctrl} mock.recorder = &MockPublisherMockRecorder{mock} return mock }
go
func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher { mock := &MockPublisher{ctrl: ctrl} mock.recorder = &MockPublisherMockRecorder{mock} return mock }
[ "func", "NewMockPublisher", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockPublisher", "{", "mock", ":=", "&", "MockPublisher", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockPublisherMockRecorder", "{", "mock", ...
// NewMockPublisher creates a new mock instance
[ "NewMockPublisher", "creates", "a", "new", "mock", "instance" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/mock_publisher/mock_publisher.go#L26-L30
train
letsencrypt/boulder
publisher/mock_publisher/mock_publisher.go
SubmitToSingleCTWithResult
func (m *MockPublisher) SubmitToSingleCTWithResult(arg0 context.Context, arg1 *proto.Request) (*proto.Result, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SubmitToSingleCTWithResult", arg0, arg1) ret0, _ := ret[0].(*proto.Result) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockPublisher) SubmitToSingleCTWithResult(arg0 context.Context, arg1 *proto.Request) (*proto.Result, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SubmitToSingleCTWithResult", arg0, arg1) ret0, _ := ret[0].(*proto.Result) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockPublisher", ")", "SubmitToSingleCTWithResult", "(", "arg0", "context", ".", "Context", ",", "arg1", "*", "proto", ".", "Request", ")", "(", "*", "proto", ".", "Result", ",", "error", ")", "{", "m", ".", "ctrl", ".", "T", "...
// SubmitToSingleCTWithResult mocks base method
[ "SubmitToSingleCTWithResult", "mocks", "base", "method" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/mock_publisher/mock_publisher.go#L38-L44
train
letsencrypt/boulder
publisher/mock_publisher/mock_publisher.go
SubmitToSingleCTWithResult
func (mr *MockPublisherMockRecorder) SubmitToSingleCTWithResult(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitToSingleCTWithResult", reflect.TypeOf((*MockPublisher)(nil).SubmitToSingleCTWithResult), arg0, arg1) }
go
func (mr *MockPublisherMockRecorder) SubmitToSingleCTWithResult(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitToSingleCTWithResult", reflect.TypeOf((*MockPublisher)(nil).SubmitToSingleCTWithResult), arg0, arg1) }
[ "func", "(", "mr", "*", "MockPublisherMockRecorder", ")", "SubmitToSingleCTWithResult", "(", "arg0", ",", "arg1", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "mr", ".", "mock", ".", "ctrl", ".", "T", ".", "Helper", "(", ")", "\n", "ret...
// SubmitToSingleCTWithResult indicates an expected call of SubmitToSingleCTWithResult
[ "SubmitToSingleCTWithResult", "indicates", "an", "expected", "call", "of", "SubmitToSingleCTWithResult" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/mock_publisher/mock_publisher.go#L47-L50
train
letsencrypt/boulder
sa/sa.go
NewSQLStorageAuthority
func NewSQLStorageAuthority( dbMap *gorp.DbMap, clk clock.Clock, logger blog.Logger, scope metrics.Scope, parallelismPerRPC int, ) (*SQLStorageAuthority, error) { SetSQLDebug(dbMap, logger) ssa := &SQLStorageAuthority{ dbMap: dbMap, clk: clk, log: logger, parallel...
go
func NewSQLStorageAuthority( dbMap *gorp.DbMap, clk clock.Clock, logger blog.Logger, scope metrics.Scope, parallelismPerRPC int, ) (*SQLStorageAuthority, error) { SetSQLDebug(dbMap, logger) ssa := &SQLStorageAuthority{ dbMap: dbMap, clk: clk, log: logger, parallel...
[ "func", "NewSQLStorageAuthority", "(", "dbMap", "*", "gorp", ".", "DbMap", ",", "clk", "clock", ".", "Clock", ",", "logger", "blog", ".", "Logger", ",", "scope", "metrics", ".", "Scope", ",", "parallelismPerRPC", "int", ",", ")", "(", "*", "SQLStorageAutho...
// NewSQLStorageAuthority provides persistence using a SQL backend for // Boulder. It will modify the given gorp.DbMap by adding relevant tables.
[ "NewSQLStorageAuthority", "provides", "persistence", "using", "a", "SQL", "backend", "for", "Boulder", ".", "It", "will", "modify", "the", "given", "gorp", ".", "DbMap", "by", "adding", "relevant", "tables", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L93-L118
train
letsencrypt/boulder
sa/sa.go
GetRegistration
func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error) { const query = "WHERE id = ?" model, err := selectRegistration(ssa.dbMap.WithContext(ctx), query, id) if err == sql.ErrNoRows { return core.Registration{}, berrors.NotFoundError("registration with ID '%d' not...
go
func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error) { const query = "WHERE id = ?" model, err := selectRegistration(ssa.dbMap.WithContext(ctx), query, id) if err == sql.ErrNoRows { return core.Registration{}, berrors.NotFoundError("registration with ID '%d' not...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetRegistration", "(", "ctx", "context", ".", "Context", ",", "id", "int64", ")", "(", "core", ".", "Registration", ",", "error", ")", "{", "const", "query", "=", "\"", "\"", "\n", "model", ",", "er...
// GetRegistration obtains a Registration by ID
[ "GetRegistration", "obtains", "a", "Registration", "by", "ID" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L183-L193
train
letsencrypt/boulder
sa/sa.go
GetRegistrationByKey
func (ssa *SQLStorageAuthority) GetRegistrationByKey(ctx context.Context, key *jose.JSONWebKey) (core.Registration, error) { const query = "WHERE jwk_sha256 = ?" if key == nil { return core.Registration{}, fmt.Errorf("key argument to GetRegistrationByKey must not be nil") } sha, err := core.KeyDigest(key.Key) if...
go
func (ssa *SQLStorageAuthority) GetRegistrationByKey(ctx context.Context, key *jose.JSONWebKey) (core.Registration, error) { const query = "WHERE jwk_sha256 = ?" if key == nil { return core.Registration{}, fmt.Errorf("key argument to GetRegistrationByKey must not be nil") } sha, err := core.KeyDigest(key.Key) if...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetRegistrationByKey", "(", "ctx", "context", ".", "Context", ",", "key", "*", "jose", ".", "JSONWebKey", ")", "(", "core", ".", "Registration", ",", "error", ")", "{", "const", "query", "=", "\"", "\...
// GetRegistrationByKey obtains a Registration by JWK
[ "GetRegistrationByKey", "obtains", "a", "Registration", "by", "JWK" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L196-L214
train
letsencrypt/boulder
sa/sa.go
GetAuthorization
func (ssa *SQLStorageAuthority) GetAuthorization(ctx context.Context, id string) (core.Authorization, error) { authz := core.Authorization{} tx, err := ssa.dbMap.Begin() if err != nil { return authz, err } txWithCtx := tx.WithContext(ctx) pa, err := selectPendingAuthz(txWithCtx, "WHERE id = ?", id) if err != ...
go
func (ssa *SQLStorageAuthority) GetAuthorization(ctx context.Context, id string) (core.Authorization, error) { authz := core.Authorization{} tx, err := ssa.dbMap.Begin() if err != nil { return authz, err } txWithCtx := tx.WithContext(ctx) pa, err := selectPendingAuthz(txWithCtx, "WHERE id = ?", id) if err != ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetAuthorization", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "core", ".", "Authorization", ",", "error", ")", "{", "authz", ":=", "core", ".", "Authorization", "{", "}", "\...
// GetAuthorization obtains an Authorization by ID
[ "GetAuthorization", "obtains", "an", "Authorization", "by", "ID" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L217-L253
train
letsencrypt/boulder
sa/sa.go
GetValidAuthorizations
func (ssa *SQLStorageAuthority) GetValidAuthorizations( ctx context.Context, registrationID int64, names []string, now time.Time) (map[string]*core.Authorization, error) { return ssa.getAuthorizations( ctx, authorizationTable, string(core.StatusValid), registrationID, names, now, false) }
go
func (ssa *SQLStorageAuthority) GetValidAuthorizations( ctx context.Context, registrationID int64, names []string, now time.Time) (map[string]*core.Authorization, error) { return ssa.getAuthorizations( ctx, authorizationTable, string(core.StatusValid), registrationID, names, now, false) }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetValidAuthorizations", "(", "ctx", "context", ".", "Context", ",", "registrationID", "int64", ",", "names", "[", "]", "string", ",", "now", "time", ".", "Time", ")", "(", "map", "[", "string", "]", ...
// GetValidAuthorizations returns the latest authorization object for all // domain names from the parameters that the account has authorizations for.
[ "GetValidAuthorizations", "returns", "the", "latest", "authorization", "object", "for", "all", "domain", "names", "from", "the", "parameters", "that", "the", "account", "has", "authorizations", "for", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L257-L270
train
letsencrypt/boulder
sa/sa.go
incrementIP
func incrementIP(ip net.IP, index int) net.IP { bigInt := new(big.Int) bigInt.SetBytes([]byte(ip)) incr := new(big.Int).Lsh(big.NewInt(1), 128-uint(index)) bigInt.Add(bigInt, incr) // bigInt.Bytes can be shorter than 16 bytes, so stick it into a // full-sized net.IP. resultBytes := bigInt.Bytes() if len(resultB...
go
func incrementIP(ip net.IP, index int) net.IP { bigInt := new(big.Int) bigInt.SetBytes([]byte(ip)) incr := new(big.Int).Lsh(big.NewInt(1), 128-uint(index)) bigInt.Add(bigInt, incr) // bigInt.Bytes can be shorter than 16 bytes, so stick it into a // full-sized net.IP. resultBytes := bigInt.Bytes() if len(resultB...
[ "func", "incrementIP", "(", "ip", "net", ".", "IP", ",", "index", "int", ")", "net", ".", "IP", "{", "bigInt", ":=", "new", "(", "big", ".", "Int", ")", "\n", "bigInt", ".", "SetBytes", "(", "[", "]", "byte", "(", "ip", ")", ")", "\n", "incr", ...
// incrementIP returns a copy of `ip` incremented at a bit index `index`, // or in other words the first IP of the next highest subnet given a mask of // length `index`. // In order to easily account for overflow, we treat ip as a big.Int and add to // it. If the increment overflows the max size of a net.IP, return the...
[ "incrementIP", "returns", "a", "copy", "of", "ip", "incremented", "at", "a", "bit", "index", "index", "or", "in", "other", "words", "the", "first", "IP", "of", "the", "next", "highest", "subnet", "given", "a", "mask", "of", "length", "index", ".", "In", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L278-L292
train
letsencrypt/boulder
sa/sa.go
CountRegistrationsByIP
func (ssa *SQLStorageAuthority) CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest time.Time, latest time.Time) (int, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM registrations WHERE initialIP = :ip AND :earliest < createdAt AND creat...
go
func (ssa *SQLStorageAuthority) CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest time.Time, latest time.Time) (int, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM registrations WHERE initialIP = :ip AND :earliest < createdAt AND creat...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountRegistrationsByIP", "(", "ctx", "context", ".", "Context", ",", "ip", "net", ".", "IP", ",", "earliest", "time", ".", "Time", ",", "latest", "time", ".", "Time", ")", "(", "int", ",", "error", ...
// CountRegistrationsByIP returns the number of registrations created in the // time range for a single IP address.
[ "CountRegistrationsByIP", "returns", "the", "number", "of", "registrations", "created", "in", "the", "time", "range", "for", "a", "single", "IP", "address", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L320-L338
train
letsencrypt/boulder
sa/sa.go
CountCertificatesByNames
func (ssa *SQLStorageAuthority) CountCertificatesByNames(ctx context.Context, domains []string, earliest, latest time.Time) ([]*sapb.CountByNames_MapElement, error) { work := make(chan string, len(domains)) type result struct { err error count int domain string } results := make(chan result, len(domains))...
go
func (ssa *SQLStorageAuthority) CountCertificatesByNames(ctx context.Context, domains []string, earliest, latest time.Time) ([]*sapb.CountByNames_MapElement, error) { work := make(chan string, len(domains)) type result struct { err error count int domain string } results := make(chan result, len(domains))...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountCertificatesByNames", "(", "ctx", "context", ".", "Context", ",", "domains", "[", "]", "string", ",", "earliest", ",", "latest", "time", ".", "Time", ")", "(", "[", "]", "*", "sapb", ".", "CountB...
// CountCertificatesByNames counts, for each input domain, the number of // certificates issued in the given time range for that domain and its // subdomains. It returns a map from domains to counts, which is guaranteed to // contain an entry for each input domain, so long as err is nil. // Queries will be run in paral...
[ "CountCertificatesByNames", "counts", "for", "each", "input", "domain", "the", "number", "of", "certificates", "issued", "in", "the", "given", "time", "range", "for", "that", "domain", "and", "its", "subdomains", ".", "It", "returns", "a", "map", "from", "doma...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L373-L432
train
letsencrypt/boulder
sa/sa.go
countCertificatesByNameImpl
func (ssa *SQLStorageAuthority) countCertificatesByNameImpl( db dbSelector, domain string, earliest, latest time.Time, ) (int, error) { return ssa.countCertificates(db, domain, earliest, latest, countCertificatesSelect) }
go
func (ssa *SQLStorageAuthority) countCertificatesByNameImpl( db dbSelector, domain string, earliest, latest time.Time, ) (int, error) { return ssa.countCertificates(db, domain, earliest, latest, countCertificatesSelect) }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "countCertificatesByNameImpl", "(", "db", "dbSelector", ",", "domain", "string", ",", "earliest", ",", "latest", "time", ".", "Time", ",", ")", "(", "int", ",", "error", ")", "{", "return", "ssa", ".", ...
// countCertificatesByNames returns, for a single domain, the count of // certificates issued in the given time range for that domain and its // subdomains.
[ "countCertificatesByNames", "returns", "for", "a", "single", "domain", "the", "count", "of", "certificates", "issued", "in", "the", "given", "time", "range", "for", "that", "domain", "and", "its", "subdomains", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L474-L481
train
letsencrypt/boulder
sa/sa.go
countCertificatesByExactNameImpl
func (ssa *SQLStorageAuthority) countCertificatesByExactNameImpl( db dbSelector, domain string, earliest, latest time.Time, ) (int, error) { return ssa.countCertificates(db, domain, earliest, latest, countCertificatesExactSelect) }
go
func (ssa *SQLStorageAuthority) countCertificatesByExactNameImpl( db dbSelector, domain string, earliest, latest time.Time, ) (int, error) { return ssa.countCertificates(db, domain, earliest, latest, countCertificatesExactSelect) }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "countCertificatesByExactNameImpl", "(", "db", "dbSelector", ",", "domain", "string", ",", "earliest", ",", "latest", "time", ".", "Time", ",", ")", "(", "int", ",", "error", ")", "{", "return", "ssa", "...
// countCertificatesByExactNames returns, for a single domain, the count of // certificates issued in the given time range for that domain. In contrast to // countCertificatesByNames subdomains are NOT considered.
[ "countCertificatesByExactNames", "returns", "for", "a", "single", "domain", "the", "count", "of", "certificates", "issued", "in", "the", "given", "time", "range", "for", "that", "domain", ".", "In", "contrast", "to", "countCertificatesByNames", "subdomains", "are", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L486-L493
train
letsencrypt/boulder
sa/sa.go
countCertificates
func (ssa *SQLStorageAuthority) countCertificates(db dbSelector, domain string, earliest, latest time.Time, query string) (int, error) { var serials []string _, err := db.Select( &serials, query, map[string]interface{}{ "reversedDomain": ReverseName(domain), "earliest": earliest, "latest": ...
go
func (ssa *SQLStorageAuthority) countCertificates(db dbSelector, domain string, earliest, latest time.Time, query string) (int, error) { var serials []string _, err := db.Select( &serials, query, map[string]interface{}{ "reversedDomain": ReverseName(domain), "earliest": earliest, "latest": ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "countCertificates", "(", "db", "dbSelector", ",", "domain", "string", ",", "earliest", ",", "latest", "time", ".", "Time", ",", "query", "string", ")", "(", "int", ",", "error", ")", "{", "var", "seri...
// countCertificates returns, for a single domain, the count of certificate // issuances in the given time range for that domain using the // provided query assumed to be either `countCertificatesExactSelect`, // or `countCertificatesSelect`.
[ "countCertificates", "returns", "for", "a", "single", "domain", "the", "count", "of", "certificate", "issuances", "in", "the", "given", "time", "range", "for", "that", "domain", "using", "the", "provided", "query", "assumed", "to", "be", "either", "countCertific...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L499-L521
train
letsencrypt/boulder
sa/sa.go
GetCertificate
func (ssa *SQLStorageAuthority) GetCertificate(ctx context.Context, serial string) (core.Certificate, error) { if !core.ValidSerial(serial) { err := fmt.Errorf("Invalid certificate serial %s", serial) return core.Certificate{}, err } cert, err := SelectCertificate(ssa.dbMap.WithContext(ctx), "WHERE serial = ?",...
go
func (ssa *SQLStorageAuthority) GetCertificate(ctx context.Context, serial string) (core.Certificate, error) { if !core.ValidSerial(serial) { err := fmt.Errorf("Invalid certificate serial %s", serial) return core.Certificate{}, err } cert, err := SelectCertificate(ssa.dbMap.WithContext(ctx), "WHERE serial = ?",...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetCertificate", "(", "ctx", "context", ".", "Context", ",", "serial", "string", ")", "(", "core", ".", "Certificate", ",", "error", ")", "{", "if", "!", "core", ".", "ValidSerial", "(", "serial", ")"...
// GetCertificate takes a serial number and returns the corresponding // certificate, or error if it does not exist.
[ "GetCertificate", "takes", "a", "serial", "number", "and", "returns", "the", "corresponding", "certificate", "or", "error", "if", "it", "does", "not", "exist", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L525-L539
train
letsencrypt/boulder
sa/sa.go
GetCertificateStatus
func (ssa *SQLStorageAuthority) GetCertificateStatus(ctx context.Context, serial string) (core.CertificateStatus, error) { if !core.ValidSerial(serial) { err := fmt.Errorf("Invalid certificate serial %s", serial) return core.CertificateStatus{}, err } var status core.CertificateStatus statusObj, err := ssa.dbM...
go
func (ssa *SQLStorageAuthority) GetCertificateStatus(ctx context.Context, serial string) (core.CertificateStatus, error) { if !core.ValidSerial(serial) { err := fmt.Errorf("Invalid certificate serial %s", serial) return core.CertificateStatus{}, err } var status core.CertificateStatus statusObj, err := ssa.dbM...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetCertificateStatus", "(", "ctx", "context", ".", "Context", ",", "serial", "string", ")", "(", "core", ".", "CertificateStatus", ",", "error", ")", "{", "if", "!", "core", ".", "ValidSerial", "(", "se...
// GetCertificateStatus takes a hexadecimal string representing the full 128-bit serial // number of a certificate and returns data about that certificate's current // validity.
[ "GetCertificateStatus", "takes", "a", "hexadecimal", "string", "representing", "the", "full", "128", "-", "bit", "serial", "number", "of", "a", "certificate", "and", "returns", "data", "about", "that", "certificate", "s", "current", "validity", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L544-L572
train
letsencrypt/boulder
sa/sa.go
NewRegistration
func (ssa *SQLStorageAuthority) NewRegistration(ctx context.Context, reg core.Registration) (core.Registration, error) { reg.CreatedAt = ssa.clk.Now() rm, err := registrationToModel(&reg) if err != nil { return reg, err } err = ssa.dbMap.WithContext(ctx).Insert(rm) if err != nil { return reg, err } return m...
go
func (ssa *SQLStorageAuthority) NewRegistration(ctx context.Context, reg core.Registration) (core.Registration, error) { reg.CreatedAt = ssa.clk.Now() rm, err := registrationToModel(&reg) if err != nil { return reg, err } err = ssa.dbMap.WithContext(ctx).Insert(rm) if err != nil { return reg, err } return m...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "NewRegistration", "(", "ctx", "context", ".", "Context", ",", "reg", "core", ".", "Registration", ")", "(", "core", ".", "Registration", ",", "error", ")", "{", "reg", ".", "CreatedAt", "=", "ssa", "....
// NewRegistration stores a new Registration
[ "NewRegistration", "stores", "a", "new", "Registration" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L575-L586
train
letsencrypt/boulder
sa/sa.go
UpdateRegistration
func (ssa *SQLStorageAuthority) UpdateRegistration(ctx context.Context, reg core.Registration) error { const query = "WHERE id = ?" model, err := selectRegistration(ssa.dbMap.WithContext(ctx), query, reg.ID) if err == sql.ErrNoRows { return berrors.NotFoundError("registration with ID '%d' not found", reg.ID) } ...
go
func (ssa *SQLStorageAuthority) UpdateRegistration(ctx context.Context, reg core.Registration) error { const query = "WHERE id = ?" model, err := selectRegistration(ssa.dbMap.WithContext(ctx), query, reg.ID) if err == sql.ErrNoRows { return berrors.NotFoundError("registration with ID '%d' not found", reg.ID) } ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "UpdateRegistration", "(", "ctx", "context", ".", "Context", ",", "reg", "core", ".", "Registration", ")", "error", "{", "const", "query", "=", "\"", "\"", "\n", "model", ",", "err", ":=", "selectRegistr...
// UpdateRegistration stores an updated Registration
[ "UpdateRegistration", "stores", "an", "updated", "Registration" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L641-L665
train
letsencrypt/boulder
sa/sa.go
NewPendingAuthorization
func (ssa *SQLStorageAuthority) NewPendingAuthorization(ctx context.Context, authz core.Authorization) (core.Authorization, error) { var output core.Authorization tx, err := ssa.dbMap.Begin() if err != nil { return output, err } txWithCtx := tx.WithContext(ctx) // Create a random ID and check that it doesn't ...
go
func (ssa *SQLStorageAuthority) NewPendingAuthorization(ctx context.Context, authz core.Authorization) (core.Authorization, error) { var output core.Authorization tx, err := ssa.dbMap.Begin() if err != nil { return output, err } txWithCtx := tx.WithContext(ctx) // Create a random ID and check that it doesn't ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "NewPendingAuthorization", "(", "ctx", "context", ".", "Context", ",", "authz", "core", ".", "Authorization", ")", "(", "core", ".", "Authorization", ",", "error", ")", "{", "var", "output", "core", ".", ...
// NewPendingAuthorization retrieves a pending authorization for // authz.Identifier if one exists, or creates a new one otherwise.
[ "NewPendingAuthorization", "retrieves", "a", "pending", "authorization", "for", "authz", ".", "Identifier", "if", "one", "exists", "or", "creates", "a", "new", "one", "otherwise", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L669-L721
train
letsencrypt/boulder
sa/sa.go
GetPendingAuthorization
func (ssa *SQLStorageAuthority) GetPendingAuthorization( ctx context.Context, req *sapb.GetPendingAuthorizationRequest, ) (*core.Authorization, error) { identifierJSON, err := json.Marshal(core.AcmeIdentifier{ Type: core.IdentifierType(*req.IdentifierType), Value: *req.IdentifierValue, }) if err != nil { re...
go
func (ssa *SQLStorageAuthority) GetPendingAuthorization( ctx context.Context, req *sapb.GetPendingAuthorizationRequest, ) (*core.Authorization, error) { identifierJSON, err := json.Marshal(core.AcmeIdentifier{ Type: core.IdentifierType(*req.IdentifierType), Value: *req.IdentifierValue, }) if err != nil { re...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetPendingAuthorization", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetPendingAuthorizationRequest", ",", ")", "(", "*", "core", ".", "Authorization", ",", "error", ")", "{", "...
// GetPendingAuthorization returns the most recent Pending authorization // with the given identifier, if available.
[ "GetPendingAuthorization", "returns", "the", "most", "recent", "Pending", "authorization", "with", "the", "given", "identifier", "if", "available", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L725-L766
train
letsencrypt/boulder
sa/sa.go
FinalizeAuthorization
func (ssa *SQLStorageAuthority) FinalizeAuthorization(ctx context.Context, authz core.Authorization) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) // Check that a pending authz exists if !existingPending(txWithCtx, authz.ID) { err = berrors.NotFoundError("...
go
func (ssa *SQLStorageAuthority) FinalizeAuthorization(ctx context.Context, authz core.Authorization) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) // Check that a pending authz exists if !existingPending(txWithCtx, authz.ID) { err = berrors.NotFoundError("...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "FinalizeAuthorization", "(", "ctx", "context", ".", "Context", ",", "authz", "core", ".", "Authorization", ")", "error", "{", "tx", ",", "err", ":=", "ssa", ".", "dbMap", ".", "Begin", "(", ")", "\n",...
// FinalizeAuthorization converts a Pending Authorization to a final one. If the // Authorization is not found a berrors.NotFound result is returned. If the // Authorization is status pending a berrors.InternalServer error is returned.
[ "FinalizeAuthorization", "converts", "a", "Pending", "Authorization", "to", "a", "final", "one", ".", "If", "the", "Authorization", "is", "not", "found", "a", "berrors", ".", "NotFound", "result", "is", "returned", ".", "If", "the", "Authorization", "is", "sta...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L771-L813
train
letsencrypt/boulder
sa/sa.go
RevokeAuthorizationsByDomain
func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain(ctx context.Context, ident core.AcmeIdentifier) (int64, int64, error) { identifierJSON, err := json.Marshal(ident) if err != nil { return 0, 0, err } identifier := string(identifierJSON) results := []int64{0, 0} now := ssa.clk.Now() for i, table := ...
go
func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain(ctx context.Context, ident core.AcmeIdentifier) (int64, int64, error) { identifierJSON, err := json.Marshal(ident) if err != nil { return 0, 0, err } identifier := string(identifierJSON) results := []int64{0, 0} now := ssa.clk.Now() for i, table := ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "RevokeAuthorizationsByDomain", "(", "ctx", "context", ".", "Context", ",", "ident", "core", ".", "AcmeIdentifier", ")", "(", "int64", ",", "int64", ",", "error", ")", "{", "identifierJSON", ",", "err", ":...
// RevokeAuthorizationsByDomain invalidates all pending or finalized authorizations // for a specific domain
[ "RevokeAuthorizationsByDomain", "invalidates", "all", "pending", "or", "finalized", "authorizations", "for", "a", "specific", "domain" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L817-L849
train
letsencrypt/boulder
sa/sa.go
RevokeAuthorizationsByDomain2
func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain2(ctx context.Context, req *sapb.RevokeAuthorizationsByDomainRequest) (*corepb.Empty, error) { finalRevoked, pendingRevoked, err := ssa.RevokeAuthorizationsByDomain( ctx, core.AcmeIdentifier{ Type: core.IdentifierDNS, Value: *req.Domain, }) if e...
go
func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain2(ctx context.Context, req *sapb.RevokeAuthorizationsByDomainRequest) (*corepb.Empty, error) { finalRevoked, pendingRevoked, err := ssa.RevokeAuthorizationsByDomain( ctx, core.AcmeIdentifier{ Type: core.IdentifierDNS, Value: *req.Domain, }) if e...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "RevokeAuthorizationsByDomain2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "RevokeAuthorizationsByDomainRequest", ")", "(", "*", "corepb", ".", "Empty", ",", "error", ")", "{", "fi...
// RevokeAuthorizationsByDomain2 invalidates all pending or valid authorizations for a // specific domain. This method is intended to deprecate RevokeAuthorizationsByDomain.
[ "RevokeAuthorizationsByDomain2", "invalidates", "all", "pending", "or", "valid", "authorizations", "for", "a", "specific", "domain", ".", "This", "method", "is", "intended", "to", "deprecate", "RevokeAuthorizationsByDomain", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L886-L923
train
letsencrypt/boulder
sa/sa.go
AddCertificate
func (ssa *SQLStorageAuthority) AddCertificate( ctx context.Context, certDER []byte, regID int64, ocspResponse []byte, issued *time.Time) (string, error) { parsedCertificate, err := x509.ParseCertificate(certDER) if err != nil { return "", err } digest := core.Fingerprint256(certDER) serial := core.SerialTo...
go
func (ssa *SQLStorageAuthority) AddCertificate( ctx context.Context, certDER []byte, regID int64, ocspResponse []byte, issued *time.Time) (string, error) { parsedCertificate, err := x509.ParseCertificate(certDER) if err != nil { return "", err } digest := core.Fingerprint256(certDER) serial := core.SerialTo...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "AddCertificate", "(", "ctx", "context", ".", "Context", ",", "certDER", "[", "]", "byte", ",", "regID", "int64", ",", "ocspResponse", "[", "]", "byte", ",", "issued", "*", "time", ".", "Time", ")", ...
// AddCertificate stores an issued certificate and returns the digest as // a string, or an error if any occurred.
[ "AddCertificate", "stores", "an", "issued", "certificate", "and", "returns", "the", "digest", "as", "a", "string", "or", "an", "error", "if", "any", "occurred", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L927-L1028
train
letsencrypt/boulder
sa/sa.go
CountPendingAuthorizations
func (ssa *SQLStorageAuthority) CountPendingAuthorizations(ctx context.Context, regID int64) (count int, err error) { err = ssa.dbMap.WithContext(ctx).SelectOne(&count, `SELECT count(1) FROM pendingAuthorizations WHERE registrationID = :regID AND expires > :now AND status = :pending`, map[string]interface{}{...
go
func (ssa *SQLStorageAuthority) CountPendingAuthorizations(ctx context.Context, regID int64) (count int, err error) { err = ssa.dbMap.WithContext(ctx).SelectOne(&count, `SELECT count(1) FROM pendingAuthorizations WHERE registrationID = :regID AND expires > :now AND status = :pending`, map[string]interface{}{...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountPendingAuthorizations", "(", "ctx", "context", ".", "Context", ",", "regID", "int64", ")", "(", "count", "int", ",", "err", "error", ")", "{", "err", "=", "ssa", ".", "dbMap", ".", "WithContext", ...
// CountPendingAuthorizations returns the number of pending, unexpired // authorizations for the given registration.
[ "CountPendingAuthorizations", "returns", "the", "number", "of", "pending", "unexpired", "authorizations", "for", "the", "given", "registration", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1032-L1044
train
letsencrypt/boulder
sa/sa.go
CountInvalidAuthorizations
func (ssa *SQLStorageAuthority) CountInvalidAuthorizations( ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest, ) (count *sapb.Count, err error) { identifier := core.AcmeIdentifier{ Type: core.IdentifierDNS, Value: *req.Hostname, } idJSON, err := json.Marshal(identifier) if err != nil { retu...
go
func (ssa *SQLStorageAuthority) CountInvalidAuthorizations( ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest, ) (count *sapb.Count, err error) { identifier := core.AcmeIdentifier{ Type: core.IdentifierDNS, Value: *req.Hostname, } idJSON, err := json.Marshal(identifier) if err != nil { retu...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountInvalidAuthorizations", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "CountInvalidAuthorizationsRequest", ",", ")", "(", "count", "*", "sapb", ".", "Count", ",", "err", "error",...
// CountInvalidAuthorizations counts invalid authorizations for a user expiring // in a given time range. // authorizations for the give registration.
[ "CountInvalidAuthorizations", "counts", "invalid", "authorizations", "for", "a", "user", "expiring", "in", "a", "given", "time", "range", ".", "authorizations", "for", "the", "give", "registration", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1067-L1099
train
letsencrypt/boulder
sa/sa.go
addOrderFQDNSet
func addOrderFQDNSet( db dbInserter, names []string, orderID int64, regID int64, expires time.Time) error { return db.Insert(&orderFQDNSet{ SetHash: hashNames(names), OrderID: orderID, RegistrationID: regID, Expires: expires, }) }
go
func addOrderFQDNSet( db dbInserter, names []string, orderID int64, regID int64, expires time.Time) error { return db.Insert(&orderFQDNSet{ SetHash: hashNames(names), OrderID: orderID, RegistrationID: regID, Expires: expires, }) }
[ "func", "addOrderFQDNSet", "(", "db", "dbInserter", ",", "names", "[", "]", "string", ",", "orderID", "int64", ",", "regID", "int64", ",", "expires", "time", ".", "Time", ")", "error", "{", "return", "db", ".", "Insert", "(", "&", "orderFQDNSet", "{", ...
// addOrderFQDNSet creates a new OrderFQDNSet row using the provided // information. This function accepts a transaction so that the orderFqdnSet // addition can take place within the order addition transaction. The caller is // required to rollback the transaction if an error is returned.
[ "addOrderFQDNSet", "creates", "a", "new", "OrderFQDNSet", "row", "using", "the", "provided", "information", ".", "This", "function", "accepts", "a", "transaction", "so", "that", "the", "orderFqdnSet", "addition", "can", "take", "place", "within", "the", "order", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1120-L1132
train
letsencrypt/boulder
sa/sa.go
deleteOrderFQDNSet
func deleteOrderFQDNSet( db dbExecer, orderID int64) error { result, err := db.Exec(` DELETE FROM orderFqdnSets WHERE orderID = ?`, orderID) if err != nil { return err } rowsDeleted, err := result.RowsAffected() if err != nil { return err } // We always expect there to be an order FQDN set row for ...
go
func deleteOrderFQDNSet( db dbExecer, orderID int64) error { result, err := db.Exec(` DELETE FROM orderFqdnSets WHERE orderID = ?`, orderID) if err != nil { return err } rowsDeleted, err := result.RowsAffected() if err != nil { return err } // We always expect there to be an order FQDN set row for ...
[ "func", "deleteOrderFQDNSet", "(", "db", "dbExecer", ",", "orderID", "int64", ")", "error", "{", "result", ",", "err", ":=", "db", ".", "Exec", "(", "`\n\t DELETE FROM orderFqdnSets\n\t\tWHERE orderID = ?`", ",", "orderID", ")", "\n", "if", "err", "!=", "nil", ...
// deleteOrderFQDNSet deletes a OrderFQDNSet row that matches the provided // orderID. This function accepts a transaction so that the deletion can // take place within the finalization transaction. The caller is required to // rollback the transaction if an error is returned.
[ "deleteOrderFQDNSet", "deletes", "a", "OrderFQDNSet", "row", "that", "matches", "the", "provided", "orderID", ".", "This", "function", "accepts", "a", "transaction", "so", "that", "the", "deletion", "can", "take", "place", "within", "the", "finalization", "transac...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1138-L1160
train
letsencrypt/boulder
sa/sa.go
CountFQDNSets
func (ssa *SQLStorageAuthority) CountFQDNSets(ctx context.Context, window time.Duration, names []string) (int64, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM fqdnSets WHERE setHash = ? AND issued > ?`, hashNames(names), ssa.clk.Now().Add(-window), ) ...
go
func (ssa *SQLStorageAuthority) CountFQDNSets(ctx context.Context, window time.Duration, names []string) (int64, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM fqdnSets WHERE setHash = ? AND issued > ?`, hashNames(names), ssa.clk.Now().Add(-window), ) ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountFQDNSets", "(", "ctx", "context", ".", "Context", ",", "window", "time", ".", "Duration", ",", "names", "[", "]", "string", ")", "(", "int64", ",", "error", ")", "{", "var", "count", "int64", "...
// CountFQDNSets returns the number of sets with hash |setHash| within the window // |window|
[ "CountFQDNSets", "returns", "the", "number", "of", "sets", "with", "hash", "|setHash|", "within", "the", "window", "|window|" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1180-L1191
train
letsencrypt/boulder
sa/sa.go
getFQDNSetsBySerials
func (ssa *SQLStorageAuthority) getFQDNSetsBySerials( db dbSelector, serials []string, ) ([]setHash, error) { var fqdnSets []setHash // It is unexpected that this function would be called with no serials if len(serials) == 0 { err := fmt.Errorf("getFQDNSetsBySerials called with no serials") ssa.log.AuditErr(e...
go
func (ssa *SQLStorageAuthority) getFQDNSetsBySerials( db dbSelector, serials []string, ) ([]setHash, error) { var fqdnSets []setHash // It is unexpected that this function would be called with no serials if len(serials) == 0 { err := fmt.Errorf("getFQDNSetsBySerials called with no serials") ssa.log.AuditErr(e...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "getFQDNSetsBySerials", "(", "db", "dbSelector", ",", "serials", "[", "]", "string", ",", ")", "(", "[", "]", "setHash", ",", "error", ")", "{", "var", "fqdnSets", "[", "]", "setHash", "\n\n", "// It i...
// getFQDNSetsBySerials finds the setHashes corresponding to a set of // certificate serials. These serials can be used to check whether any // certificates have been issued for the same set of names previously.
[ "getFQDNSetsBySerials", "finds", "the", "setHashes", "corresponding", "to", "a", "set", "of", "certificate", "serials", ".", "These", "serials", "can", "be", "used", "to", "check", "whether", "any", "certificates", "have", "been", "issued", "for", "the", "same",...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1199-L1238
train
letsencrypt/boulder
sa/sa.go
FQDNSetExists
func (ssa *SQLStorageAuthority) FQDNSetExists(ctx context.Context, names []string) (bool, error) { exists, err := ssa.checkFQDNSetExists( ssa.dbMap.WithContext(ctx).SelectOne, names) if err != nil { return false, err } return exists, nil }
go
func (ssa *SQLStorageAuthority) FQDNSetExists(ctx context.Context, names []string) (bool, error) { exists, err := ssa.checkFQDNSetExists( ssa.dbMap.WithContext(ctx).SelectOne, names) if err != nil { return false, err } return exists, nil }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "FQDNSetExists", "(", "ctx", "context", ".", "Context", ",", "names", "[", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "exists", ",", "err", ":=", "ssa", ".", "checkFQDNSetExists", "(", ...
// FQDNSetExists returns a bool indicating if one or more FQDN sets |names| // exists in the database
[ "FQDNSetExists", "returns", "a", "bool", "indicating", "if", "one", "or", "more", "FQDN", "sets", "|names|", "exists", "in", "the", "database" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1312-L1320
train
letsencrypt/boulder
sa/sa.go
checkFQDNSetExists
func (ssa *SQLStorageAuthority) checkFQDNSetExists(selector oneSelectorFunc, names []string) (bool, error) { var count int64 err := selector( &count, `SELECT COUNT(1) FROM fqdnSets WHERE setHash = ? LIMIT 1`, hashNames(names), ) return count > 0, err }
go
func (ssa *SQLStorageAuthority) checkFQDNSetExists(selector oneSelectorFunc, names []string) (bool, error) { var count int64 err := selector( &count, `SELECT COUNT(1) FROM fqdnSets WHERE setHash = ? LIMIT 1`, hashNames(names), ) return count > 0, err }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "checkFQDNSetExists", "(", "selector", "oneSelectorFunc", ",", "names", "[", "]", "string", ")", "(", "bool", ",", "error", ")", "{", "var", "count", "int64", "\n", "err", ":=", "selector", "(", "&", "...
// checkFQDNSetExists uses the given oneSelectorFunc to check whether an fqdnSet // for the given names exists.
[ "checkFQDNSetExists", "uses", "the", "given", "oneSelectorFunc", "to", "check", "whether", "an", "fqdnSet", "for", "the", "given", "names", "exists", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1328-L1338
train
letsencrypt/boulder
sa/sa.go
DeactivateRegistration
func (ssa *SQLStorageAuthority) DeactivateRegistration(ctx context.Context, id int64) error { _, err := ssa.dbMap.WithContext(ctx).Exec( "UPDATE registrations SET status = ? WHERE status = ? AND id = ?", string(core.StatusDeactivated), string(core.StatusValid), id, ) return err }
go
func (ssa *SQLStorageAuthority) DeactivateRegistration(ctx context.Context, id int64) error { _, err := ssa.dbMap.WithContext(ctx).Exec( "UPDATE registrations SET status = ? WHERE status = ? AND id = ?", string(core.StatusDeactivated), string(core.StatusValid), id, ) return err }
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "DeactivateRegistration", "(", "ctx", "context", ".", "Context", ",", "id", "int64", ")", "error", "{", "_", ",", "err", ":=", "ssa", ".", "dbMap", ".", "WithContext", "(", "ctx", ")", ".", "Exec", "...
// DeactivateRegistration deactivates a currently valid registration
[ "DeactivateRegistration", "deactivates", "a", "currently", "valid", "registration" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1399-L1407
train
letsencrypt/boulder
sa/sa.go
DeactivateAuthorization
func (ssa *SQLStorageAuthority) DeactivateAuthorization(ctx context.Context, id string) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) if existingPending(txWithCtx, id) { authzObj, err := txWithCtx.Get(&pendingauthzModel{}, id) if err != nil { return Ro...
go
func (ssa *SQLStorageAuthority) DeactivateAuthorization(ctx context.Context, id string) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) if existingPending(txWithCtx, id) { authzObj, err := txWithCtx.Get(&pendingauthzModel{}, id) if err != nil { return Ro...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "DeactivateAuthorization", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "tx", ",", "err", ":=", "ssa", ".", "dbMap", ".", "Begin", "(", ")", "\n", "if", "err", "!=",...
// DeactivateAuthorization deactivates a currently valid or pending authorization
[ "DeactivateAuthorization", "deactivates", "a", "currently", "valid", "or", "pending", "authorization" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1410-L1455
train
letsencrypt/boulder
sa/sa.go
DeactivateAuthorization2
func (ssa *SQLStorageAuthority) DeactivateAuthorization2(ctx context.Context, req *sapb.AuthorizationID2) (*corepb.Empty, error) { _, err := ssa.dbMap.Exec( `UPDATE authz2 SET status = :deactivated WHERE id = :id and status IN (:valid,:pending)`, map[string]interface{}{ "deactivated": statusUint(core.StatusDeac...
go
func (ssa *SQLStorageAuthority) DeactivateAuthorization2(ctx context.Context, req *sapb.AuthorizationID2) (*corepb.Empty, error) { _, err := ssa.dbMap.Exec( `UPDATE authz2 SET status = :deactivated WHERE id = :id and status IN (:valid,:pending)`, map[string]interface{}{ "deactivated": statusUint(core.StatusDeac...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "DeactivateAuthorization2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "AuthorizationID2", ")", "(", "*", "corepb", ".", "Empty", ",", "error", ")", "{", "_", ",", "err", ":="...
// DeactivateAuthorization2 deactivates a currently valid or pending authorization. // This method is intended to deprecate DeactivateAuthorization.
[ "DeactivateAuthorization2", "deactivates", "a", "currently", "valid", "or", "pending", "authorization", ".", "This", "method", "is", "intended", "to", "deprecate", "DeactivateAuthorization", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1459-L1473
train
letsencrypt/boulder
sa/sa.go
NewOrder
func (ssa *SQLStorageAuthority) NewOrder(ctx context.Context, req *corepb.Order) (*corepb.Order, error) { order := &orderModel{ RegistrationID: *req.RegistrationID, Expires: time.Unix(0, *req.Expires), Created: ssa.clk.Now(), } tx, err := ssa.dbMap.Begin() if err != nil { return nil, err } ...
go
func (ssa *SQLStorageAuthority) NewOrder(ctx context.Context, req *corepb.Order) (*corepb.Order, error) { order := &orderModel{ RegistrationID: *req.RegistrationID, Expires: time.Unix(0, *req.Expires), Created: ssa.clk.Now(), } tx, err := ssa.dbMap.Begin() if err != nil { return nil, err } ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "NewOrder", "(", "ctx", "context", ".", "Context", ",", "req", "*", "corepb", ".", "Order", ")", "(", "*", "corepb", ".", "Order", ",", "error", ")", "{", "order", ":=", "&", "orderModel", "{", "Re...
// NewOrder adds a new v2 style order to the database
[ "NewOrder", "adds", "a", "new", "v2", "style", "order", "to", "the", "database" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1476-L1549
train
letsencrypt/boulder
sa/sa.go
SetOrderError
func (ssa *SQLStorageAuthority) SetOrderError(ctx context.Context, order *corepb.Order) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) om, err := orderToModel(order) if err != nil { return Rollback(tx, err) } result, err := txWithCtx.Exec(` UPDATE orde...
go
func (ssa *SQLStorageAuthority) SetOrderError(ctx context.Context, order *corepb.Order) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) om, err := orderToModel(order) if err != nil { return Rollback(tx, err) } result, err := txWithCtx.Exec(` UPDATE orde...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "SetOrderError", "(", "ctx", "context", ".", "Context", ",", "order", "*", "corepb", ".", "Order", ")", "error", "{", "tx", ",", "err", ":=", "ssa", ".", "dbMap", ".", "Begin", "(", ")", "\n", "if"...
// SetOrderError updates a provided Order's error field.
[ "SetOrderError", "updates", "a", "provided", "Order", "s", "error", "field", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1584-L1614
train
letsencrypt/boulder
sa/sa.go
GetOrder
func (ssa *SQLStorageAuthority) GetOrder(ctx context.Context, req *sapb.OrderRequest) (*corepb.Order, error) { omObj, err := ssa.dbMap.WithContext(ctx).Get(orderModel{}, *req.Id) if err == sql.ErrNoRows || omObj == nil { return nil, berrors.NotFoundError("no order found for ID %d", *req.Id) } if err != nil { re...
go
func (ssa *SQLStorageAuthority) GetOrder(ctx context.Context, req *sapb.OrderRequest) (*corepb.Order, error) { omObj, err := ssa.dbMap.WithContext(ctx).Get(orderModel{}, *req.Id) if err == sql.ErrNoRows || omObj == nil { return nil, berrors.NotFoundError("no order found for ID %d", *req.Id) } if err != nil { re...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetOrder", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "OrderRequest", ")", "(", "*", "corepb", ".", "Order", ",", "error", ")", "{", "omObj", ",", "err", ":=", "ssa", "."...
// GetOrder is used to retrieve an already existing order object
[ "GetOrder", "is", "used", "to", "retrieve", "an", "already", "existing", "order", "object" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1695-L1738
train
letsencrypt/boulder
sa/sa.go
GetValidOrderAuthorizations
func (ssa *SQLStorageAuthority) GetValidOrderAuthorizations( ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (map[string]*core.Authorization, error) { now := ssa.clk.Now() // Select the full authorization data for all *valid, unexpired* // authorizations that are owned by the correct account ID ...
go
func (ssa *SQLStorageAuthority) GetValidOrderAuthorizations( ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (map[string]*core.Authorization, error) { now := ssa.clk.Now() // Select the full authorization data for all *valid, unexpired* // authorizations that are owned by the correct account ID ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetValidOrderAuthorizations", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetValidOrderAuthorizationsRequest", ")", "(", "map", "[", "string", "]", "*", "core", ".", "Authorization",...
// GetValidOrderAuthorizations is used to find the valid, unexpired authorizations // associated with a specific order and account ID.
[ "GetValidOrderAuthorizations", "is", "used", "to", "find", "the", "valid", "unexpired", "authorizations", "associated", "with", "a", "specific", "order", "and", "account", "ID", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L1948-L1993
train
letsencrypt/boulder
sa/sa.go
GetAuthorizations
func (ssa *SQLStorageAuthority) GetAuthorizations( ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) { authzMap, err := ssa.getAuthorizations( ctx, authorizationTable, string(core.StatusValid), *req.RegistrationID, req.Domains, time.Unix(0, *req.Now), *req.RequireV2...
go
func (ssa *SQLStorageAuthority) GetAuthorizations( ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) { authzMap, err := ssa.getAuthorizations( ctx, authorizationTable, string(core.StatusValid), *req.RegistrationID, req.Domains, time.Unix(0, *req.Now), *req.RequireV2...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetAuthorizations", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetAuthorizationsRequest", ")", "(", "*", "sapb", ".", "Authorizations", ",", "error", ")", "{", "authzMap", ",", ...
// GetAuthorizations returns a map of valid or pending authorizations for as many names as possible
[ "GetAuthorizations", "returns", "a", "map", "of", "valid", "or", "pending", "authorizations", "for", "as", "many", "names", "as", "possible" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2143-L2195
train
letsencrypt/boulder
sa/sa.go
AddPendingAuthorizations
func (ssa *SQLStorageAuthority) AddPendingAuthorizations(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.AuthorizationIDs, error) { ids := []string{} for _, authPB := range req.Authz { authz, err := bgrpc.PBToAuthz(authPB) if err != nil { return nil, err } result, err := ssa.NewPendi...
go
func (ssa *SQLStorageAuthority) AddPendingAuthorizations(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.AuthorizationIDs, error) { ids := []string{} for _, authPB := range req.Authz { authz, err := bgrpc.PBToAuthz(authPB) if err != nil { return nil, err } result, err := ssa.NewPendi...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "AddPendingAuthorizations", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "AddPendingAuthorizationsRequest", ")", "(", "*", "sapb", ".", "AuthorizationIDs", ",", "error", ")", "{", "id...
// AddPendingAuthorizations creates a batch of pending authorizations and returns their IDs
[ "AddPendingAuthorizations", "creates", "a", "batch", "of", "pending", "authorizations", "and", "returns", "their", "IDs" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2198-L2212
train
letsencrypt/boulder
sa/sa.go
NewAuthorizations2
func (ssa *SQLStorageAuthority) NewAuthorizations2(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.Authorization2IDs, error) { ids := &sapb.Authorization2IDs{} for _, authz := range req.Authz { if *authz.Status != string(core.StatusPending) { return nil, berrors.InternalServerError("author...
go
func (ssa *SQLStorageAuthority) NewAuthorizations2(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.Authorization2IDs, error) { ids := &sapb.Authorization2IDs{} for _, authz := range req.Authz { if *authz.Status != string(core.StatusPending) { return nil, berrors.InternalServerError("author...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "NewAuthorizations2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "AddPendingAuthorizationsRequest", ")", "(", "*", "sapb", ".", "Authorization2IDs", ",", "error", ")", "{", "ids", ...
// NewAuthorizations2 adds a set of new style authorizations to the database and returns // either the IDs of the authorizations or an error. It will only process corepb.Authorization // objects if the V2 field is set. This method is intended to deprecate AddPendingAuthorizations
[ "NewAuthorizations2", "adds", "a", "set", "of", "new", "style", "authorizations", "to", "the", "database", "and", "returns", "either", "the", "IDs", "of", "the", "authorizations", "or", "an", "error", ".", "It", "will", "only", "process", "corepb", ".", "Aut...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2238-L2255
train
letsencrypt/boulder
sa/sa.go
GetAuthorization2
func (ssa *SQLStorageAuthority) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2) (*corepb.Authorization, error) { obj, err := ssa.dbMap.Get(authz2Model{}, *id.Id) if err != nil { return nil, err } if obj == nil { return nil, berrors.NotFoundError("authorization %d not found", *id.Id) } return...
go
func (ssa *SQLStorageAuthority) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2) (*corepb.Authorization, error) { obj, err := ssa.dbMap.Get(authz2Model{}, *id.Id) if err != nil { return nil, err } if obj == nil { return nil, berrors.NotFoundError("authorization %d not found", *id.Id) } return...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetAuthorization2", "(", "ctx", "context", ".", "Context", ",", "id", "*", "sapb", ".", "AuthorizationID2", ")", "(", "*", "corepb", ".", "Authorization", ",", "error", ")", "{", "obj", ",", "err", ":...
// GetAuthorization2 returns the authz2 style authorization identified by the provided ID or an error. // If no authorization is found matching the ID a berrors.NotFound type error is returned. This method // is intended to deprecate GetAuthorization.
[ "GetAuthorization2", "returns", "the", "authz2", "style", "authorization", "identified", "by", "the", "provided", "ID", "or", "an", "error", ".", "If", "no", "authorization", "is", "found", "matching", "the", "ID", "a", "berrors", ".", "NotFound", "type", "err...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2260-L2269
train
letsencrypt/boulder
sa/sa.go
authz2ModelMapToPB
func authz2ModelMapToPB(m map[string]authz2Model) (*sapb.Authorizations, error) { resp := &sapb.Authorizations{} for k, v := range m { // Make a copy of k because it will be reassigned with each loop. kCopy := k authzPB, err := modelToAuthzPB(&v) if err != nil { return nil, err } resp.Authz = append(re...
go
func authz2ModelMapToPB(m map[string]authz2Model) (*sapb.Authorizations, error) { resp := &sapb.Authorizations{} for k, v := range m { // Make a copy of k because it will be reassigned with each loop. kCopy := k authzPB, err := modelToAuthzPB(&v) if err != nil { return nil, err } resp.Authz = append(re...
[ "func", "authz2ModelMapToPB", "(", "m", "map", "[", "string", "]", "authz2Model", ")", "(", "*", "sapb", ".", "Authorizations", ",", "error", ")", "{", "resp", ":=", "&", "sapb", ".", "Authorizations", "{", "}", "\n", "for", "k", ",", "v", ":=", "ran...
// authz2ModelMapToPB converts a mapping of domain name to authz2Models into a // protobuf authorizations map
[ "authz2ModelMapToPB", "converts", "a", "mapping", "of", "domain", "name", "to", "authz2Models", "into", "a", "protobuf", "authorizations", "map" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2273-L2285
train
letsencrypt/boulder
sa/sa.go
FinalizeAuthorization2
func (ssa *SQLStorageAuthority) FinalizeAuthorization2(ctx context.Context, req *sapb.FinalizeAuthorizationRequest) error { if *req.Status != string(core.StatusValid) && *req.Status != string(core.StatusInvalid) { return berrors.InternalServerError("authorization must have status valid or invalid") } query := `UPD...
go
func (ssa *SQLStorageAuthority) FinalizeAuthorization2(ctx context.Context, req *sapb.FinalizeAuthorizationRequest) error { if *req.Status != string(core.StatusValid) && *req.Status != string(core.StatusInvalid) { return berrors.InternalServerError("authorization must have status valid or invalid") } query := `UPD...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "FinalizeAuthorization2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "FinalizeAuthorizationRequest", ")", "error", "{", "if", "*", "req", ".", "Status", "!=", "string", "(", "core...
// FinalizeAuthorization2 moves a pending authorization to either the valid or invalid status. If // the authorization is being moved to invalid the validationError field must be set. If the // authorization is being moved to valid the validationRecord and expires fields must be set. // This method is intended to depre...
[ "FinalizeAuthorization2", "moves", "a", "pending", "authorization", "to", "either", "the", "valid", "or", "invalid", "status", ".", "If", "the", "authorization", "is", "being", "moved", "to", "invalid", "the", "validationError", "field", "must", "be", "set", "."...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2371-L2432
train
letsencrypt/boulder
sa/sa.go
RevokeCertificate
func (ssa *SQLStorageAuthority) RevokeCertificate(ctx context.Context, req *sapb.RevokeCertificateRequest) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) status, err := SelectCertificateStatus( txWithCtx, "WHERE serial = ? AND status != ?", *req.Serial, ...
go
func (ssa *SQLStorageAuthority) RevokeCertificate(ctx context.Context, req *sapb.RevokeCertificateRequest) error { tx, err := ssa.dbMap.Begin() if err != nil { return err } txWithCtx := tx.WithContext(ctx) status, err := SelectCertificateStatus( txWithCtx, "WHERE serial = ? AND status != ?", *req.Serial, ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "RevokeCertificate", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "RevokeCertificateRequest", ")", "error", "{", "tx", ",", "err", ":=", "ssa", ".", "dbMap", ".", "Begin", "(", ...
// RevokeCertificate stores revocation information about a certificate. It will only store this // information if the certificate is not alreay marked as revoked. This method is meant as a // replacement for MarkCertificateRevoked and the ocsp-updater database methods.
[ "RevokeCertificate", "stores", "revocation", "information", "about", "a", "certificate", ".", "It", "will", "only", "store", "this", "information", "if", "the", "certificate", "is", "not", "alreay", "marked", "as", "revoked", ".", "This", "method", "is", "meant"...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2437-L2475
train
letsencrypt/boulder
sa/sa.go
GetPendingAuthorization2
func (ssa *SQLStorageAuthority) GetPendingAuthorization2(ctx context.Context, req *sapb.GetPendingAuthorizationRequest) (*corepb.Authorization, error) { var am authz2Model err := ssa.dbMap.WithContext(ctx).SelectOne( &am, fmt.Sprintf(`SELECT %s FROM authz2 WHERE registrationID = :regID AND identifierValue =...
go
func (ssa *SQLStorageAuthority) GetPendingAuthorization2(ctx context.Context, req *sapb.GetPendingAuthorizationRequest) (*corepb.Authorization, error) { var am authz2Model err := ssa.dbMap.WithContext(ctx).SelectOne( &am, fmt.Sprintf(`SELECT %s FROM authz2 WHERE registrationID = :regID AND identifierValue =...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetPendingAuthorization2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetPendingAuthorizationRequest", ")", "(", "*", "corepb", ".", "Authorization", ",", "error", ")", "{", "var"...
// GetPendingAuthorization2 returns the most recent Pending authorization with // the given identifier, if available. This method is intended to deprecate // GetPendingAuthorization.
[ "GetPendingAuthorization2", "returns", "the", "most", "recent", "Pending", "authorization", "with", "the", "given", "identifier", "if", "available", ".", "This", "method", "is", "intended", "to", "deprecate", "GetPendingAuthorization", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2480-L2510
train
letsencrypt/boulder
sa/sa.go
CountPendingAuthorizations2
func (ssa *SQLStorageAuthority) CountPendingAuthorizations2(ctx context.Context, req *sapb.RegistrationID) (*sapb.Count, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne(&count, `SELECT COUNT(1) FROM authz2 WHERE registrationID = :regID AND expires > :expires AND status = :status`, map[s...
go
func (ssa *SQLStorageAuthority) CountPendingAuthorizations2(ctx context.Context, req *sapb.RegistrationID) (*sapb.Count, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne(&count, `SELECT COUNT(1) FROM authz2 WHERE registrationID = :regID AND expires > :expires AND status = :status`, map[s...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountPendingAuthorizations2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "RegistrationID", ")", "(", "*", "sapb", ".", "Count", ",", "error", ")", "{", "var", "count", "int64",...
// CountPendingAuthorizations2 returns the number of pending, unexpired authorizations // for the given registration. This method is intended to deprecate CountPendingAuthorizations.
[ "CountPendingAuthorizations2", "returns", "the", "number", "of", "pending", "unexpired", "authorizations", "for", "the", "given", "registration", ".", "This", "method", "is", "intended", "to", "deprecate", "CountPendingAuthorizations", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2514-L2538
train
letsencrypt/boulder
sa/sa.go
GetValidOrderAuthorizations2
func (ssa *SQLStorageAuthority) GetValidOrderAuthorizations2(ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (*sapb.Authorizations, error) { var ams []authz2Model _, err := ssa.dbMap.WithContext(ctx).Select( &ams, fmt.Sprintf(`SELECT %s FROM authz2 LEFT JOIN orderToAuthz2 ON authz2.ID = orde...
go
func (ssa *SQLStorageAuthority) GetValidOrderAuthorizations2(ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (*sapb.Authorizations, error) { var ams []authz2Model _, err := ssa.dbMap.WithContext(ctx).Select( &ams, fmt.Sprintf(`SELECT %s FROM authz2 LEFT JOIN orderToAuthz2 ON authz2.ID = orde...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetValidOrderAuthorizations2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetValidOrderAuthorizationsRequest", ")", "(", "*", "sapb", ".", "Authorizations", ",", "error", ")", "{", ...
// GetValidOrderAuthorizations2 is used to find the valid, unexpired authorizations // associated with a specific order and account ID. This method is intended to // deprecate GetValidOrderAuthorizations.
[ "GetValidOrderAuthorizations2", "is", "used", "to", "find", "the", "valid", "unexpired", "authorizations", "associated", "with", "a", "specific", "order", "and", "account", "ID", ".", "This", "method", "is", "intended", "to", "deprecate", "GetValidOrderAuthorizations"...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2543-L2600
train
letsencrypt/boulder
sa/sa.go
CountInvalidAuthorizations2
func (ssa *SQLStorageAuthority) CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (*sapb.Count, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM authz2 WHERE registrationID = :regID AND identifierValue = :ident AND ...
go
func (ssa *SQLStorageAuthority) CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (*sapb.Count, error) { var count int64 err := ssa.dbMap.WithContext(ctx).SelectOne( &count, `SELECT COUNT(1) FROM authz2 WHERE registrationID = :regID AND identifierValue = :ident AND ...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "CountInvalidAuthorizations2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "CountInvalidAuthorizationsRequest", ")", "(", "*", "sapb", ".", "Count", ",", "error", ")", "{", "var", ...
// CountInvalidAuthorizations2 counts invalid authorizations for a user expiring // in a given time range. This method is intended to deprecate CountInvalidAuthorizations.
[ "CountInvalidAuthorizations2", "counts", "invalid", "authorizations", "for", "a", "user", "expiring", "in", "a", "given", "time", "range", ".", "This", "method", "is", "intended", "to", "deprecate", "CountInvalidAuthorizations", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2604-L2633
train
letsencrypt/boulder
sa/sa.go
GetValidAuthorizations2
func (ssa *SQLStorageAuthority) GetValidAuthorizations2(ctx context.Context, req *sapb.GetValidAuthorizationsRequest) (*sapb.Authorizations, error) { var authzModels []authz2Model params := []interface{}{ *req.RegistrationID, time.Unix(0, *req.Now), statusUint(core.StatusValid), } qmarks := make([]string, len...
go
func (ssa *SQLStorageAuthority) GetValidAuthorizations2(ctx context.Context, req *sapb.GetValidAuthorizationsRequest) (*sapb.Authorizations, error) { var authzModels []authz2Model params := []interface{}{ *req.RegistrationID, time.Unix(0, *req.Now), statusUint(core.StatusValid), } qmarks := make([]string, len...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "GetValidAuthorizations2", "(", "ctx", "context", ".", "Context", ",", "req", "*", "sapb", ".", "GetValidAuthorizationsRequest", ")", "(", "*", "sapb", ".", "Authorizations", ",", "error", ")", "{", "var", ...
// GetValidAuthorizations2 returns the latest authorization for all // domain names that the account has authorizations for. This method is // intended to deprecate GetValidAuthorizations.
[ "GetValidAuthorizations2", "returns", "the", "latest", "authorization", "for", "all", "domain", "names", "that", "the", "account", "has", "authorizations", "for", ".", "This", "method", "is", "intended", "to", "deprecate", "GetValidAuthorizations", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/sa.go#L2638-L2717
train
letsencrypt/boulder
va/utf8filter.go
replaceInvalidUTF8
func replaceInvalidUTF8(input []byte) string { var b strings.Builder // Ranging over a string in Go produces runes. When the range keyword // encounters an invalid UTF-8 encoding, it returns REPLACEMENT CHARACTER. for _, v := range string(input) { b.WriteRune(v) } return b.String() }
go
func replaceInvalidUTF8(input []byte) string { var b strings.Builder // Ranging over a string in Go produces runes. When the range keyword // encounters an invalid UTF-8 encoding, it returns REPLACEMENT CHARACTER. for _, v := range string(input) { b.WriteRune(v) } return b.String() }
[ "func", "replaceInvalidUTF8", "(", "input", "[", "]", "byte", ")", "string", "{", "var", "b", "strings", ".", "Builder", "\n\n", "// Ranging over a string in Go produces runes. When the range keyword", "// encounters an invalid UTF-8 encoding, it returns REPLACEMENT CHARACTER.", ...
// replaceInvalidUTF8 replaces all invalid UTF-8 encodings with // Unicode REPLACEMENT CHARACTER.
[ "replaceInvalidUTF8", "replaces", "all", "invalid", "UTF", "-", "8", "encodings", "with", "Unicode", "REPLACEMENT", "CHARACTER", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/utf8filter.go#L7-L16
train
letsencrypt/boulder
publisher/publisher.go
Len
func (c *logCache) Len() int { c.RLock() defer c.RUnlock() return len(c.logs) }
go
func (c *logCache) Len() int { c.RLock() defer c.RUnlock() return len(c.logs) }
[ "func", "(", "c", "*", "logCache", ")", "Len", "(", ")", "int", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "len", "(", "c", ".", "logs", ")", "\n", "}" ]
// Len returns the number of logs in the logCache
[ "Len", "returns", "the", "number", "of", "logs", "in", "the", "logCache" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/publisher.go#L76-L80
train
letsencrypt/boulder
publisher/publisher.go
LogURIs
func (c *logCache) LogURIs() []string { c.RLock() defer c.RUnlock() var uris []string for _, l := range c.logs { uris = append(uris, l.uri) } return uris }
go
func (c *logCache) LogURIs() []string { c.RLock() defer c.RUnlock() var uris []string for _, l := range c.logs { uris = append(uris, l.uri) } return uris }
[ "func", "(", "c", "*", "logCache", ")", "LogURIs", "(", ")", "[", "]", "string", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "var", "uris", "[", "]", "string", "\n", "for", "_", ",", "l", ":=", "range...
// LogURIs returns the URIs of all logs currently in the logCache
[ "LogURIs", "returns", "the", "URIs", "of", "all", "logs", "currently", "in", "the", "logCache" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/publisher.go#L83-L91
train
letsencrypt/boulder
publisher/publisher.go
NewLog
func NewLog(uri, b64PK string, logger blog.Logger) (*Log, error) { url, err := url.Parse(uri) if err != nil { return nil, err } url.Path = strings.TrimSuffix(url.Path, "/") pemPK := fmt.Sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----", b64PK) opts := jsonclient.Options{ Logger: logAdap...
go
func NewLog(uri, b64PK string, logger blog.Logger) (*Log, error) { url, err := url.Parse(uri) if err != nil { return nil, err } url.Path = strings.TrimSuffix(url.Path, "/") pemPK := fmt.Sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----", b64PK) opts := jsonclient.Options{ Logger: logAdap...
[ "func", "NewLog", "(", "uri", ",", "b64PK", "string", ",", "logger", "blog", ".", "Logger", ")", "(", "*", "Log", ",", "error", ")", "{", "url", ",", "err", ":=", "url", ".", "Parse", "(", "uri", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// NewLog returns an initialized Log struct
[ "NewLog", "returns", "an", "initialized", "Log", "struct" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/publisher.go#L102-L162
train
letsencrypt/boulder
publisher/publisher.go
New
func New( bundle []ct.ASN1Cert, logger blog.Logger, stats metrics.Scope, ) *Impl { return &Impl{ issuerBundle: bundle, ctLogsCache: logCache{ logs: make(map[string]*Log), }, log: logger, metrics: initMetrics(stats), } }
go
func New( bundle []ct.ASN1Cert, logger blog.Logger, stats metrics.Scope, ) *Impl { return &Impl{ issuerBundle: bundle, ctLogsCache: logCache{ logs: make(map[string]*Log), }, log: logger, metrics: initMetrics(stats), } }
[ "func", "New", "(", "bundle", "[", "]", "ct", ".", "ASN1Cert", ",", "logger", "blog", ".", "Logger", ",", "stats", "metrics", ".", "Scope", ",", ")", "*", "Impl", "{", "return", "&", "Impl", "{", "issuerBundle", ":", "bundle", ",", "ctLogsCache", ":"...
// New creates a Publisher that will submit certificates // to requested CT logs
[ "New", "creates", "a", "Publisher", "that", "will", "submit", "certificates", "to", "requested", "CT", "logs" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/publisher.go#L210-L223
train
letsencrypt/boulder
publisher/publisher.go
ProbeLogs
func (pub *Impl) ProbeLogs() { wg := new(sync.WaitGroup) for _, log := range pub.ctLogsCache.LogURIs() { wg.Add(1) go func(uri string) { defer wg.Done() c := http.Client{ Timeout: time.Minute*2 + time.Second*30, } url, err := url.Parse(uri) if err != nil { pub.log.Errf("failed to parse log ...
go
func (pub *Impl) ProbeLogs() { wg := new(sync.WaitGroup) for _, log := range pub.ctLogsCache.LogURIs() { wg.Add(1) go func(uri string) { defer wg.Done() c := http.Client{ Timeout: time.Minute*2 + time.Second*30, } url, err := url.Parse(uri) if err != nil { pub.log.Errf("failed to parse log ...
[ "func", "(", "pub", "*", "Impl", ")", "ProbeLogs", "(", ")", "{", "wg", ":=", "new", "(", "sync", ".", "WaitGroup", ")", "\n", "for", "_", ",", "log", ":=", "range", "pub", ".", "ctLogsCache", ".", "LogURIs", "(", ")", "{", "wg", ".", "Add", "(...
// ProbeLogs sends a HTTP GET request to each of the logs in the // publisher logCache and records the latency and status of the // response.
[ "ProbeLogs", "sends", "a", "HTTP", "GET", "request", "to", "each", "of", "the", "logs", "in", "the", "publisher", "logCache", "and", "records", "the", "latency", "and", "status", "of", "the", "response", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/publisher/publisher.go#L414-L445
train
letsencrypt/boulder
csr/csr.go
VerifyCSR
func VerifyCSR(csr *x509.CertificateRequest, maxNames int, keyPolicy *goodkey.KeyPolicy, pa core.PolicyAuthority, forceCNFromSAN bool, regID int64) error { normalizeCSR(csr, forceCNFromSAN) key, ok := csr.PublicKey.(crypto.PublicKey) if !ok { return invalidPubKey } if err := keyPolicy.GoodKey(key); err != nil { ...
go
func VerifyCSR(csr *x509.CertificateRequest, maxNames int, keyPolicy *goodkey.KeyPolicy, pa core.PolicyAuthority, forceCNFromSAN bool, regID int64) error { normalizeCSR(csr, forceCNFromSAN) key, ok := csr.PublicKey.(crypto.PublicKey) if !ok { return invalidPubKey } if err := keyPolicy.GoodKey(key); err != nil { ...
[ "func", "VerifyCSR", "(", "csr", "*", "x509", ".", "CertificateRequest", ",", "maxNames", "int", ",", "keyPolicy", "*", "goodkey", ".", "KeyPolicy", ",", "pa", "core", ".", "PolicyAuthority", ",", "forceCNFromSAN", "bool", ",", "regID", "int64", ")", "error"...
// VerifyCSR checks the validity of a x509.CertificateRequest. Before doing checks it normalizes // the CSR which lowers the case of DNS names and subject CN, and if forceCNFromSAN is true it // will hoist a DNS name into the CN if it is empty.
[ "VerifyCSR", "checks", "the", "validity", "of", "a", "x509", ".", "CertificateRequest", ".", "Before", "doing", "checks", "it", "normalizes", "the", "CSR", "which", "lowers", "the", "case", "of", "DNS", "names", "and", "subject", "CN", "and", "if", "forceCNF...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/csr/csr.go#L46-L91
train
letsencrypt/boulder
csr/csr.go
normalizeCSR
func normalizeCSR(csr *x509.CertificateRequest, forceCNFromSAN bool) { if forceCNFromSAN && csr.Subject.CommonName == "" { if len(csr.DNSNames) > 0 { csr.Subject.CommonName = csr.DNSNames[0] } } else if csr.Subject.CommonName != "" { csr.DNSNames = append(csr.DNSNames, csr.Subject.CommonName) } csr.Subject...
go
func normalizeCSR(csr *x509.CertificateRequest, forceCNFromSAN bool) { if forceCNFromSAN && csr.Subject.CommonName == "" { if len(csr.DNSNames) > 0 { csr.Subject.CommonName = csr.DNSNames[0] } } else if csr.Subject.CommonName != "" { csr.DNSNames = append(csr.DNSNames, csr.Subject.CommonName) } csr.Subject...
[ "func", "normalizeCSR", "(", "csr", "*", "x509", ".", "CertificateRequest", ",", "forceCNFromSAN", "bool", ")", "{", "if", "forceCNFromSAN", "&&", "csr", ".", "Subject", ".", "CommonName", "==", "\"", "\"", "{", "if", "len", "(", "csr", ".", "DNSNames", ...
// normalizeCSR deduplicates and lowers the case of dNSNames and the subject CN. // If forceCNFromSAN is true it will also hoist a dNSName into the CN if it is empty.
[ "normalizeCSR", "deduplicates", "and", "lowers", "the", "case", "of", "dNSNames", "and", "the", "subject", "CN", ".", "If", "forceCNFromSAN", "is", "true", "it", "will", "also", "hoist", "a", "dNSName", "into", "the", "CN", "if", "it", "is", "empty", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/csr/csr.go#L95-L105
train
letsencrypt/boulder
goodkey/good_key.go
NewKeyPolicy
func NewKeyPolicy(weakKeyFile string) (KeyPolicy, error) { kp := KeyPolicy{ AllowRSA: true, AllowECDSANISTP256: true, AllowECDSANISTP384: true, } if weakKeyFile != "" { keyList, err := LoadWeakRSASuffixes(weakKeyFile) if err != nil { return KeyPolicy{}, err } kp.weakRSAList = keyList } r...
go
func NewKeyPolicy(weakKeyFile string) (KeyPolicy, error) { kp := KeyPolicy{ AllowRSA: true, AllowECDSANISTP256: true, AllowECDSANISTP384: true, } if weakKeyFile != "" { keyList, err := LoadWeakRSASuffixes(weakKeyFile) if err != nil { return KeyPolicy{}, err } kp.weakRSAList = keyList } r...
[ "func", "NewKeyPolicy", "(", "weakKeyFile", "string", ")", "(", "KeyPolicy", ",", "error", ")", "{", "kp", ":=", "KeyPolicy", "{", "AllowRSA", ":", "true", ",", "AllowECDSANISTP256", ":", "true", ",", "AllowECDSANISTP384", ":", "true", ",", "}", "\n", "if"...
// NewKeyPolicy returns a KeyPolicy that allows RSA, ECDSA256 and ECDSA384. // weakKeyFile contains the path to a JSON file containing truncated modulus // hashes of known weak RSA keys. If this argument is empty RSA modulus hash // checking will be disabled.
[ "NewKeyPolicy", "returns", "a", "KeyPolicy", "that", "allows", "RSA", "ECDSA256", "and", "ECDSA384", ".", "weakKeyFile", "contains", "the", "path", "to", "a", "JSON", "file", "containing", "truncated", "modulus", "hashes", "of", "known", "weak", "RSA", "keys", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/goodkey/good_key.go#L50-L64
train
letsencrypt/boulder
goodkey/good_key.go
checkSmallPrimes
func checkSmallPrimes(i *big.Int) bool { smallPrimesSingleton.Do(func() { for _, prime := range smallPrimeInts { smallPrimes = append(smallPrimes, big.NewInt(prime)) } }) for _, prime := range smallPrimes { var result big.Int result.Mod(i, prime) if result.Sign() == 0 { return true } } return f...
go
func checkSmallPrimes(i *big.Int) bool { smallPrimesSingleton.Do(func() { for _, prime := range smallPrimeInts { smallPrimes = append(smallPrimes, big.NewInt(prime)) } }) for _, prime := range smallPrimes { var result big.Int result.Mod(i, prime) if result.Sign() == 0 { return true } } return f...
[ "func", "checkSmallPrimes", "(", "i", "*", "big", ".", "Int", ")", "bool", "{", "smallPrimesSingleton", ".", "Do", "(", "func", "(", ")", "{", "for", "_", ",", "prime", ":=", "range", "smallPrimeInts", "{", "smallPrimes", "=", "append", "(", "smallPrimes...
// Returns true iff integer i is divisible by any of the primes in smallPrimes. // // Short circuits; execution time is dependent on i. Do not use this on secret // values.
[ "Returns", "true", "iff", "integer", "i", "is", "divisible", "by", "any", "of", "the", "primes", "in", "smallPrimes", ".", "Short", "circuits", ";", "execution", "time", "is", "dependent", "on", "i", ".", "Do", "not", "use", "this", "on", "secret", "valu...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/goodkey/good_key.go#L249-L265
train
letsencrypt/boulder
metrics/mock_metrics/mock_scope.go
NewMockScope
func NewMockScope(ctrl *gomock.Controller) *MockScope { mock := &MockScope{ctrl: ctrl} mock.recorder = &MockScopeMockRecorder{mock} return mock }
go
func NewMockScope(ctrl *gomock.Controller) *MockScope { mock := &MockScope{ctrl: ctrl} mock.recorder = &MockScopeMockRecorder{mock} return mock }
[ "func", "NewMockScope", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockScope", "{", "mock", ":=", "&", "MockScope", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockScopeMockRecorder", "{", "mock", "}", "\n", ...
// NewMockScope creates a new mock instance
[ "NewMockScope", "creates", "a", "new", "mock", "instance" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/mock_metrics/mock_scope.go#L27-L31
train
letsencrypt/boulder
metrics/mock_metrics/mock_scope.go
MustRegister
func (m *MockScope) MustRegister(arg0 ...prometheus.Collector) { m.ctrl.T.Helper() varargs := []interface{}{} for _, a := range arg0 { varargs = append(varargs, a) } m.ctrl.Call(m, "MustRegister", varargs...) }
go
func (m *MockScope) MustRegister(arg0 ...prometheus.Collector) { m.ctrl.T.Helper() varargs := []interface{}{} for _, a := range arg0 { varargs = append(varargs, a) } m.ctrl.Call(m, "MustRegister", varargs...) }
[ "func", "(", "m", "*", "MockScope", ")", "MustRegister", "(", "arg0", "...", "prometheus", ".", "Collector", ")", "{", "m", ".", "ctrl", ".", "T", ".", "Helper", "(", ")", "\n", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "f...
// MustRegister mocks base method
[ "MustRegister", "mocks", "base", "method" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/mock_metrics/mock_scope.go#L75-L82
train
letsencrypt/boulder
metrics/mock_metrics/mock_scope.go
NewScope
func (m *MockScope) NewScope(arg0 ...string) metrics.Scope { m.ctrl.T.Helper() varargs := []interface{}{} for _, a := range arg0 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "NewScope", varargs...) ret0, _ := ret[0].(metrics.Scope) return ret0 }
go
func (m *MockScope) NewScope(arg0 ...string) metrics.Scope { m.ctrl.T.Helper() varargs := []interface{}{} for _, a := range arg0 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "NewScope", varargs...) ret0, _ := ret[0].(metrics.Scope) return ret0 }
[ "func", "(", "m", "*", "MockScope", ")", "NewScope", "(", "arg0", "...", "string", ")", "metrics", ".", "Scope", "{", "m", ".", "ctrl", ".", "T", ".", "Helper", "(", ")", "\n", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "...
// NewScope mocks base method
[ "NewScope", "mocks", "base", "method" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/mock_metrics/mock_scope.go#L91-L100
train
letsencrypt/boulder
metrics/mock_metrics/mock_scope.go
TimingDuration
func (m *MockScope) TimingDuration(arg0 string, arg1 time.Duration) { m.ctrl.T.Helper() m.ctrl.Call(m, "TimingDuration", arg0, arg1) }
go
func (m *MockScope) TimingDuration(arg0 string, arg1 time.Duration) { m.ctrl.T.Helper() m.ctrl.Call(m, "TimingDuration", arg0, arg1) }
[ "func", "(", "m", "*", "MockScope", ")", "TimingDuration", "(", "arg0", "string", ",", "arg1", "time", ".", "Duration", ")", "{", "m", ".", "ctrl", ".", "T", ".", "Helper", "(", ")", "\n", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"...
// TimingDuration mocks base method
[ "TimingDuration", "mocks", "base", "method" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/mock_metrics/mock_scope.go#L133-L136
train
letsencrypt/boulder
sa/rate_limits.go
baseDomain
func baseDomain(name string) string { eTLDPlusOne, err := publicsuffix.Domain(name) if err != nil { // publicsuffix.Domain will return an error if the input name is itself a // public suffix. In that case we use the input name as the key for rate // limiting. Since all of its subdomains will have separate keys ...
go
func baseDomain(name string) string { eTLDPlusOne, err := publicsuffix.Domain(name) if err != nil { // publicsuffix.Domain will return an error if the input name is itself a // public suffix. In that case we use the input name as the key for rate // limiting. Since all of its subdomains will have separate keys ...
[ "func", "baseDomain", "(", "name", "string", ")", "string", "{", "eTLDPlusOne", ",", "err", ":=", "publicsuffix", ".", "Domain", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "// publicsuffix.Domain will return an error if the input name is itself a", "// p...
// baseDomain returns the eTLD+1 of a domain name for the purpose of rate // limiting. For a domain name that is itself an eTLD, it returns its input.
[ "baseDomain", "returns", "the", "eTLD", "+", "1", "of", "a", "domain", "name", "for", "the", "purpose", "of", "rate", "limiting", ".", "For", "a", "domain", "name", "that", "is", "itself", "an", "eTLD", "it", "returns", "its", "input", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/rate_limits.go#L15-L29
train
letsencrypt/boulder
sa/rate_limits.go
addCertificatesPerName
func (ssa *SQLStorageAuthority) addCertificatesPerName( ctx context.Context, db dbSelectExecer, names []string, timeToTheHour time.Time, ) error { if !features.Enabled(features.FasterRateLimit) { return nil } // De-duplicate the base domains. baseDomainsMap := make(map[string]bool) var qmarks []string var v...
go
func (ssa *SQLStorageAuthority) addCertificatesPerName( ctx context.Context, db dbSelectExecer, names []string, timeToTheHour time.Time, ) error { if !features.Enabled(features.FasterRateLimit) { return nil } // De-duplicate the base domains. baseDomainsMap := make(map[string]bool) var qmarks []string var v...
[ "func", "(", "ssa", "*", "SQLStorageAuthority", ")", "addCertificatesPerName", "(", "ctx", "context", ".", "Context", ",", "db", "dbSelectExecer", ",", "names", "[", "]", "string", ",", "timeToTheHour", "time", ".", "Time", ",", ")", "error", "{", "if", "!...
// addCertificatesPerName adds 1 to the rate limit count for the provided domains, // in a specific time bucket. It must be executed in a transaction, and the // input timeToTheHour must be a time rounded to an hour.
[ "addCertificatesPerName", "adds", "1", "to", "the", "rate", "limit", "count", "for", "the", "provided", "domains", "in", "a", "specific", "time", "bucket", ".", "It", "must", "be", "executed", "in", "a", "transaction", "and", "the", "input", "timeToTheHour", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/rate_limits.go#L34-L64
train
letsencrypt/boulder
cmd/gen-ca/main.go
getKey
func getKey(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label string, idStr string) (*x509Signer, error) { id, err := hex.DecodeString(idStr) if err != nil { return nil, err } // Retrieve the private key handle that will later be used for the certificate // signing operation privateHandle, err := fi...
go
func getKey(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label string, idStr string) (*x509Signer, error) { id, err := hex.DecodeString(idStr) if err != nil { return nil, err } // Retrieve the private key handle that will later be used for the certificate // signing operation privateHandle, err := fi...
[ "func", "getKey", "(", "ctx", "pkcs11helpers", ".", "PKCtx", ",", "session", "pkcs11", ".", "SessionHandle", ",", "label", "string", ",", "idStr", "string", ")", "(", "*", "x509Signer", ",", "error", ")", "{", "id", ",", "err", ":=", "hex", ".", "Decod...
// getKey constructs a x509Signer for the private key object associated with the // given label and ID
[ "getKey", "constructs", "a", "x509Signer", "for", "the", "private", "key", "object", "associated", "with", "the", "given", "label", "and", "ID" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-ca/main.go#L96-L161
train
letsencrypt/boulder
cmd/gen-ca/main.go
makeTemplate
func makeTemplate(ctx pkcs11helpers.PKCtx, profile *CertProfile, pubKey []byte, session pkcs11.SessionHandle) (*x509.Certificate, error) { dateLayout := "2006-01-02 15:04:05" notBefore, err := time.Parse(dateLayout, profile.NotBefore) if err != nil { return nil, err } notAfter, err := time.Parse(dateLayout, prof...
go
func makeTemplate(ctx pkcs11helpers.PKCtx, profile *CertProfile, pubKey []byte, session pkcs11.SessionHandle) (*x509.Certificate, error) { dateLayout := "2006-01-02 15:04:05" notBefore, err := time.Parse(dateLayout, profile.NotBefore) if err != nil { return nil, err } notAfter, err := time.Parse(dateLayout, prof...
[ "func", "makeTemplate", "(", "ctx", "pkcs11helpers", ".", "PKCtx", ",", "profile", "*", "CertProfile", ",", "pubKey", "[", "]", "byte", ",", "session", "pkcs11", ".", "SessionHandle", ")", "(", "*", "x509", ".", "Certificate", ",", "error", ")", "{", "da...
// makeTemplate generates the certificate template for use in x509.CreateCertificate
[ "makeTemplate", "generates", "the", "certificate", "template", "for", "use", "in", "x509", ".", "CreateCertificate" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-ca/main.go#L257-L323
train
letsencrypt/boulder
cmd/ocsp-updater/main.go
generateRevokedResponse
func (updater *OCSPUpdater) generateRevokedResponse(ctx context.Context, status core.CertificateStatus) (*core.CertificateStatus, []string, error) { cert, err := updater.sac.GetCertificate(ctx, status.Serial) if err != nil { return nil, nil, err } signRequest := core.OCSPSigningRequest{ CertDER: cert.DER, ...
go
func (updater *OCSPUpdater) generateRevokedResponse(ctx context.Context, status core.CertificateStatus) (*core.CertificateStatus, []string, error) { cert, err := updater.sac.GetCertificate(ctx, status.Serial) if err != nil { return nil, nil, err } signRequest := core.OCSPSigningRequest{ CertDER: cert.DER, ...
[ "func", "(", "updater", "*", "OCSPUpdater", ")", "generateRevokedResponse", "(", "ctx", "context", ".", "Context", ",", "status", "core", ".", "CertificateStatus", ")", "(", "*", "core", ".", "CertificateStatus", ",", "[", "]", "string", ",", "error", ")", ...
// generateRevokedResponse takes a core.CertificateStatus and updates it with a revoked OCSP response // for the certificate it represents. generateRevokedResponse then returns the updated status and a // list of OCSP request URLs that should be purged or an error.
[ "generateRevokedResponse", "takes", "a", "core", ".", "CertificateStatus", "and", "updates", "it", "with", "a", "revoked", "OCSP", "response", "for", "the", "certificate", "it", "represents", ".", "generateRevokedResponse", "then", "returns", "the", "updated", "stat...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/ocsp-updater/main.go#L235-L267
train
letsencrypt/boulder
cmd/ocsp-updater/main.go
markExpired
func (updater *OCSPUpdater) markExpired(status core.CertificateStatus) error { _, err := updater.dbMap.Exec( `UPDATE certificateStatus SET isExpired = TRUE WHERE serial = ?`, status.Serial, ) return err }
go
func (updater *OCSPUpdater) markExpired(status core.CertificateStatus) error { _, err := updater.dbMap.Exec( `UPDATE certificateStatus SET isExpired = TRUE WHERE serial = ?`, status.Serial, ) return err }
[ "func", "(", "updater", "*", "OCSPUpdater", ")", "markExpired", "(", "status", "core", ".", "CertificateStatus", ")", "error", "{", "_", ",", "err", ":=", "updater", ".", "dbMap", ".", "Exec", "(", "`UPDATE certificateStatus\n \t\tSET isExpired = TRUE\n \t\tWHERE se...
// markExpired updates a given CertificateStatus to have `isExpired` set.
[ "markExpired", "updates", "a", "given", "CertificateStatus", "to", "have", "isExpired", "set", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/ocsp-updater/main.go#L288-L296
train
letsencrypt/boulder
sa/metrics.go
InitDBMetrics
func InitDBMetrics(dbMap *gorp.DbMap, scope metrics.Scope) { // Create a dbMetrics instance and register prometheus metrics dbm := newDbMetrics(dbMap, scope) // Start the metric reporting goroutine to update the metrics periodically. go dbm.reportDBMetrics() }
go
func InitDBMetrics(dbMap *gorp.DbMap, scope metrics.Scope) { // Create a dbMetrics instance and register prometheus metrics dbm := newDbMetrics(dbMap, scope) // Start the metric reporting goroutine to update the metrics periodically. go dbm.reportDBMetrics() }
[ "func", "InitDBMetrics", "(", "dbMap", "*", "gorp", ".", "DbMap", ",", "scope", "metrics", ".", "Scope", ")", "{", "// Create a dbMetrics instance and register prometheus metrics", "dbm", ":=", "newDbMetrics", "(", "dbMap", ",", "scope", ")", "\n\n", "// Start the m...
// InitDBMetrics will register prometheus stats for the provided dbMap under the // given metrics.Scope. Every 1 second in a separate go routine the prometheus // stats will be updated based on the gorp dbMap's inner sql.DBMap's DBStats // structure values.
[ "InitDBMetrics", "will", "register", "prometheus", "stats", "for", "the", "provided", "dbMap", "under", "the", "given", "metrics", ".", "Scope", ".", "Every", "1", "second", "in", "a", "separate", "go", "routine", "the", "prometheus", "stats", "will", "be", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/metrics.go#L30-L36
train
letsencrypt/boulder
sa/metrics.go
newDbMetrics
func newDbMetrics(dbMap *gorp.DbMap, scope metrics.Scope) *dbMetrics { maxOpenConns := prometheus.NewGauge(prometheus.GaugeOpts{ Name: "db_max_open_connections", Help: "Maximum number of DB connections allowed.", }) scope.MustRegister(maxOpenConns) openConns := prometheus.NewGauge(prometheus.GaugeOpts{ Name:...
go
func newDbMetrics(dbMap *gorp.DbMap, scope metrics.Scope) *dbMetrics { maxOpenConns := prometheus.NewGauge(prometheus.GaugeOpts{ Name: "db_max_open_connections", Help: "Maximum number of DB connections allowed.", }) scope.MustRegister(maxOpenConns) openConns := prometheus.NewGauge(prometheus.GaugeOpts{ Name:...
[ "func", "newDbMetrics", "(", "dbMap", "*", "gorp", ".", "DbMap", ",", "scope", "metrics", ".", "Scope", ")", "*", "dbMetrics", "{", "maxOpenConns", ":=", "prometheus", ".", "NewGauge", "(", "prometheus", ".", "GaugeOpts", "{", "Name", ":", "\"", "\"", ",...
// newDbMetrics constructs a dbMetrics instance by registering prometheus stats.
[ "newDbMetrics", "constructs", "a", "dbMetrics", "instance", "by", "registering", "prometheus", "stats", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/metrics.go#L39-L101
train
letsencrypt/boulder
sa/metrics.go
updateFrom
func (dbm *dbMetrics) updateFrom(dbStats sql.DBStats) { dbm.maxOpenConnections.Set(float64(dbStats.MaxOpenConnections)) dbm.openConnections.Set(float64(dbStats.OpenConnections)) dbm.inUse.Set(float64(dbStats.InUse)) dbm.idle.Set(float64(dbStats.InUse)) dbm.waitCount.Set(float64(dbStats.WaitCount)) dbm.waitDuratio...
go
func (dbm *dbMetrics) updateFrom(dbStats sql.DBStats) { dbm.maxOpenConnections.Set(float64(dbStats.MaxOpenConnections)) dbm.openConnections.Set(float64(dbStats.OpenConnections)) dbm.inUse.Set(float64(dbStats.InUse)) dbm.idle.Set(float64(dbStats.InUse)) dbm.waitCount.Set(float64(dbStats.WaitCount)) dbm.waitDuratio...
[ "func", "(", "dbm", "*", "dbMetrics", ")", "updateFrom", "(", "dbStats", "sql", ".", "DBStats", ")", "{", "dbm", ".", "maxOpenConnections", ".", "Set", "(", "float64", "(", "dbStats", ".", "MaxOpenConnections", ")", ")", "\n", "dbm", ".", "openConnections"...
// updateFrom updates the dbMetrics prometheus stats based on the provided // sql.DBStats object.
[ "updateFrom", "updates", "the", "dbMetrics", "prometheus", "stats", "based", "on", "the", "provided", "sql", ".", "DBStats", "object", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/metrics.go#L105-L114
train
letsencrypt/boulder
sa/metrics.go
reportDBMetrics
func (dbm *dbMetrics) reportDBMetrics() { for { stats := dbm.dbMap.Db.Stats() dbm.updateFrom(stats) time.Sleep(1 * time.Second) } }
go
func (dbm *dbMetrics) reportDBMetrics() { for { stats := dbm.dbMap.Db.Stats() dbm.updateFrom(stats) time.Sleep(1 * time.Second) } }
[ "func", "(", "dbm", "*", "dbMetrics", ")", "reportDBMetrics", "(", ")", "{", "for", "{", "stats", ":=", "dbm", ".", "dbMap", ".", "Db", ".", "Stats", "(", ")", "\n", "dbm", ".", "updateFrom", "(", "stats", ")", "\n", "time", ".", "Sleep", "(", "1...
// reportDBMetrics is an infinite loop that will update the dbm with the gorp // dbMap's inner sql.DBMap's DBStats structure every second. It is intended to // be run in a dedicated goroutine spawned by InitDBMetrics.
[ "reportDBMetrics", "is", "an", "infinite", "loop", "that", "will", "update", "the", "dbm", "with", "the", "gorp", "dbMap", "s", "inner", "sql", ".", "DBMap", "s", "DBStats", "structure", "every", "second", ".", "It", "is", "intended", "to", "be", "run", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/metrics.go#L119-L125
train
letsencrypt/boulder
grpc/errors.go
unwrapError
func unwrapError(err error, md metadata.MD) error { if err == nil { return nil } if errTypeStrs, ok := md["errortype"]; ok { unwrappedErr := grpc.ErrorDesc(err) if len(errTypeStrs) != 1 { return berrors.InternalServerError( "multiple errorType metadata, wrapped error %q", unwrappedErr, ) } er...
go
func unwrapError(err error, md metadata.MD) error { if err == nil { return nil } if errTypeStrs, ok := md["errortype"]; ok { unwrappedErr := grpc.ErrorDesc(err) if len(errTypeStrs) != 1 { return berrors.InternalServerError( "multiple errorType metadata, wrapped error %q", unwrappedErr, ) } er...
[ "func", "unwrapError", "(", "err", "error", ",", "md", "metadata", ".", "MD", ")", "error", "{", "if", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "errTypeStrs", ",", "ok", ":=", "md", "[", "\"", "\"", "]", ";", "ok", "{", ...
// unwrapError unwraps errors returned from gRPC client calls which were wrapped // with wrapError to their proper internal error type. If the provided metadata // object has an "errortype" field, that will be used to set the type of the // error.
[ "unwrapError", "unwraps", "errors", "returned", "from", "gRPC", "client", "calls", "which", "were", "wrapped", "with", "wrapError", "to", "their", "proper", "internal", "error", "type", ".", "If", "the", "provided", "metadata", "object", "has", "an", "errortype"...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/errors.go#L43-L66
train
letsencrypt/boulder
mail/mailer.go
New
func New( server, port, username, password string, rootCAs *x509.CertPool, from mail.Address, logger blog.Logger, stats metrics.Scope, reconnectBase time.Duration, reconnectMax time.Duration) *MailerImpl { return &MailerImpl{ dialer: &dialerImpl{ username: username, password: password, server: s...
go
func New( server, port, username, password string, rootCAs *x509.CertPool, from mail.Address, logger blog.Logger, stats metrics.Scope, reconnectBase time.Duration, reconnectMax time.Duration) *MailerImpl { return &MailerImpl{ dialer: &dialerImpl{ username: username, password: password, server: s...
[ "func", "New", "(", "server", ",", "port", ",", "username", ",", "password", "string", ",", "rootCAs", "*", "x509", ".", "CertPool", ",", "from", "mail", ".", "Address", ",", "logger", "blog", ".", "Logger", ",", "stats", "metrics", ".", "Scope", ",", ...
// New constructs a Mailer to represent an account on a particular mail // transfer agent.
[ "New", "constructs", "a", "Mailer", "to", "represent", "an", "account", "on", "a", "particular", "mail", "transfer", "agent", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mail/mailer.go#L116-L143
train
letsencrypt/boulder
mail/mailer.go
NewDryRun
func NewDryRun(from mail.Address, logger blog.Logger) *MailerImpl { stats := metrics.NewNoopScope() return &MailerImpl{ dialer: dryRunClient{logger}, from: from, clk: clock.Default(), csprgSource: realSource{}, stats: stats, } }
go
func NewDryRun(from mail.Address, logger blog.Logger) *MailerImpl { stats := metrics.NewNoopScope() return &MailerImpl{ dialer: dryRunClient{logger}, from: from, clk: clock.Default(), csprgSource: realSource{}, stats: stats, } }
[ "func", "NewDryRun", "(", "from", "mail", ".", "Address", ",", "logger", "blog", ".", "Logger", ")", "*", "MailerImpl", "{", "stats", ":=", "metrics", ".", "NewNoopScope", "(", ")", "\n", "return", "&", "MailerImpl", "{", "dialer", ":", "dryRunClient", "...
// New constructs a Mailer suitable for doing a dry run. It simply logs each // command that would have been run, at debug level.
[ "New", "constructs", "a", "Mailer", "suitable", "for", "doing", "a", "dry", "run", ".", "It", "simply", "logs", "each", "command", "that", "would", "have", "been", "run", "at", "debug", "level", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mail/mailer.go#L147-L156
train
letsencrypt/boulder
mail/mailer.go
Connect
func (m *MailerImpl) Connect() error { client, err := m.dialer.Dial() if err != nil { return err } m.client = client return nil }
go
func (m *MailerImpl) Connect() error { client, err := m.dialer.Dial() if err != nil { return err } m.client = client return nil }
[ "func", "(", "m", "*", "MailerImpl", ")", "Connect", "(", ")", "error", "{", "client", ",", "err", ":=", "m", ".", "dialer", ".", "Dial", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "m", ".", "client", "=", ...
// Connect opens a connection to the specified mail server. It must be called // before SendMail.
[ "Connect", "opens", "a", "connection", "to", "the", "specified", "mail", "server", ".", "It", "must", "be", "called", "before", "SendMail", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mail/mailer.go#L217-L224
train
letsencrypt/boulder
mail/mailer.go
SendMail
func (m *MailerImpl) SendMail(to []string, subject, msg string) error { m.stats.Inc("SendMail.Attempts", 1) for { err := m.sendOne(to, subject, msg) if err == nil { // If the error is nil, we sent the mail without issue. nice! break } else if err == io.EOF { // If the error is an EOF, we should try to...
go
func (m *MailerImpl) SendMail(to []string, subject, msg string) error { m.stats.Inc("SendMail.Attempts", 1) for { err := m.sendOne(to, subject, msg) if err == nil { // If the error is nil, we sent the mail without issue. nice! break } else if err == io.EOF { // If the error is an EOF, we should try to...
[ "func", "(", "m", "*", "MailerImpl", ")", "SendMail", "(", "to", "[", "]", "string", ",", "subject", ",", "msg", "string", ")", "error", "{", "m", ".", "stats", ".", "Inc", "(", "\"", "\"", ",", "1", ")", "\n\n", "for", "{", "err", ":=", "m", ...
// SendMail sends an email to the provided list of recipients. The email body // is simple text.
[ "SendMail", "sends", "an", "email", "to", "the", "provided", "list", "of", "recipients", ".", "The", "email", "body", "is", "simple", "text", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mail/mailer.go#L327-L375
train
letsencrypt/boulder
sa/rollback.go
Rollback
func Rollback(tx *gorp.Transaction, err error) error { if txErr := tx.Rollback(); txErr != nil { return &RollbackError{ Err: err, RollbackErr: txErr, } } return err }
go
func Rollback(tx *gorp.Transaction, err error) error { if txErr := tx.Rollback(); txErr != nil { return &RollbackError{ Err: err, RollbackErr: txErr, } } return err }
[ "func", "Rollback", "(", "tx", "*", "gorp", ".", "Transaction", ",", "err", "error", ")", "error", "{", "if", "txErr", ":=", "tx", ".", "Rollback", "(", ")", ";", "txErr", "!=", "nil", "{", "return", "&", "RollbackError", "{", "Err", ":", "err", ",...
// Rollback rolls back the provided transaction. If the rollback fails for any // reason a `RollbackError` error is returned wrapping the original error. If no // rollback error occurs then the original error is returned.
[ "Rollback", "rolls", "back", "the", "provided", "transaction", ".", "If", "the", "rollback", "fails", "for", "any", "reason", "a", "RollbackError", "error", "is", "returned", "wrapping", "the", "original", "error", ".", "If", "no", "rollback", "error", "occurs...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/rollback.go#L32-L40
train
letsencrypt/boulder
ca/ca.go
noteSignError
func (ca *CertificateAuthorityImpl) noteSignError(err error) { if err != nil { if _, ok := err.(*pkcs11.Error); ok { ca.stats.Inc(metricHSMError, 1) } else if cfErr, ok := err.(*cferr.Error); ok { ca.stats.Inc(fmt.Sprintf("%s.%d", metricSigningError, cfErr.ErrorCode), 1) } } return }
go
func (ca *CertificateAuthorityImpl) noteSignError(err error) { if err != nil { if _, ok := err.(*pkcs11.Error); ok { ca.stats.Inc(metricHSMError, 1) } else if cfErr, ok := err.(*cferr.Error); ok { ca.stats.Inc(fmt.Sprintf("%s.%d", metricSigningError, cfErr.ErrorCode), 1) } } return }
[ "func", "(", "ca", "*", "CertificateAuthorityImpl", ")", "noteSignError", "(", "err", "error", ")", "{", "if", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "pkcs11", ".", "Error", ")", ";", "ok", "{", "ca", ".", "sta...
// noteSignError is called after operations that may cause a CFSSL // or PKCS11 signing error.
[ "noteSignError", "is", "called", "after", "operations", "that", "may", "cause", "a", "CFSSL", "or", "PKCS11", "signing", "error", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ca/ca.go#L305-L314
train
letsencrypt/boulder
ca/ca.go
GenerateOCSP
func (ca *CertificateAuthorityImpl) GenerateOCSP(ctx context.Context, xferObj core.OCSPSigningRequest) ([]byte, error) { cert, err := x509.ParseCertificate(xferObj.CertDER) if err != nil { ca.log.AuditErr(err.Error()) return nil, err } signRequest := ocsp.SignRequest{ Certificate: cert, Status: xferOb...
go
func (ca *CertificateAuthorityImpl) GenerateOCSP(ctx context.Context, xferObj core.OCSPSigningRequest) ([]byte, error) { cert, err := x509.ParseCertificate(xferObj.CertDER) if err != nil { ca.log.AuditErr(err.Error()) return nil, err } signRequest := ocsp.SignRequest{ Certificate: cert, Status: xferOb...
[ "func", "(", "ca", "*", "CertificateAuthorityImpl", ")", "GenerateOCSP", "(", "ctx", "context", ".", "Context", ",", "xferObj", "core", ".", "OCSPSigningRequest", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cert", ",", "err", ":=", "x509", ".", ...
// GenerateOCSP produces a new OCSP response and returns it
[ "GenerateOCSP", "produces", "a", "new", "OCSP", "response", "and", "returns", "it" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ca/ca.go#L386-L419
train
letsencrypt/boulder
ca/ca.go
IssueCertificateForPrecertificate
func (ca *CertificateAuthorityImpl) IssueCertificateForPrecertificate(ctx context.Context, req *caPB.IssueCertificateForPrecertificateRequest) (core.Certificate, error) { emptyCert := core.Certificate{} precert, err := x509.ParseCertificate(req.DER) if err != nil { return emptyCert, err } var scts []ct.SignedCer...
go
func (ca *CertificateAuthorityImpl) IssueCertificateForPrecertificate(ctx context.Context, req *caPB.IssueCertificateForPrecertificateRequest) (core.Certificate, error) { emptyCert := core.Certificate{} precert, err := x509.ParseCertificate(req.DER) if err != nil { return emptyCert, err } var scts []ct.SignedCer...
[ "func", "(", "ca", "*", "CertificateAuthorityImpl", ")", "IssueCertificateForPrecertificate", "(", "ctx", "context", ".", "Context", ",", "req", "*", "caPB", ".", "IssueCertificateForPrecertificateRequest", ")", "(", "core", ".", "Certificate", ",", "error", ")", ...
// IssueCertificateForPrecertificate takes a precertificate and a set of SCTs for that precertificate // and uses the signer to create and sign a certificate from them. The poison extension is removed // and a SCT list extension is inserted in its place. Except for this and the signature the certificate // exactly matc...
[ "IssueCertificateForPrecertificate", "takes", "a", "precertificate", "and", "a", "set", "of", "SCTs", "for", "that", "precertificate", "and", "uses", "the", "signer", "to", "create", "and", "sign", "a", "certificate", "from", "them", ".", "The", "poison", "exten...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ca/ca.go#L473-L504
train
letsencrypt/boulder
ca/ca.go
OrphanIntegrationLoop
func (ca *CertificateAuthorityImpl) OrphanIntegrationLoop() { for { if err := ca.integrateOrphan(); err != nil { if err == goque.ErrEmpty { time.Sleep(time.Minute) continue } ca.log.AuditErrf("failed to integrate orphaned certs: %s", err) } } }
go
func (ca *CertificateAuthorityImpl) OrphanIntegrationLoop() { for { if err := ca.integrateOrphan(); err != nil { if err == goque.ErrEmpty { time.Sleep(time.Minute) continue } ca.log.AuditErrf("failed to integrate orphaned certs: %s", err) } } }
[ "func", "(", "ca", "*", "CertificateAuthorityImpl", ")", "OrphanIntegrationLoop", "(", ")", "{", "for", "{", "if", "err", ":=", "ca", ".", "integrateOrphan", "(", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "goque", ".", "ErrEmpty", "{", "tim...
// OrphanIntegrationLoop runs a loop executing integrateOrphans and then waiting a minute. // It is split out into a separate function called directly by boulder-ca in order to make // testing the orphan queue functionality somewhat more simple.
[ "OrphanIntegrationLoop", "runs", "a", "loop", "executing", "integrateOrphans", "and", "then", "waiting", "a", "minute", ".", "It", "is", "split", "out", "into", "a", "separate", "function", "called", "directly", "by", "boulder", "-", "ca", "in", "order", "to",...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ca/ca.go#L694-L704
train