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
sa/model.go
Error
func (e errBadJSON) Error() string { return fmt.Sprintf( "%s: error unmarshaling JSON %q: %s", e.msg, string(e.json), e.err) }
go
func (e errBadJSON) Error() string { return fmt.Sprintf( "%s: error unmarshaling JSON %q: %s", e.msg, string(e.json), e.err) }
[ "func", "(", "e", "errBadJSON", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "msg", ",", "string", "(", "e", ".", "json", ")", ",", "e", ".", "err", ")", "\n", "}" ]
// Error returns an error message that includes the json.Unmarshal error as well // as the bad JSON data.
[ "Error", "returns", "an", "error", "message", "that", "includes", "the", "json", ".", "Unmarshal", "error", "as", "well", "as", "the", "bad", "JSON", "data", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L34-L40
train
letsencrypt/boulder
sa/model.go
badJSONError
func badJSONError(msg string, jsonData []byte, err error) error { return errBadJSON{ msg: msg, json: jsonData, err: err, } }
go
func badJSONError(msg string, jsonData []byte, err error) error { return errBadJSON{ msg: msg, json: jsonData, err: err, } }
[ "func", "badJSONError", "(", "msg", "string", ",", "jsonData", "[", "]", "byte", ",", "err", "error", ")", "error", "{", "return", "errBadJSON", "{", "msg", ":", "msg", ",", "json", ":", "jsonData", ",", "err", ":", "err", ",", "}", "\n", "}" ]
// badJSONError is a convenience function for constructing a errBadJSON instance // with the provided args.
[ "badJSONError", "is", "a", "convenience", "function", "for", "constructing", "a", "errBadJSON", "instance", "with", "the", "provided", "args", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L44-L50
train
letsencrypt/boulder
sa/model.go
selectRegistration
func selectRegistration(s dbOneSelector, q string, args ...interface{}) (*regModel, error) { var model regModel err := s.SelectOne( &model, "SELECT "+regFields+" FROM registrations "+q, args..., ) return &model, err }
go
func selectRegistration(s dbOneSelector, q string, args ...interface{}) (*regModel, error) { var model regModel err := s.SelectOne( &model, "SELECT "+regFields+" FROM registrations "+q, args..., ) return &model, err }
[ "func", "selectRegistration", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "*", "regModel", ",", "error", ")", "{", "var", "model", "regModel", "\n", "err", ":=", "s", ".", "SelectOne", "(", "&", ...
// selectRegistration selects all fields of one registration model
[ "selectRegistration", "selects", "all", "fields", "of", "one", "registration", "model" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L87-L95
train
letsencrypt/boulder
sa/model.go
selectPendingAuthz
func selectPendingAuthz(s dbOneSelector, q string, args ...interface{}) (*pendingauthzModel, error) { var model pendingauthzModel err := s.SelectOne( &model, "SELECT id, identifier, registrationID, status, expires, LockCol FROM pendingAuthorizations "+q, args..., ) return &model, err }
go
func selectPendingAuthz(s dbOneSelector, q string, args ...interface{}) (*pendingauthzModel, error) { var model pendingauthzModel err := s.SelectOne( &model, "SELECT id, identifier, registrationID, status, expires, LockCol FROM pendingAuthorizations "+q, args..., ) return &model, err }
[ "func", "selectPendingAuthz", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "*", "pendingauthzModel", ",", "error", ")", "{", "var", "model", "pendingauthzModel", "\n", "err", ":=", "s", ".", "SelectOne...
// selectPendingAuthz selects all fields of one pending authorization model
[ "selectPendingAuthz", "selects", "all", "fields", "of", "one", "pending", "authorization", "model" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L98-L106
train
letsencrypt/boulder
sa/model.go
selectAuthz
func selectAuthz(s dbOneSelector, q string, args ...interface{}) (*authzModel, error) { var model authzModel err := s.SelectOne( &model, "SELECT "+authzFields+" FROM authz "+q, args..., ) return &model, err }
go
func selectAuthz(s dbOneSelector, q string, args ...interface{}) (*authzModel, error) { var model authzModel err := s.SelectOne( &model, "SELECT "+authzFields+" FROM authz "+q, args..., ) return &model, err }
[ "func", "selectAuthz", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "*", "authzModel", ",", "error", ")", "{", "var", "model", "authzModel", "\n", "err", ":=", "s", ".", "SelectOne", "(", "&", "m...
// selectAuthz selects all fields of one authorization model
[ "selectAuthz", "selects", "all", "fields", "of", "one", "authorization", "model" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L111-L119
train
letsencrypt/boulder
sa/model.go
selectSctReceipt
func selectSctReceipt(s dbOneSelector, q string, args ...interface{}) (core.SignedCertificateTimestamp, error) { var model core.SignedCertificateTimestamp err := s.SelectOne( &model, "SELECT id, sctVersion, logID, timestamp, extensions, signature, certificateSerial, LockCol FROM sctReceipts "+q, args..., ) re...
go
func selectSctReceipt(s dbOneSelector, q string, args ...interface{}) (core.SignedCertificateTimestamp, error) { var model core.SignedCertificateTimestamp err := s.SelectOne( &model, "SELECT id, sctVersion, logID, timestamp, extensions, signature, certificateSerial, LockCol FROM sctReceipts "+q, args..., ) re...
[ "func", "selectSctReceipt", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "core", ".", "SignedCertificateTimestamp", ",", "error", ")", "{", "var", "model", "core", ".", "SignedCertificateTimestamp", "\n", ...
// selectSctReceipt selects all fields of one SignedCertificateTimestamp object
[ "selectSctReceipt", "selects", "all", "fields", "of", "one", "SignedCertificateTimestamp", "object" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L122-L130
train
letsencrypt/boulder
sa/model.go
SelectCertificate
func SelectCertificate(s dbOneSelector, q string, args ...interface{}) (core.Certificate, error) { var model core.Certificate err := s.SelectOne( &model, "SELECT "+certFields+" FROM certificates "+q, args..., ) return model, err }
go
func SelectCertificate(s dbOneSelector, q string, args ...interface{}) (core.Certificate, error) { var model core.Certificate err := s.SelectOne( &model, "SELECT "+certFields+" FROM certificates "+q, args..., ) return model, err }
[ "func", "SelectCertificate", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "core", ".", "Certificate", ",", "error", ")", "{", "var", "model", "core", ".", "Certificate", "\n", "err", ":=", "s", "."...
// SelectCertificate selects all fields of one certificate object
[ "SelectCertificate", "selects", "all", "fields", "of", "one", "certificate", "object" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L135-L143
train
letsencrypt/boulder
sa/model.go
SelectCertificates
func SelectCertificates(s dbSelector, q string, args map[string]interface{}) ([]core.Certificate, error) { var models []core.Certificate _, err := s.Select( &models, "SELECT "+certFields+" FROM certificates "+q, args) return models, err }
go
func SelectCertificates(s dbSelector, q string, args map[string]interface{}) ([]core.Certificate, error) { var models []core.Certificate _, err := s.Select( &models, "SELECT "+certFields+" FROM certificates "+q, args) return models, err }
[ "func", "SelectCertificates", "(", "s", "dbSelector", ",", "q", "string", ",", "args", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "[", "]", "core", ".", "Certificate", ",", "error", ")", "{", "var", "models", "[", "]", "core", ".", ...
// SelectCertificates selects all fields of multiple certificate objects
[ "SelectCertificates", "selects", "all", "fields", "of", "multiple", "certificate", "objects" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L146-L152
train
letsencrypt/boulder
sa/model.go
SelectCertificateStatus
func SelectCertificateStatus(s dbOneSelector, q string, args ...interface{}) (certStatusModel, error) { var model certStatusModel err := s.SelectOne( &model, "SELECT "+certStatusFields+" FROM certificateStatus "+q, args..., ) return model, err }
go
func SelectCertificateStatus(s dbOneSelector, q string, args ...interface{}) (certStatusModel, error) { var model certStatusModel err := s.SelectOne( &model, "SELECT "+certStatusFields+" FROM certificateStatus "+q, args..., ) return model, err }
[ "func", "SelectCertificateStatus", "(", "s", "dbOneSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "certStatusModel", ",", "error", ")", "{", "var", "model", "certStatusModel", "\n", "err", ":=", "s", ".", "SelectOne", "...
// SelectCertificateStatus selects all fields of one certificate status model
[ "SelectCertificateStatus", "selects", "all", "fields", "of", "one", "certificate", "status", "model" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L157-L165
train
letsencrypt/boulder
sa/model.go
SelectCertificateStatuses
func SelectCertificateStatuses(s dbSelector, q string, args ...interface{}) ([]core.CertificateStatus, error) { var models []core.CertificateStatus _, err := s.Select( &models, "SELECT "+certStatusFields+" FROM certificateStatus "+q, args..., ) return models, err }
go
func SelectCertificateStatuses(s dbSelector, q string, args ...interface{}) ([]core.CertificateStatus, error) { var models []core.CertificateStatus _, err := s.Select( &models, "SELECT "+certStatusFields+" FROM certificateStatus "+q, args..., ) return models, err }
[ "func", "SelectCertificateStatuses", "(", "s", "dbSelector", ",", "q", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "[", "]", "core", ".", "CertificateStatus", ",", "error", ")", "{", "var", "models", "[", "]", "core", ".", "Certificate...
// SelectCertificateStatuses selects all fields of multiple certificate status objects
[ "SelectCertificateStatuses", "selects", "all", "fields", "of", "multiple", "certificate", "status", "objects" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L168-L176
train
letsencrypt/boulder
sa/model.go
registrationToModel
func registrationToModel(r *core.Registration) (*regModel, error) { key, err := json.Marshal(r.Key) if err != nil { return nil, err } sha, err := core.KeyDigest(r.Key) if err != nil { return nil, err } if r.InitialIP == nil { return nil, fmt.Errorf("initialIP was nil") } if r.Contact == nil { r.Contac...
go
func registrationToModel(r *core.Registration) (*regModel, error) { key, err := json.Marshal(r.Key) if err != nil { return nil, err } sha, err := core.KeyDigest(r.Key) if err != nil { return nil, err } if r.InitialIP == nil { return nil, fmt.Errorf("initialIP was nil") } if r.Contact == nil { r.Contac...
[ "func", "registrationToModel", "(", "r", "*", "core", ".", "Registration", ")", "(", "*", "regModel", ",", "error", ")", "{", "key", ",", "err", ":=", "json", ".", "Marshal", "(", "r", ".", "Key", ")", "\n", "if", "err", "!=", "nil", "{", "return",...
// newReg creates a reg model object from a core.Registration
[ "newReg", "creates", "a", "reg", "model", "object", "from", "a", "core", ".", "Registration" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L242-L270
train
letsencrypt/boulder
sa/model.go
hasMultipleNonPendingChallenges
func hasMultipleNonPendingChallenges(challenges []*corepb.Challenge) bool { nonPending := false for _, c := range challenges { if *c.Status == string(core.StatusValid) || *c.Status == string(core.StatusInvalid) { if !nonPending { nonPending = true } else { return true } } } return false }
go
func hasMultipleNonPendingChallenges(challenges []*corepb.Challenge) bool { nonPending := false for _, c := range challenges { if *c.Status == string(core.StatusValid) || *c.Status == string(core.StatusInvalid) { if !nonPending { nonPending = true } else { return true } } } return false }
[ "func", "hasMultipleNonPendingChallenges", "(", "challenges", "[", "]", "*", "corepb", ".", "Challenge", ")", "bool", "{", "nonPending", ":=", "false", "\n", "for", "_", ",", "c", ":=", "range", "challenges", "{", "if", "*", "c", ".", "Status", "==", "st...
// hasMultipleNonPendingChallenges checks if a slice of challenges contains // more than one non-pending challenge
[ "hasMultipleNonPendingChallenges", "checks", "if", "a", "slice", "of", "challenges", "contains", "more", "than", "one", "non", "-", "pending", "challenge" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/model.go#L503-L515
train
letsencrypt/boulder
grpc/interceptors.go
observeLatency
func (si *serverInterceptor) observeLatency(clientReqTime string) error { // Convert the metadata request time into an int64 reqTimeUnixNanos, err := strconv.ParseInt(clientReqTime, 10, 64) if err != nil { return berrors.InternalServerError("grpc metadata had illegal %s value: %q - %s", clientRequestTimeKey, cl...
go
func (si *serverInterceptor) observeLatency(clientReqTime string) error { // Convert the metadata request time into an int64 reqTimeUnixNanos, err := strconv.ParseInt(clientReqTime, 10, 64) if err != nil { return berrors.InternalServerError("grpc metadata had illegal %s value: %q - %s", clientRequestTimeKey, cl...
[ "func", "(", "si", "*", "serverInterceptor", ")", "observeLatency", "(", "clientReqTime", "string", ")", "error", "{", "// Convert the metadata request time into an int64", "reqTimeUnixNanos", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "clientReqTime", ",", "1...
// observeLatency is called with the `clientRequestTimeKey` value from // a request's gRPC metadata. This string value is converted to a timestamp and // used to calcuate the latency between send and receive time. The latency is // published to the server interceptor's rpcLag prometheus histogram. An error // is return...
[ "observeLatency", "is", "called", "with", "the", "clientRequestTimeKey", "value", "from", "a", "request", "s", "gRPC", "metadata", ".", "This", "string", "value", "is", "converted", "to", "a", "timestamp", "and", "used", "to", "calcuate", "the", "latency", "be...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/interceptors.go#L100-L113
train
letsencrypt/boulder
cmd/gen-key/ecdsa.go
ecArgs
func ecArgs(label string, curve *elliptic.CurveParams, keyID []byte) generateArgs { encodedCurve := curveToOIDDER[curve.Name] log.Printf("\tEncoded curve parameters for %s: %X\n", curve.Params().Name, encodedCurve) return generateArgs{ mechanism: []*pkcs11.Mechanism{ pkcs11.NewMechanism(pkcs11.CKM_EC_KEY_PAIR_G...
go
func ecArgs(label string, curve *elliptic.CurveParams, keyID []byte) generateArgs { encodedCurve := curveToOIDDER[curve.Name] log.Printf("\tEncoded curve parameters for %s: %X\n", curve.Params().Name, encodedCurve) return generateArgs{ mechanism: []*pkcs11.Mechanism{ pkcs11.NewMechanism(pkcs11.CKM_EC_KEY_PAIR_G...
[ "func", "ecArgs", "(", "label", "string", ",", "curve", "*", "elliptic", ".", "CurveParams", ",", "keyID", "[", "]", "byte", ")", "generateArgs", "{", "encodedCurve", ":=", "curveToOIDDER", "[", "curve", ".", "Name", "]", "\n", "log", ".", "Printf", "(",...
// ecArgs constructs the private and public key template attributes sent to the // device and specifies which mechanism should be used. curve determines which // type of key should be generated.
[ "ecArgs", "constructs", "the", "private", "and", "public", "key", "template", "attributes", "sent", "to", "the", "device", "and", "specifies", "which", "mechanism", "should", "be", "used", ".", "curve", "determines", "which", "type", "of", "key", "should", "be...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/ecdsa.go#L57-L83
train
letsencrypt/boulder
cmd/gen-key/ecdsa.go
ecPub
func ecPub( ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, expectedCurve *elliptic.CurveParams, ) (*ecdsa.PublicKey, error) { pubKey, err := pkcs11helpers.GetECDSAPublicKey(ctx, session, object) if err != nil { return nil, err } if pubKey.Curve != expectedCurve { return n...
go
func ecPub( ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, expectedCurve *elliptic.CurveParams, ) (*ecdsa.PublicKey, error) { pubKey, err := pkcs11helpers.GetECDSAPublicKey(ctx, session, object) if err != nil { return nil, err } if pubKey.Curve != expectedCurve { return n...
[ "func", "ecPub", "(", "ctx", "pkcs11helpers", ".", "PKCtx", ",", "session", "pkcs11", ".", "SessionHandle", ",", "object", "pkcs11", ".", "ObjectHandle", ",", "expectedCurve", "*", "elliptic", ".", "CurveParams", ",", ")", "(", "*", "ecdsa", ".", "PublicKey"...
// ecPub extracts the generated public key, specified by the provided object // handle, and constructs an ecdsa.PublicKey. It also checks that the key is of // the correct curve type.
[ "ecPub", "extracts", "the", "generated", "public", "key", "specified", "by", "the", "provided", "object", "handle", "and", "constructs", "an", "ecdsa", ".", "PublicKey", ".", "It", "also", "checks", "that", "the", "key", "is", "of", "the", "correct", "curve"...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/ecdsa.go#L88-L104
train
letsencrypt/boulder
cmd/gen-key/ecdsa.go
ecVerify
func ecVerify(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, pub *ecdsa.PublicKey) error { nonce, err := getRandomBytes(ctx, session) if err != nil { return fmt.Errorf("failed to construct nonce: %s", err) } log.Printf("\tConstructed nonce: %d (%X)\n", big.NewInt(0).SetBytes(no...
go
func ecVerify(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, pub *ecdsa.PublicKey) error { nonce, err := getRandomBytes(ctx, session) if err != nil { return fmt.Errorf("failed to construct nonce: %s", err) } log.Printf("\tConstructed nonce: %d (%X)\n", big.NewInt(0).SetBytes(no...
[ "func", "ecVerify", "(", "ctx", "pkcs11helpers", ".", "PKCtx", ",", "session", "pkcs11", ".", "SessionHandle", ",", "object", "pkcs11", ".", "ObjectHandle", ",", "pub", "*", "ecdsa", ".", "PublicKey", ")", "error", "{", "nonce", ",", "err", ":=", "getRando...
// ecVerify verifies that the extracted public key corresponds with the generated // private key on the device, specified by the provided object handle, by signing // a nonce generated on the device and verifying the returned signature using the // public key.
[ "ecVerify", "verifies", "that", "the", "extracted", "public", "key", "corresponds", "with", "the", "generated", "private", "key", "on", "the", "device", "specified", "by", "the", "provided", "object", "handle", "by", "signing", "a", "nonce", "generated", "on", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/ecdsa.go#L110-L132
train
letsencrypt/boulder
cmd/gen-key/ecdsa.go
ecGenerate
func ecGenerate(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label, curveStr string) (*ecdsa.PublicKey, error) { curve, present := stringToCurve[curveStr] if !present { return nil, fmt.Errorf("curve %q not supported", curveStr) } keyID := make([]byte, 4) _, err := rand.Read(keyID) if err != nil { re...
go
func ecGenerate(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label, curveStr string) (*ecdsa.PublicKey, error) { curve, present := stringToCurve[curveStr] if !present { return nil, fmt.Errorf("curve %q not supported", curveStr) } keyID := make([]byte, 4) _, err := rand.Read(keyID) if err != nil { re...
[ "func", "ecGenerate", "(", "ctx", "pkcs11helpers", ".", "PKCtx", ",", "session", "pkcs11", ".", "SessionHandle", ",", "label", ",", "curveStr", "string", ")", "(", "*", "ecdsa", ".", "PublicKey", ",", "error", ")", "{", "curve", ",", "present", ":=", "st...
// ecGenerate is used to generate and verify a ECDSA key pair of the type // specified by curveStr and with the provided label. It returns the public // part of the generated key pair as a ecdsa.PublicKey.
[ "ecGenerate", "is", "used", "to", "generate", "and", "verify", "a", "ECDSA", "key", "pair", "of", "the", "type", "specified", "by", "curveStr", "and", "with", "the", "provided", "label", ".", "It", "returns", "the", "public", "part", "of", "the", "generate...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/ecdsa.go#L137-L167
train
letsencrypt/boulder
va/http.go
DialContext
func (d *preresolvedDialer) DialContext( ctx context.Context, network, origAddr string) (net.Conn, error) { deadline, ok := ctx.Deadline() if !ok { // Shouldn't happen: All requests should have a deadline by this point. deadline = time.Now().Add(100 * time.Second) } else { // Set the context deadline slight...
go
func (d *preresolvedDialer) DialContext( ctx context.Context, network, origAddr string) (net.Conn, error) { deadline, ok := ctx.Deadline() if !ok { // Shouldn't happen: All requests should have a deadline by this point. deadline = time.Now().Add(100 * time.Second) } else { // Set the context deadline slight...
[ "func", "(", "d", "*", "preresolvedDialer", ")", "DialContext", "(", "ctx", "context", ".", "Context", ",", "network", ",", "origAddr", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "deadline", ",", "ok", ":=", "ctx", ".", "Deadline",...
// DialContext for a preresolvedDialer shaves 10ms off of the context it was // given before calling the default transport DialContext using the pre-resolved // IP and port as the host. If the original host being dialed by DialContext // does not match the expected hostname in the preresolvedDialer an error will // be ...
[ "DialContext", "for", "a", "preresolvedDialer", "shaves", "10ms", "off", "of", "the", "context", "it", "was", "given", "before", "calling", "the", "default", "transport", "DialContext", "using", "the", "pre", "-", "resolved", "IP", "and", "port", "as", "the", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L78-L132
train
letsencrypt/boulder
va/http.go
httpTransport
func httpTransport(df dialerFunc) *http.Transport { return &http.Transport{ DialContext: df, // We are talking to a client that does not yet have a certificate, // so we accept a temporary, invalid one. TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // We don't expect to make multiple requests to a ...
go
func httpTransport(df dialerFunc) *http.Transport { return &http.Transport{ DialContext: df, // We are talking to a client that does not yet have a certificate, // so we accept a temporary, invalid one. TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // We don't expect to make multiple requests to a ...
[ "func", "httpTransport", "(", "df", "dialerFunc", ")", "*", "http", ".", "Transport", "{", "return", "&", "http", ".", "Transport", "{", "DialContext", ":", "df", ",", "// We are talking to a client that does not yet have a certificate,", "// so we accept a temporary, inv...
// httpTransport constructs a HTTP Transport with settings appropriate for // HTTP-01 validation. The provided dialerFunc is used as the Transport's // DialContext handler.
[ "httpTransport", "constructs", "a", "HTTP", "Transport", "with", "settings", "appropriate", "for", "HTTP", "-", "01", "validation", ".", "The", "provided", "dialerFunc", "is", "used", "as", "the", "Transport", "s", "DialContext", "handler", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L141-L155
train
letsencrypt/boulder
va/http.go
newHTTPValidationTarget
func (va *ValidationAuthorityImpl) newHTTPValidationTarget( ctx context.Context, host string, port int, path string, query string) (*httpValidationTarget, error) { // Resolve IP addresses for the hostname addrs, err := va.getAddrs(ctx, host) if err != nil { // Convert the error into a ConnectionFailureError s...
go
func (va *ValidationAuthorityImpl) newHTTPValidationTarget( ctx context.Context, host string, port int, path string, query string) (*httpValidationTarget, error) { // Resolve IP addresses for the hostname addrs, err := va.getAddrs(ctx, host) if err != nil { // Convert the error into a ConnectionFailureError s...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "newHTTPValidationTarget", "(", "ctx", "context", ".", "Context", ",", "host", "string", ",", "port", "int", ",", "path", "string", ",", "query", "string", ")", "(", "*", "httpValidationTarget", ",", "e...
// newHTTPValidationTarget creates a httpValidationTarget for the given host, // port, and path. This involves querying DNS for the IP addresses for the host. // An error is returned if there are no usable IP addresses or if the DNS // lookups fail.
[ "newHTTPValidationTarget", "creates", "a", "httpValidationTarget", "for", "the", "given", "host", "port", "and", "path", ".", "This", "involves", "querying", "DNS", "for", "the", "IP", "addresses", "for", "the", "host", ".", "An", "error", "is", "returned", "i...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L206-L254
train
letsencrypt/boulder
va/http.go
extractRequestTarget
func (va *ValidationAuthorityImpl) extractRequestTarget(req *http.Request) (string, int, error) { // A nil request is certainly not a valid redirect and has no port to extract. if req == nil { return "", 0, fmt.Errorf("redirect HTTP request was nil") } reqScheme := req.URL.Scheme // The redirect request must u...
go
func (va *ValidationAuthorityImpl) extractRequestTarget(req *http.Request) (string, int, error) { // A nil request is certainly not a valid redirect and has no port to extract. if req == nil { return "", 0, fmt.Errorf("redirect HTTP request was nil") } reqScheme := req.URL.Scheme // The redirect request must u...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "extractRequestTarget", "(", "req", "*", "http", ".", "Request", ")", "(", "string", ",", "int", ",", "error", ")", "{", "// A nil request is certainly not a valid redirect and has no port to extract.", "if", "re...
// extractRequestTarget extracts the hostname and port specified in the provided // HTTP redirect request. If the request's URL's protocol schema is not HTTP or // HTTPS an error is returned. If an explicit port is specified in the request's // URL and it isn't the VA's HTTP or HTTPS port, an error is returned. If the ...
[ "extractRequestTarget", "extracts", "the", "hostname", "and", "port", "specified", "in", "the", "provided", "HTTP", "redirect", "request", ".", "If", "the", "request", "s", "URL", "s", "protocol", "schema", "is", "not", "HTTP", "or", "HTTPS", "an", "error", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L262-L339
train
letsencrypt/boulder
va/http.go
setupHTTPValidation
func (va *ValidationAuthorityImpl) setupHTTPValidation( ctx context.Context, reqURL string, target *httpValidationTarget) (*preresolvedDialer, core.ValidationRecord, error) { if reqURL == "" { return nil, core.ValidationRecord{}, fmt.Errorf("reqURL can not be nil") } if target == nil { // This is the on...
go
func (va *ValidationAuthorityImpl) setupHTTPValidation( ctx context.Context, reqURL string, target *httpValidationTarget) (*preresolvedDialer, core.ValidationRecord, error) { if reqURL == "" { return nil, core.ValidationRecord{}, fmt.Errorf("reqURL can not be nil") } if target == nil { // This is the on...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "setupHTTPValidation", "(", "ctx", "context", ".", "Context", ",", "reqURL", "string", ",", "target", "*", "httpValidationTarget", ")", "(", "*", "preresolvedDialer", ",", "core", ".", "ValidationRecord", "...
// setupHTTPValidation sets up a preresolvedDialer and a validation record for // the given request URL and httpValidationTarget. If the req URL is empty, or // the validation target is nil or has no available IP addresses, an error will // be returned.
[ "setupHTTPValidation", "sets", "up", "a", "preresolvedDialer", "and", "a", "validation", "record", "for", "the", "given", "request", "URL", "and", "httpValidationTarget", ".", "If", "the", "req", "URL", "is", "empty", "or", "the", "validation", "target", "is", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L345-L389
train
letsencrypt/boulder
va/http.go
fetchHTTP
func (va *ValidationAuthorityImpl) fetchHTTP( ctx context.Context, host string, path string) ([]byte, []core.ValidationRecord, *probs.ProblemDetails) { body, records, err := va.processHTTPValidation(ctx, host, path) if err != nil { // Use detailedError to convert the error into a problem return body, records, ...
go
func (va *ValidationAuthorityImpl) fetchHTTP( ctx context.Context, host string, path string) ([]byte, []core.ValidationRecord, *probs.ProblemDetails) { body, records, err := va.processHTTPValidation(ctx, host, path) if err != nil { // Use detailedError to convert the error into a problem return body, records, ...
[ "func", "(", "va", "*", "ValidationAuthorityImpl", ")", "fetchHTTP", "(", "ctx", "context", ".", "Context", ",", "host", "string", ",", "path", "string", ")", "(", "[", "]", "byte", ",", "[", "]", "core", ".", "ValidationRecord", ",", "*", "probs", "."...
// fetchHTTP invokes processHTTPValidation and if an error result is // returned, converts it to a problem. Otherwise the results from // processHTTPValidation are returned.
[ "fetchHTTP", "invokes", "processHTTPValidation", "and", "if", "an", "error", "result", "is", "returned", "converts", "it", "to", "a", "problem", ".", "Otherwise", "the", "results", "from", "processHTTPValidation", "are", "returned", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/http.go#L394-L404
train
letsencrypt/boulder
cmd/shell.go
StatsAndLogging
func StatsAndLogging(logConf SyslogConfig, addr string) (metrics.Scope, blog.Logger) { logger := NewLogger(logConf) scope := newScope(addr, logger) return scope, logger }
go
func StatsAndLogging(logConf SyslogConfig, addr string) (metrics.Scope, blog.Logger) { logger := NewLogger(logConf) scope := newScope(addr, logger) return scope, logger }
[ "func", "StatsAndLogging", "(", "logConf", "SyslogConfig", ",", "addr", "string", ")", "(", "metrics", ".", "Scope", ",", "blog", ".", "Logger", ")", "{", "logger", ":=", "NewLogger", "(", "logConf", ")", "\n", "scope", ":=", "newScope", "(", "addr", ","...
// StatsAndLogging constructs a metrics.Scope and an AuditLogger based on its config // parameters, and return them both. It also spawns off an HTTP server on the // provided port to report the stats and provide pprof profiling handlers. // Crashes if any setup fails. // Also sets the constructed AuditLogger as the def...
[ "StatsAndLogging", "constructs", "a", "metrics", ".", "Scope", "and", "an", "AuditLogger", "based", "on", "its", "config", "parameters", "and", "return", "them", "both", ".", "It", "also", "spawns", "off", "an", "HTTP", "server", "on", "the", "provided", "po...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L153-L157
train
letsencrypt/boulder
cmd/shell.go
Fail
func Fail(msg string) { logger := blog.Get() logger.AuditErr(msg) fmt.Fprintf(os.Stderr, msg) os.Exit(1) }
go
func Fail(msg string) { logger := blog.Get() logger.AuditErr(msg) fmt.Fprintf(os.Stderr, msg) os.Exit(1) }
[ "func", "Fail", "(", "msg", "string", ")", "{", "logger", ":=", "blog", ".", "Get", "(", ")", "\n", "logger", ".", "AuditErr", "(", "msg", ")", "\n", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "msg", ")", "\n", "os", ".", "Exit", "("...
// Fail exits and prints an error message to stderr and the logger audit log.
[ "Fail", "exits", "and", "prints", "an", "error", "message", "to", "stderr", "and", "the", "logger", "audit", "log", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L221-L226
train
letsencrypt/boulder
cmd/shell.go
FailOnError
func FailOnError(err error, msg string) { if err != nil { msg := fmt.Sprintf("%s: %s", msg, err) Fail(msg) } }
go
func FailOnError(err error, msg string) { if err != nil { msg := fmt.Sprintf("%s: %s", msg, err) Fail(msg) } }
[ "func", "FailOnError", "(", "err", "error", ",", "msg", "string", ")", "{", "if", "err", "!=", "nil", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "msg", ",", "err", ")", "\n", "Fail", "(", "msg", ")", "\n", "}", "\n", "}" ]
// FailOnError exits and prints an error message, but only if we encountered // a problem and err != nil
[ "FailOnError", "exits", "and", "prints", "an", "error", "message", "but", "only", "if", "we", "encountered", "a", "problem", "and", "err", "!", "=", "nil" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L230-L235
train
letsencrypt/boulder
cmd/shell.go
LoadCert
func LoadCert(path string) (cert []byte, err error) { if path == "" { err = errors.New("Issuer certificate was not provided in config.") return } pemBytes, err := ioutil.ReadFile(path) if err != nil { return } block, _ := pem.Decode(pemBytes) if block == nil || block.Type != "CERTIFICATE" { err = errors...
go
func LoadCert(path string) (cert []byte, err error) { if path == "" { err = errors.New("Issuer certificate was not provided in config.") return } pemBytes, err := ioutil.ReadFile(path) if err != nil { return } block, _ := pem.Decode(pemBytes) if block == nil || block.Type != "CERTIFICATE" { err = errors...
[ "func", "LoadCert", "(", "path", "string", ")", "(", "cert", "[", "]", "byte", ",", "err", "error", ")", "{", "if", "path", "==", "\"", "\"", "{", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "pemByte...
// LoadCert loads a PEM-formatted certificate from the provided path, returning // it as a byte array, or an error if it couldn't be decoded.
[ "LoadCert", "loads", "a", "PEM", "-", "formatted", "certificate", "from", "the", "provided", "path", "returning", "it", "as", "a", "byte", "array", "or", "an", "error", "if", "it", "couldn", "t", "be", "decoded", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L239-L257
train
letsencrypt/boulder
cmd/shell.go
ReadConfigFile
func ReadConfigFile(filename string, out interface{}) error { configData, err := ioutil.ReadFile(filename) if err != nil { return err } return json.Unmarshal(configData, out) }
go
func ReadConfigFile(filename string, out interface{}) error { configData, err := ioutil.ReadFile(filename) if err != nil { return err } return json.Unmarshal(configData, out) }
[ "func", "ReadConfigFile", "(", "filename", "string", ",", "out", "interface", "{", "}", ")", "error", "{", "configData", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}",...
// ReadConfigFile takes a file path as an argument and attempts to // unmarshal the content of the file into a struct containing a // configuration of a boulder component.
[ "ReadConfigFile", "takes", "a", "file", "path", "as", "an", "argument", "and", "attempts", "to", "unmarshal", "the", "content", "of", "the", "file", "into", "a", "struct", "containing", "a", "configuration", "of", "a", "boulder", "component", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L262-L268
train
letsencrypt/boulder
cmd/shell.go
VersionString
func VersionString() string { name := path.Base(os.Args[0]) return fmt.Sprintf("Versions: %s=(%s %s) Golang=(%s) BuildHost=(%s)", name, core.GetBuildID(), core.GetBuildTime(), runtime.Version(), core.GetBuildHost()) }
go
func VersionString() string { name := path.Base(os.Args[0]) return fmt.Sprintf("Versions: %s=(%s %s) Golang=(%s) BuildHost=(%s)", name, core.GetBuildID(), core.GetBuildTime(), runtime.Version(), core.GetBuildHost()) }
[ "func", "VersionString", "(", ")", "string", "{", "name", ":=", "path", ".", "Base", "(", "os", ".", "Args", "[", "0", "]", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "core", ".", "GetBuildID", "(", ")", ",", ...
// VersionString produces a friendly Application version string.
[ "VersionString", "produces", "a", "friendly", "Application", "version", "string", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L271-L274
train
letsencrypt/boulder
cmd/shell.go
CatchSignals
func CatchSignals(logger blog.Logger, callback func()) { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) signal.Notify(sigChan, syscall.SIGINT) signal.Notify(sigChan, syscall.SIGHUP) sig := <-sigChan if logger != nil { logger.Infof("Caught %s", signalToName[sig]) } if callback != ...
go
func CatchSignals(logger blog.Logger, callback func()) { sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM) signal.Notify(sigChan, syscall.SIGINT) signal.Notify(sigChan, syscall.SIGHUP) sig := <-sigChan if logger != nil { logger.Infof("Caught %s", signalToName[sig]) } if callback != ...
[ "func", "CatchSignals", "(", "logger", "blog", ".", "Logger", ",", "callback", "func", "(", ")", ")", "{", "sigChan", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "1", ")", "\n", "signal", ".", "Notify", "(", "sigChan", ",", "syscall", ".", ...
// CatchSignals catches SIGTERM, SIGINT, SIGHUP and executes a callback // method before exiting
[ "CatchSignals", "catches", "SIGTERM", "SIGINT", "SIGHUP", "and", "executes", "a", "callback", "method", "before", "exiting" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/shell.go#L284-L303
train
letsencrypt/boulder
cmd/expired-authz-purger/main.go
saveCheckpoint
func saveCheckpoint(checkpointFile, id string) error { tmpDir, err := ioutil.TempDir("", "checkpoint-tmp") if err != nil { return err } defer func() { _ = os.RemoveAll(tmpDir) }() tmp, err := ioutil.TempFile(tmpDir, "checkpoint-atomic") if err != nil { return err } if _, err = tmp.Write([]byte(id)); err != ...
go
func saveCheckpoint(checkpointFile, id string) error { tmpDir, err := ioutil.TempDir("", "checkpoint-tmp") if err != nil { return err } defer func() { _ = os.RemoveAll(tmpDir) }() tmp, err := ioutil.TempFile(tmpDir, "checkpoint-atomic") if err != nil { return err } if _, err = tmp.Write([]byte(id)); err != ...
[ "func", "saveCheckpoint", "(", "checkpointFile", ",", "id", "string", ")", "error", "{", "tmpDir", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "...
// saveCheckpoint atomically writes the provided ID to the provided file. The // method os.Rename makes use of the renameat syscall to atomically replace // one file with another. It creates a temporary file in a temporary directory // before using os.Rename to replace the old file with the new one.
[ "saveCheckpoint", "atomically", "writes", "the", "provided", "ID", "to", "the", "provided", "file", ".", "The", "method", "os", ".", "Rename", "makes", "use", "of", "the", "renameat", "syscall", "to", "atomically", "replace", "one", "file", "with", "another", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/expired-authz-purger/main.go#L93-L107
train
letsencrypt/boulder
cmd/expired-authz-purger/main.go
getWork
func (p *expiredAuthzPurger) getWork(work chan string, query string, initialID string, purgeBefore time.Time, batchSize int64) (string, int, error) { var idBatch []string _, err := p.db.Select( &idBatch, query, map[string]interface{}{ "id": initialID, "expires": purgeBefore, "limit": batchSize, ...
go
func (p *expiredAuthzPurger) getWork(work chan string, query string, initialID string, purgeBefore time.Time, batchSize int64) (string, int, error) { var idBatch []string _, err := p.db.Select( &idBatch, query, map[string]interface{}{ "id": initialID, "expires": purgeBefore, "limit": batchSize, ...
[ "func", "(", "p", "*", "expiredAuthzPurger", ")", "getWork", "(", "work", "chan", "string", ",", "query", "string", ",", "initialID", "string", ",", "purgeBefore", "time", ".", "Time", ",", "batchSize", "int64", ")", "(", "string", ",", "int", ",", "erro...
// getWork selects a set of authorizations that expired before purgeBefore, bounded by batchSize, // that have IDs that are more than initialID from either the pendingAuthorizations or authz tables // and adds them to the work channel. It returns the last ID it selected and the number of IDs it // added to the work cha...
[ "getWork", "selects", "a", "set", "of", "authorizations", "that", "expired", "before", "purgeBefore", "bounded", "by", "batchSize", "that", "have", "IDs", "that", "are", "more", "than", "initialID", "from", "either", "the", "pendingAuthorizations", "or", "authz", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/expired-authz-purger/main.go#L113-L138
train
letsencrypt/boulder
cmd/expired-authz-purger/main.go
deleteAuthorizations
func (p *expiredAuthzPurger) deleteAuthorizations(work chan string, maxDPS int, parallelism int, table string, checkpointFile string) { wg := new(sync.WaitGroup) deleted := int64(0) var ticker *time.Ticker if maxDPS > 0 { ticker = time.NewTicker(time.Duration(float64(time.Second) / float64(maxDPS))) } for i := ...
go
func (p *expiredAuthzPurger) deleteAuthorizations(work chan string, maxDPS int, parallelism int, table string, checkpointFile string) { wg := new(sync.WaitGroup) deleted := int64(0) var ticker *time.Ticker if maxDPS > 0 { ticker = time.NewTicker(time.Duration(float64(time.Second) / float64(maxDPS))) } for i := ...
[ "func", "(", "p", "*", "expiredAuthzPurger", ")", "deleteAuthorizations", "(", "work", "chan", "string", ",", "maxDPS", "int", ",", "parallelism", "int", ",", "table", "string", ",", "checkpointFile", "string", ")", "{", "wg", ":=", "new", "(", "sync", "."...
// deleteAuthorizations reads from the work channel and deletes each authorization // from either the pendingAuthorization or authz tables. If maxDPS is more than 0 // it will throttle the number of DELETE statements it generates to the passed rate.
[ "deleteAuthorizations", "reads", "from", "the", "work", "channel", "and", "deletes", "each", "authorization", "from", "either", "the", "pendingAuthorization", "or", "authz", "tables", ".", "If", "maxDPS", "is", "more", "than", "0", "it", "will", "throttle", "the...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/expired-authz-purger/main.go#L143-L177
train
letsencrypt/boulder
metrics/measured_http/http.go
Write
func (r *responseWriterWithStatus) Write(body []byte) (int, error) { if r.code == 0 { r.code = http.StatusOK } return r.ResponseWriter.Write(body) }
go
func (r *responseWriterWithStatus) Write(body []byte) (int, error) { if r.code == 0 { r.code = http.StatusOK } return r.ResponseWriter.Write(body) }
[ "func", "(", "r", "*", "responseWriterWithStatus", ")", "Write", "(", "body", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "r", ".", "code", "==", "0", "{", "r", ".", "code", "=", "http", ".", "StatusOK", "\n", "}", "\n", "r...
// Write writes the body and sets the status code to 200 if a status code // has not already been set.
[ "Write", "writes", "the", "body", "and", "sets", "the", "status", "code", "to", "200", "if", "a", "status", "code", "has", "not", "already", "been", "set", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/measured_http/http.go#L27-L32
train
letsencrypt/boulder
canceled/canceled.go
Is
func Is(err error) bool { return err == context.Canceled || grpc.Code(err) == codes.Canceled }
go
func Is(err error) bool { return err == context.Canceled || grpc.Code(err) == codes.Canceled }
[ "func", "Is", "(", "err", "error", ")", "bool", "{", "return", "err", "==", "context", ".", "Canceled", "||", "grpc", ".", "Code", "(", "err", ")", "==", "codes", ".", "Canceled", "\n", "}" ]
// Is returns true if err is non-nil and is either context.Canceled, or has a // grpc code of Canceled. This is useful because cancelations propagate through // gRPC boundaries, and if we choose to treat in-process cancellations a certain // way, we usually want to treat cross-process cancellations the same way.
[ "Is", "returns", "true", "if", "err", "is", "non", "-", "nil", "and", "is", "either", "context", ".", "Canceled", "or", "has", "a", "grpc", "code", "of", "Canceled", ".", "This", "is", "useful", "because", "cancelations", "propagate", "through", "gRPC", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/canceled/canceled.go#L14-L16
train
letsencrypt/boulder
ra/ra.go
NewRegistrationAuthorityImpl
func NewRegistrationAuthorityImpl( clk clock.Clock, logger blog.Logger, stats metrics.Scope, maxContactsPerReg int, keyPolicy goodkey.KeyPolicy, maxNames int, forceCNFromSAN bool, reuseValidAuthz bool, authorizationLifetime time.Duration, pendingAuthorizationLifetime time.Duration, pubc core.Publisher, caaC...
go
func NewRegistrationAuthorityImpl( clk clock.Clock, logger blog.Logger, stats metrics.Scope, maxContactsPerReg int, keyPolicy goodkey.KeyPolicy, maxNames int, forceCNFromSAN bool, reuseValidAuthz bool, authorizationLifetime time.Duration, pendingAuthorizationLifetime time.Duration, pubc core.Publisher, caaC...
[ "func", "NewRegistrationAuthorityImpl", "(", "clk", "clock", ".", "Clock", ",", "logger", "blog", ".", "Logger", ",", "stats", "metrics", ".", "Scope", ",", "maxContactsPerReg", "int", ",", "keyPolicy", "goodkey", ".", "KeyPolicy", ",", "maxNames", "int", ",",...
// NewRegistrationAuthorityImpl constructs a new RA object.
[ "NewRegistrationAuthorityImpl", "constructs", "a", "new", "RA", "object", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L92-L147
train
letsencrypt/boulder
ra/ra.go
checkRegistrationIPLimit
func (ra *RegistrationAuthorityImpl) checkRegistrationIPLimit( ctx context.Context, limit ratelimit.RateLimitPolicy, ip net.IP, counter registrationCounter) error { if !limit.Enabled() { return nil } now := ra.clk.Now() windowBegin := limit.WindowBegin(now) count, err := counter(ctx, ip, windowBegin, now) ...
go
func (ra *RegistrationAuthorityImpl) checkRegistrationIPLimit( ctx context.Context, limit ratelimit.RateLimitPolicy, ip net.IP, counter registrationCounter) error { if !limit.Enabled() { return nil } now := ra.clk.Now() windowBegin := limit.WindowBegin(now) count, err := counter(ctx, ip, windowBegin, now) ...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkRegistrationIPLimit", "(", "ctx", "context", ".", "Context", ",", "limit", "ratelimit", ".", "RateLimitPolicy", ",", "ip", "net", ".", "IP", ",", "counter", "registrationCounter", ")", "error", "{",...
// checkRegistrationIPLimit checks a specific registraton limit by using the // provided registrationCounter function to determine if the limit has been // exceeded for a given IP or IP range
[ "checkRegistrationIPLimit", "checks", "a", "specific", "registraton", "limit", "by", "using", "the", "provided", "registrationCounter", "function", "to", "determine", "if", "the", "limit", "has", "been", "exceeded", "for", "a", "given", "IP", "or", "IP", "range" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L216-L238
train
letsencrypt/boulder
ra/ra.go
checkRegistrationLimits
func (ra *RegistrationAuthorityImpl) checkRegistrationLimits(ctx context.Context, ip net.IP) error { // Check the registrations per IP limit using the CountRegistrationsByIP SA // function that matches IP addresses exactly exactRegLimit := ra.rlPolicies.RegistrationsPerIP() err := ra.checkRegistrationIPLimit(ctx, e...
go
func (ra *RegistrationAuthorityImpl) checkRegistrationLimits(ctx context.Context, ip net.IP) error { // Check the registrations per IP limit using the CountRegistrationsByIP SA // function that matches IP addresses exactly exactRegLimit := ra.rlPolicies.RegistrationsPerIP() err := ra.checkRegistrationIPLimit(ctx, e...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkRegistrationLimits", "(", "ctx", "context", ".", "Context", ",", "ip", "net", ".", "IP", ")", "error", "{", "// Check the registrations per IP limit using the CountRegistrationsByIP SA", "// function that match...
// checkRegistrationLimits enforces the RegistrationsPerIP and // RegistrationsPerIPRange limits
[ "checkRegistrationLimits", "enforces", "the", "RegistrationsPerIP", "and", "RegistrationsPerIPRange", "limits" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L242-L276
train
letsencrypt/boulder
ra/ra.go
NewRegistration
func (ra *RegistrationAuthorityImpl) NewRegistration(ctx context.Context, init core.Registration) (core.Registration, error) { if err := ra.keyPolicy.GoodKey(init.Key.Key); err != nil { return core.Registration{}, berrors.MalformedError("invalid public key: %s", err.Error()) } if err := ra.checkRegistrationLimits(...
go
func (ra *RegistrationAuthorityImpl) NewRegistration(ctx context.Context, init core.Registration) (core.Registration, error) { if err := ra.keyPolicy.GoodKey(init.Key.Key); err != nil { return core.Registration{}, berrors.MalformedError("invalid public key: %s", err.Error()) } if err := ra.checkRegistrationLimits(...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "NewRegistration", "(", "ctx", "context", ".", "Context", ",", "init", "core", ".", "Registration", ")", "(", "core", ".", "Registration", ",", "error", ")", "{", "if", "err", ":=", "ra", ".", "ke...
// NewRegistration constructs a new Registration from a request.
[ "NewRegistration", "constructs", "a", "new", "Registration", "from", "a", "request", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L279-L309
train
letsencrypt/boulder
ra/ra.go
validateEmail
func validateEmail(address string) error { email, err := mail.ParseAddress(address) if err != nil { return unparseableEmailError } splitEmail := strings.SplitN(email.Address, "@", -1) domain := strings.ToLower(splitEmail[len(splitEmail)-1]) if forbiddenMailDomains[domain] { return berrors.InvalidEmailError( ...
go
func validateEmail(address string) error { email, err := mail.ParseAddress(address) if err != nil { return unparseableEmailError } splitEmail := strings.SplitN(email.Address, "@", -1) domain := strings.ToLower(splitEmail[len(splitEmail)-1]) if forbiddenMailDomains[domain] { return berrors.InvalidEmailError( ...
[ "func", "validateEmail", "(", "address", "string", ")", "error", "{", "email", ",", "err", ":=", "mail", ".", "ParseAddress", "(", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "unparseableEmailError", "\n", "}", "\n", "splitEmail", ":=", ...
// validateEmail returns an error if the given address is not parseable as an // email address or if the domain portion of the email address is a member of // the forbiddenMailDomains map.
[ "validateEmail", "returns", "an", "error", "if", "the", "given", "address", "is", "not", "parseable", "as", "an", "email", "address", "or", "if", "the", "domain", "portion", "of", "the", "email", "address", "is", "a", "member", "of", "the", "forbiddenMailDom...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L378-L394
train
letsencrypt/boulder
ra/ra.go
checkNewOrdersPerAccountLimit
func (ra *RegistrationAuthorityImpl) checkNewOrdersPerAccountLimit(ctx context.Context, acctID int64) error { limit := ra.rlPolicies.NewOrdersPerAccount() if !limit.Enabled() { return nil } latest := ra.clk.Now() earliest := latest.Add(-limit.Window.Duration) count, err := ra.SA.CountOrders(ctx, acctID, earlies...
go
func (ra *RegistrationAuthorityImpl) checkNewOrdersPerAccountLimit(ctx context.Context, acctID int64) error { limit := ra.rlPolicies.NewOrdersPerAccount() if !limit.Enabled() { return nil } latest := ra.clk.Now() earliest := latest.Add(-limit.Window.Duration) count, err := ra.SA.CountOrders(ctx, acctID, earlies...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkNewOrdersPerAccountLimit", "(", "ctx", "context", ".", "Context", ",", "acctID", "int64", ")", "error", "{", "limit", ":=", "ra", ".", "rlPolicies", ".", "NewOrdersPerAccount", "(", ")", "\n", "if...
// checkNewOrdersPerAccountLimit enforces the rlPolicies `NewOrdersPerAccount` // rate limit. This rate limit ensures a client can not create more than the // specified threshold of new orders within the specified time window.
[ "checkNewOrdersPerAccountLimit", "enforces", "the", "rlPolicies", "NewOrdersPerAccount", "rate", "limit", ".", "This", "rate", "limit", "ensures", "a", "client", "can", "not", "create", "more", "than", "the", "specified", "threshold", "of", "new", "orders", "within"...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L456-L475
train
letsencrypt/boulder
ra/ra.go
checkOrderAuthorizations
func (ra *RegistrationAuthorityImpl) checkOrderAuthorizations( ctx context.Context, names []string, acctID accountID, orderID orderID) (map[string]*core.Authorization, error) { acctIDInt := int64(acctID) orderIDInt := int64(orderID) // Get all of the valid authorizations for this account/order authzs, err := ra...
go
func (ra *RegistrationAuthorityImpl) checkOrderAuthorizations( ctx context.Context, names []string, acctID accountID, orderID orderID) (map[string]*core.Authorization, error) { acctIDInt := int64(acctID) orderIDInt := int64(orderID) // Get all of the valid authorizations for this account/order authzs, err := ra...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkOrderAuthorizations", "(", "ctx", "context", ".", "Context", ",", "names", "[", "]", "string", ",", "acctID", "accountID", ",", "orderID", "orderID", ")", "(", "map", "[", "string", "]", "*", ...
// checkOrderAuthorizations verifies that a provided set of names associated // with a specific order and account has all of the required valid, unexpired // authorizations to proceed with issuance. It is the ACME v2 equivalent of // `checkAuthorizations`. It returns the authorizations that satisfied the set // of name...
[ "checkOrderAuthorizations", "verifies", "that", "a", "provided", "set", "of", "names", "associated", "with", "a", "specific", "order", "and", "account", "has", "all", "of", "the", "required", "valid", "unexpired", "authorizations", "to", "proceed", "with", "issuan...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L657-L682
train
letsencrypt/boulder
ra/ra.go
checkAuthorizations
func (ra *RegistrationAuthorityImpl) checkAuthorizations(ctx context.Context, names []string, regID int64) (map[string]*core.Authorization, error) { now := ra.clk.Now() for i := range names { names[i] = strings.ToLower(names[i]) } auths, err := ra.SA.GetValidAuthorizations(ctx, regID, names, now) if err != nil {...
go
func (ra *RegistrationAuthorityImpl) checkAuthorizations(ctx context.Context, names []string, regID int64) (map[string]*core.Authorization, error) { now := ra.clk.Now() for i := range names { names[i] = strings.ToLower(names[i]) } auths, err := ra.SA.GetValidAuthorizations(ctx, regID, names, now) if err != nil {...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkAuthorizations", "(", "ctx", "context", ".", "Context", ",", "names", "[", "]", "string", ",", "regID", "int64", ")", "(", "map", "[", "string", "]", "*", "core", ".", "Authorization", ",", ...
// checkAuthorizations checks that each requested name has a valid authorization // that won't expire before the certificate expires. It returns the // authorizations that satisifed the set of names or it returns an error. // If it returns an error, it will be of type BoulderError.
[ "checkAuthorizations", "checks", "that", "each", "requested", "name", "has", "a", "valid", "authorization", "that", "won", "t", "expire", "before", "the", "certificate", "expires", ".", "It", "returns", "the", "authorizations", "that", "satisifed", "the", "set", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L688-L703
train
letsencrypt/boulder
ra/ra.go
checkAuthorizationsCAA
func (ra *RegistrationAuthorityImpl) checkAuthorizationsCAA( ctx context.Context, names []string, authzs map[string]*core.Authorization, regID int64, now time.Time) error { // badNames contains the names that were unauthorized var badNames []string // recheckAuthzs is a list of authorizations that must have the...
go
func (ra *RegistrationAuthorityImpl) checkAuthorizationsCAA( ctx context.Context, names []string, authzs map[string]*core.Authorization, regID int64, now time.Time) error { // badNames contains the names that were unauthorized var badNames []string // recheckAuthzs is a list of authorizations that must have the...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "checkAuthorizationsCAA", "(", "ctx", "context", ".", "Context", ",", "names", "[", "]", "string", ",", "authzs", "map", "[", "string", "]", "*", "core", ".", "Authorization", ",", "regID", "int64", ...
// checkAuthorizationsCAA implements the common logic of validating a set of // authorizations against a set of names that is used by both // `checkAuthorizations` and `checkOrderAuthorizations`. If required CAA will be // rechecked for authorizations that are too old. // If it returns an error, it will be of type Boul...
[ "checkAuthorizationsCAA", "implements", "the", "common", "logic", "of", "validating", "a", "set", "of", "authorizations", "against", "a", "set", "of", "names", "that", "is", "used", "by", "both", "checkAuthorizations", "and", "checkOrderAuthorizations", ".", "If", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L710-L757
train
letsencrypt/boulder
ra/ra.go
recheckCAA
func (ra *RegistrationAuthorityImpl) recheckCAA(ctx context.Context, authzs []*core.Authorization) error { ra.stats.Inc("recheck_caa", 1) ra.stats.Inc("recheck_caa_authzs", int64(len(authzs))) ch := make(chan error, len(authzs)) for _, authz := range authzs { go func(authz *core.Authorization) { name := authz....
go
func (ra *RegistrationAuthorityImpl) recheckCAA(ctx context.Context, authzs []*core.Authorization) error { ra.stats.Inc("recheck_caa", 1) ra.stats.Inc("recheck_caa_authzs", int64(len(authzs))) ch := make(chan error, len(authzs)) for _, authz := range authzs { go func(authz *core.Authorization) { name := authz....
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "recheckCAA", "(", "ctx", "context", ".", "Context", ",", "authzs", "[", "]", "*", "core", ".", "Authorization", ")", "error", "{", "ra", ".", "stats", ".", "Inc", "(", "\"", "\"", ",", "1", "...
// recheckCAA accepts a list of of names that need to have their CAA records // rechecked because their associated authorizations are sufficiently old and // performs the CAA checks required for each. If any of the rechecks fail an // error is returned.
[ "recheckCAA", "accepts", "a", "list", "of", "of", "names", "that", "need", "to", "have", "their", "CAA", "records", "rechecked", "because", "their", "associated", "authorizations", "are", "sufficiently", "old", "and", "performs", "the", "CAA", "checks", "require...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L763-L818
train
letsencrypt/boulder
ra/ra.go
failOrder
func (ra *RegistrationAuthorityImpl) failOrder( ctx context.Context, order *corepb.Order, prob *probs.ProblemDetails) *corepb.Order { // Convert the problem to a protobuf problem for the *corepb.Order field pbProb, err := bgrpc.ProblemDetailsToPB(prob) if err != nil { ra.log.AuditErrf("Could not convert order ...
go
func (ra *RegistrationAuthorityImpl) failOrder( ctx context.Context, order *corepb.Order, prob *probs.ProblemDetails) *corepb.Order { // Convert the problem to a protobuf problem for the *corepb.Order field pbProb, err := bgrpc.ProblemDetailsToPB(prob) if err != nil { ra.log.AuditErrf("Could not convert order ...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "failOrder", "(", "ctx", "context", ".", "Context", ",", "order", "*", "corepb", ".", "Order", ",", "prob", "*", "probs", ".", "ProblemDetails", ")", "*", "corepb", ".", "Order", "{", "// Convert th...
// failOrder marks an order as failed by setting the problem details field of // the order & persisting it through the SA. If an error occurs doing this we // log it and return the order as-is. There aren't any alternatives if we can't // add the error to the order.
[ "failOrder", "marks", "an", "order", "as", "failed", "by", "setting", "the", "problem", "details", "field", "of", "the", "order", "&", "persisting", "it", "through", "the", "SA", ".", "If", "an", "error", "occurs", "doing", "this", "we", "log", "it", "an...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L824-L842
train
letsencrypt/boulder
ra/ra.go
FinalizeOrder
func (ra *RegistrationAuthorityImpl) FinalizeOrder(ctx context.Context, req *rapb.FinalizeOrderRequest) (*corepb.Order, error) { order := req.Order if *order.Status != string(core.StatusReady) { return nil, berrors.OrderNotReadyError( "Order's status (%q) is not acceptable for finalization", *order.Status) ...
go
func (ra *RegistrationAuthorityImpl) FinalizeOrder(ctx context.Context, req *rapb.FinalizeOrderRequest) (*corepb.Order, error) { order := req.Order if *order.Status != string(core.StatusReady) { return nil, berrors.OrderNotReadyError( "Order's status (%q) is not acceptable for finalization", *order.Status) ...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "FinalizeOrder", "(", "ctx", "context", ".", "Context", ",", "req", "*", "rapb", ".", "FinalizeOrderRequest", ")", "(", "*", "corepb", ".", "Order", ",", "error", ")", "{", "order", ":=", "req", "...
// FinalizeOrder accepts a request to finalize an order object and, if possible, // issues a certificate to satisfy the order. If an order does not have valid, // unexpired authorizations for all of its associated names an error is // returned. Similarly we vet that all of the names in the order are acceptable // based...
[ "FinalizeOrder", "accepts", "a", "request", "to", "finalize", "an", "order", "object", "and", "if", "possible", "issues", "a", "certificate", "to", "satisfy", "the", "order", ".", "If", "an", "order", "does", "not", "have", "valid", "unexpired", "authorization...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L851-L952
train
letsencrypt/boulder
ra/ra.go
NewCertificate
func (ra *RegistrationAuthorityImpl) NewCertificate(ctx context.Context, req core.CertificateRequest, regID int64) (core.Certificate, error) { // Verify the CSR if err := csrlib.VerifyCSR(req.CSR, ra.maxNames, &ra.keyPolicy, ra.PA, ra.forceCNFromSAN, regID); err != nil { return core.Certificate{}, berrors.Malformed...
go
func (ra *RegistrationAuthorityImpl) NewCertificate(ctx context.Context, req core.CertificateRequest, regID int64) (core.Certificate, error) { // Verify the CSR if err := csrlib.VerifyCSR(req.CSR, ra.maxNames, &ra.keyPolicy, ra.PA, ra.forceCNFromSAN, regID); err != nil { return core.Certificate{}, berrors.Malformed...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "NewCertificate", "(", "ctx", "context", ".", "Context", ",", "req", "core", ".", "CertificateRequest", ",", "regID", "int64", ")", "(", "core", ".", "Certificate", ",", "error", ")", "{", "// Verify ...
// NewCertificate requests the issuance of a certificate.
[ "NewCertificate", "requests", "the", "issuance", "of", "a", "certificate", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L955-L964
train
letsencrypt/boulder
ra/ra.go
issueCertificate
func (ra *RegistrationAuthorityImpl) issueCertificate( ctx context.Context, req core.CertificateRequest, acctID accountID, oID orderID) (core.Certificate, error) { // Construct the log event logEvent := certificateRequestEvent{ ID: core.NewToken(), OrderID: int64(oID), Requester: int64(acctID...
go
func (ra *RegistrationAuthorityImpl) issueCertificate( ctx context.Context, req core.CertificateRequest, acctID accountID, oID orderID) (core.Certificate, error) { // Construct the log event logEvent := certificateRequestEvent{ ID: core.NewToken(), OrderID: int64(oID), Requester: int64(acctID...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "issueCertificate", "(", "ctx", "context", ".", "Context", ",", "req", "core", ".", "CertificateRequest", ",", "acctID", "accountID", ",", "oID", "orderID", ")", "(", "core", ".", "Certificate", ",", ...
// issueCertificate sets up a log event structure and captures any errors // encountered during issuance, then calls issueCertificateInner.
[ "issueCertificate", "sets", "up", "a", "log", "event", "structure", "and", "captures", "any", "errors", "encountered", "during", "issuance", "then", "calls", "issueCertificateInner", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L974-L997
train
letsencrypt/boulder
ra/ra.go
domainsForRateLimiting
func domainsForRateLimiting(names []string) ([]string, error) { var domains []string for _, name := range names { domain, err := publicsuffix.Domain(name) if err != nil { // The only possible errors are: // (1) publicsuffix.Domain is giving garbage values // (2) the public suffix is the domain itself ...
go
func domainsForRateLimiting(names []string) ([]string, error) { var domains []string for _, name := range names { domain, err := publicsuffix.Domain(name) if err != nil { // The only possible errors are: // (1) publicsuffix.Domain is giving garbage values // (2) the public suffix is the domain itself ...
[ "func", "domainsForRateLimiting", "(", "names", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "domains", "[", "]", "string", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "domain", ",", "err", ":=", ...
// domainsForRateLimiting transforms a list of FQDNs into a list of eTLD+1's // for the purpose of rate limiting. It also de-duplicates the output // domains. Exact public suffix matches are not included.
[ "domainsForRateLimiting", "transforms", "a", "list", "of", "FQDNs", "into", "a", "list", "of", "eTLD", "+", "1", "s", "for", "the", "purpose", "of", "rate", "limiting", ".", "It", "also", "de", "-", "duplicates", "the", "output", "domains", ".", "Exact", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1174-L1188
train
letsencrypt/boulder
ra/ra.go
suffixesForRateLimiting
func suffixesForRateLimiting(names []string) ([]string, error) { var suffixMatches []string for _, name := range names { _, err := publicsuffix.Domain(name) if err != nil { // Like `domainsForRateLimiting`, the only possible errors here are: // (1) publicsuffix.Domain is giving garbage values // (2) the ...
go
func suffixesForRateLimiting(names []string) ([]string, error) { var suffixMatches []string for _, name := range names { _, err := publicsuffix.Domain(name) if err != nil { // Like `domainsForRateLimiting`, the only possible errors here are: // (1) publicsuffix.Domain is giving garbage values // (2) the ...
[ "func", "suffixesForRateLimiting", "(", "names", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "suffixMatches", "[", "]", "string", "\n", "for", "_", ",", "name", ":=", "range", "names", "{", "_", ",", "err", ":=", ...
// suffixesForRateLimiting returns the unique subset of input names that are // exactly equal to a public suffix.
[ "suffixesForRateLimiting", "returns", "the", "unique", "subset", "of", "input", "names", "that", "are", "exactly", "equal", "to", "a", "public", "suffix", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1192-L1205
train
letsencrypt/boulder
ra/ra.go
enforceNameCounts
func (ra *RegistrationAuthorityImpl) enforceNameCounts( ctx context.Context, names []string, limit ratelimit.RateLimitPolicy, regID int64, countFunc certCountRPC) ([]string, error) { now := ra.clk.Now() windowBegin := limit.WindowBegin(now) counts, err := countFunc(ctx, names, windowBegin, now) if err != nil ...
go
func (ra *RegistrationAuthorityImpl) enforceNameCounts( ctx context.Context, names []string, limit ratelimit.RateLimitPolicy, regID int64, countFunc certCountRPC) ([]string, error) { now := ra.clk.Now() windowBegin := limit.WindowBegin(now) counts, err := countFunc(ctx, names, windowBegin, now) if err != nil ...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "enforceNameCounts", "(", "ctx", "context", ".", "Context", ",", "names", "[", "]", "string", ",", "limit", "ratelimit", ".", "RateLimitPolicy", ",", "regID", "int64", ",", "countFunc", "certCountRPC", ...
// enforceNameCounts uses the provided count RPC to find a count of certificates // for each of the names. If the count for any of the names exceeds the limit // for the given registration then the names out of policy are returned to be // used for a rate limit error.
[ "enforceNameCounts", "uses", "the", "provided", "count", "RPC", "to", "find", "a", "count", "of", "certificates", "for", "each", "of", "the", "names", ".", "If", "the", "count", "for", "any", "of", "the", "names", "exceeds", "the", "limit", "for", "the", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1215-L1240
train
letsencrypt/boulder
ra/ra.go
UpdateRegistration
func (ra *RegistrationAuthorityImpl) UpdateRegistration(ctx context.Context, base core.Registration, update core.Registration) (core.Registration, error) { if changed := mergeUpdate(&base, update); !changed { // If merging the update didn't actually change the base then our work is // done, we can return before ca...
go
func (ra *RegistrationAuthorityImpl) UpdateRegistration(ctx context.Context, base core.Registration, update core.Registration) (core.Registration, error) { if changed := mergeUpdate(&base, update); !changed { // If merging the update didn't actually change the base then our work is // done, we can return before ca...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "UpdateRegistration", "(", "ctx", "context", ".", "Context", ",", "base", "core", ".", "Registration", ",", "update", "core", ".", "Registration", ")", "(", "core", ".", "Registration", ",", "error", ...
// UpdateRegistration updates an existing Registration with new values. Caller // is responsible for making sure that update.Key is only different from base.Key // if it is being called from the WFE key change endpoint.
[ "UpdateRegistration", "updates", "an", "existing", "Registration", "with", "new", "values", ".", "Caller", "is", "responsible", "for", "making", "sure", "that", "update", ".", "Key", "is", "only", "different", "from", "base", ".", "Key", "if", "it", "is", "b...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1355-L1378
train
letsencrypt/boulder
ra/ra.go
mergeUpdate
func mergeUpdate(r *core.Registration, input core.Registration) bool { var changed bool // Note: we allow input.Contact to overwrite r.Contact even if the former is // empty in order to allow users to remove the contact associated with // a registration. Since the field type is a pointer to slice of pointers we /...
go
func mergeUpdate(r *core.Registration, input core.Registration) bool { var changed bool // Note: we allow input.Contact to overwrite r.Contact even if the former is // empty in order to allow users to remove the contact associated with // a registration. Since the field type is a pointer to slice of pointers we /...
[ "func", "mergeUpdate", "(", "r", "*", "core", ".", "Registration", ",", "input", "core", ".", "Registration", ")", "bool", "{", "var", "changed", "bool", "\n\n", "// Note: we allow input.Contact to overwrite r.Contact even if the former is", "// empty in order to allow user...
// MergeUpdate copies a subset of information from the input Registration // into the Registration r. It returns true if an update was performed and the base object // was changed, and false if no change was made.
[ "MergeUpdate", "copies", "a", "subset", "of", "information", "from", "the", "input", "Registration", "into", "the", "Registration", "r", ".", "It", "returns", "true", "if", "an", "update", "was", "performed", "and", "the", "base", "object", "was", "changed", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1410-L1441
train
letsencrypt/boulder
ra/ra.go
revokeCertificate
func (ra *RegistrationAuthorityImpl) revokeCertificate(ctx context.Context, cert x509.Certificate, code revocation.Reason) error { now := time.Now() signRequest := core.OCSPSigningRequest{ CertDER: cert.Raw, Status: string(core.OCSPStatusRevoked), Reason: code, RevokedAt: now, } ocspResponse, err :=...
go
func (ra *RegistrationAuthorityImpl) revokeCertificate(ctx context.Context, cert x509.Certificate, code revocation.Reason) error { now := time.Now() signRequest := core.OCSPSigningRequest{ CertDER: cert.Raw, Status: string(core.OCSPStatusRevoked), Reason: code, RevokedAt: now, } ocspResponse, err :=...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "revokeCertificate", "(", "ctx", "context", ".", "Context", ",", "cert", "x509", ".", "Certificate", ",", "code", "revocation", ".", "Reason", ")", "error", "{", "now", ":=", "time", ".", "Now", "("...
// revokeCertificate generates a revoked OCSP response for the given certificate, stores // the revocation information, and purges OCSP request URLs from Akamai.
[ "revokeCertificate", "generates", "a", "revoked", "OCSP", "response", "for", "the", "given", "certificate", "stores", "the", "revocation", "information", "and", "purges", "OCSP", "request", "URLs", "from", "Akamai", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1572-L1606
train
letsencrypt/boulder
ra/ra.go
RevokeCertificateWithReg
func (ra *RegistrationAuthorityImpl) RevokeCertificateWithReg(ctx context.Context, cert x509.Certificate, revocationCode revocation.Reason, regID int64) error { serialString := core.SerialToString(cert.SerialNumber) var err error if features.Enabled(features.RevokeAtRA) { err = ra.revokeCertificate(ctx, cert, revo...
go
func (ra *RegistrationAuthorityImpl) RevokeCertificateWithReg(ctx context.Context, cert x509.Certificate, revocationCode revocation.Reason, regID int64) error { serialString := core.SerialToString(cert.SerialNumber) var err error if features.Enabled(features.RevokeAtRA) { err = ra.revokeCertificate(ctx, cert, revo...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "RevokeCertificateWithReg", "(", "ctx", "context", ".", "Context", ",", "cert", "x509", ".", "Certificate", ",", "revocationCode", "revocation", ".", "Reason", ",", "regID", "int64", ")", "error", "{", ...
// RevokeCertificateWithReg terminates trust in the certificate provided.
[ "RevokeCertificateWithReg", "terminates", "trust", "in", "the", "certificate", "provided", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1609-L1640
train
letsencrypt/boulder
ra/ra.go
onValidationUpdate
func (ra *RegistrationAuthorityImpl) onValidationUpdate(ctx context.Context, authz core.Authorization) error { // Consider validation successful if any of the challenges // specified in the authorization has been fulfilled for _, ch := range authz.Challenges { if ch.Status == core.StatusValid { authz.Status = c...
go
func (ra *RegistrationAuthorityImpl) onValidationUpdate(ctx context.Context, authz core.Authorization) error { // Consider validation successful if any of the challenges // specified in the authorization has been fulfilled for _, ch := range authz.Challenges { if ch.Status == core.StatusValid { authz.Status = c...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "onValidationUpdate", "(", "ctx", "context", ".", "Context", ",", "authz", "core", ".", "Authorization", ")", "error", "{", "// Consider validation successful if any of the challenges", "// specified in the authoriza...
// onValidationUpdate saves a validation's new status after receiving an // authorization back from the VA.
[ "onValidationUpdate", "saves", "a", "validation", "s", "new", "status", "after", "receiving", "an", "authorization", "back", "from", "the", "VA", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1680-L1705
train
letsencrypt/boulder
ra/ra.go
DeactivateRegistration
func (ra *RegistrationAuthorityImpl) DeactivateRegistration(ctx context.Context, reg core.Registration) error { if reg.Status != core.StatusValid { return berrors.MalformedError("only valid registrations can be deactivated") } err := ra.SA.DeactivateRegistration(ctx, reg.ID) if err != nil { return berrors.Inter...
go
func (ra *RegistrationAuthorityImpl) DeactivateRegistration(ctx context.Context, reg core.Registration) error { if reg.Status != core.StatusValid { return berrors.MalformedError("only valid registrations can be deactivated") } err := ra.SA.DeactivateRegistration(ctx, reg.ID) if err != nil { return berrors.Inter...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "DeactivateRegistration", "(", "ctx", "context", ".", "Context", ",", "reg", "core", ".", "Registration", ")", "error", "{", "if", "reg", ".", "Status", "!=", "core", ".", "StatusValid", "{", "return"...
// DeactivateRegistration deactivates a valid registration
[ "DeactivateRegistration", "deactivates", "a", "valid", "registration" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1708-L1717
train
letsencrypt/boulder
ra/ra.go
DeactivateAuthorization
func (ra *RegistrationAuthorityImpl) DeactivateAuthorization(ctx context.Context, auth core.Authorization) error { if auth.Status != core.StatusValid && auth.Status != core.StatusPending { return berrors.MalformedError("only valid and pending authorizations can be deactivated") } err := ra.SA.DeactivateAuthorizati...
go
func (ra *RegistrationAuthorityImpl) DeactivateAuthorization(ctx context.Context, auth core.Authorization) error { if auth.Status != core.StatusValid && auth.Status != core.StatusPending { return berrors.MalformedError("only valid and pending authorizations can be deactivated") } err := ra.SA.DeactivateAuthorizati...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "DeactivateAuthorization", "(", "ctx", "context", ".", "Context", ",", "auth", "core", ".", "Authorization", ")", "error", "{", "if", "auth", ".", "Status", "!=", "core", ".", "StatusValid", "&&", "au...
// DeactivateAuthorization deactivates a currently valid authorization
[ "DeactivateAuthorization", "deactivates", "a", "currently", "valid", "authorization" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1720-L1729
train
letsencrypt/boulder
ra/ra.go
createPendingAuthz
func (ra *RegistrationAuthorityImpl) createPendingAuthz(ctx context.Context, reg int64, identifier core.AcmeIdentifier, v2 bool) (*corepb.Authorization, error) { expires := ra.clk.Now().Add(ra.pendingAuthorizationLifetime).Truncate(time.Second).UnixNano() status := string(core.StatusPending) authz := &corepb.Authori...
go
func (ra *RegistrationAuthorityImpl) createPendingAuthz(ctx context.Context, reg int64, identifier core.AcmeIdentifier, v2 bool) (*corepb.Authorization, error) { expires := ra.clk.Now().Add(ra.pendingAuthorizationLifetime).Truncate(time.Second).UnixNano() status := string(core.StatusPending) authz := &corepb.Authori...
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "createPendingAuthz", "(", "ctx", "context", ".", "Context", ",", "reg", "int64", ",", "identifier", "core", ".", "AcmeIdentifier", ",", "v2", "bool", ")", "(", "*", "corepb", ".", "Authorization", ",...
// createPendingAuthz checks that a name is allowed for issuance and creates the // necessary challenges for it and puts this and all of the relevant information // into a corepb.Authorization for transmission to the SA to be stored
[ "createPendingAuthz", "checks", "that", "a", "name", "is", "allowed", "for", "issuance", "and", "creates", "the", "necessary", "challenges", "for", "it", "and", "puts", "this", "and", "all", "of", "the", "relevant", "information", "into", "a", "corepb", ".", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1943-L1977
train
letsencrypt/boulder
ra/ra.go
authzValidChallengeEnabled
func (ra *RegistrationAuthorityImpl) authzValidChallengeEnabled(authz *core.Authorization) bool { for _, chall := range authz.Challenges { if chall.Status == core.StatusValid { return ra.PA.ChallengeTypeEnabled(chall.Type) } } return false }
go
func (ra *RegistrationAuthorityImpl) authzValidChallengeEnabled(authz *core.Authorization) bool { for _, chall := range authz.Challenges { if chall.Status == core.StatusValid { return ra.PA.ChallengeTypeEnabled(chall.Type) } } return false }
[ "func", "(", "ra", "*", "RegistrationAuthorityImpl", ")", "authzValidChallengeEnabled", "(", "authz", "*", "core", ".", "Authorization", ")", "bool", "{", "for", "_", ",", "chall", ":=", "range", "authz", ".", "Challenges", "{", "if", "chall", ".", "Status",...
// authzValidChallengeEnabled checks whether the valid challenge in an authorization uses a type // which is still enabled for given regID
[ "authzValidChallengeEnabled", "checks", "whether", "the", "valid", "challenge", "in", "an", "authorization", "uses", "a", "type", "which", "is", "still", "enabled", "for", "given", "regID" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1981-L1988
train
letsencrypt/boulder
ra/ra.go
wildcardOverlap
func wildcardOverlap(dnsNames []string) error { nameMap := make(map[string]bool, len(dnsNames)) for _, v := range dnsNames { nameMap[v] = true } for name := range nameMap { if name[0] == '*' { continue } labels := strings.Split(name, ".") labels[0] = "*" if nameMap[strings.Join(labels, ".")] { ret...
go
func wildcardOverlap(dnsNames []string) error { nameMap := make(map[string]bool, len(dnsNames)) for _, v := range dnsNames { nameMap[v] = true } for name := range nameMap { if name[0] == '*' { continue } labels := strings.Split(name, ".") labels[0] = "*" if nameMap[strings.Join(labels, ".")] { ret...
[ "func", "wildcardOverlap", "(", "dnsNames", "[", "]", "string", ")", "error", "{", "nameMap", ":=", "make", "(", "map", "[", "string", "]", "bool", ",", "len", "(", "dnsNames", ")", ")", "\n", "for", "_", ",", "v", ":=", "range", "dnsNames", "{", "...
// wildcardOverlap takes a slice of domain names and returns an error if any of // them is a non-wildcard FQDN that overlaps with a wildcard domain in the map.
[ "wildcardOverlap", "takes", "a", "slice", "of", "domain", "names", "and", "returns", "an", "error", "if", "any", "of", "them", "is", "a", "non", "-", "wildcard", "FQDN", "that", "overlaps", "with", "a", "wildcard", "domain", "in", "the", "map", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ra/ra.go#L1992-L2009
train
letsencrypt/boulder
cmd/ocsp-responder/main.go
NewSourceFromDatabase
func NewSourceFromDatabase( dbMap dbSelector, caKeyHash []byte, reqSerialPrefixes []string, timeout time.Duration, log blog.Logger, ) (src *DBSource, err error) { src = &DBSource{ dbMap: dbMap, caKeyHash: caKeyHash, reqSerialPrefixes: reqSerialPrefixes, timeout: timeout, lo...
go
func NewSourceFromDatabase( dbMap dbSelector, caKeyHash []byte, reqSerialPrefixes []string, timeout time.Duration, log blog.Logger, ) (src *DBSource, err error) { src = &DBSource{ dbMap: dbMap, caKeyHash: caKeyHash, reqSerialPrefixes: reqSerialPrefixes, timeout: timeout, lo...
[ "func", "NewSourceFromDatabase", "(", "dbMap", "dbSelector", ",", "caKeyHash", "[", "]", "byte", ",", "reqSerialPrefixes", "[", "]", "string", ",", "timeout", "time", ".", "Duration", ",", "log", "blog", ".", "Logger", ",", ")", "(", "src", "*", "DBSource"...
// NewSourceFromDatabase produces a DBSource representing the binding of a // given DB schema to a CA key.
[ "NewSourceFromDatabase", "produces", "a", "DBSource", "representing", "the", "binding", "of", "a", "given", "DB", "schema", "to", "a", "CA", "key", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/ocsp-responder/main.go#L87-L102
train
letsencrypt/boulder
cmd/ocsp-responder/main.go
Response
func (src *DBSource) Response(req *ocsp.Request) ([]byte, http.Header, error) { // Check that this request is for the proper CA if bytes.Compare(req.IssuerKeyHash, src.caKeyHash) != 0 { src.log.Debugf("Request intended for CA Cert ID: %s", hex.EncodeToString(req.IssuerKeyHash)) return nil, nil, cfocsp.ErrNotFound...
go
func (src *DBSource) Response(req *ocsp.Request) ([]byte, http.Header, error) { // Check that this request is for the proper CA if bytes.Compare(req.IssuerKeyHash, src.caKeyHash) != 0 { src.log.Debugf("Request intended for CA Cert ID: %s", hex.EncodeToString(req.IssuerKeyHash)) return nil, nil, cfocsp.ErrNotFound...
[ "func", "(", "src", "*", "DBSource", ")", "Response", "(", "req", "*", "ocsp", ".", "Request", ")", "(", "[", "]", "byte", ",", "http", ".", "Header", ",", "error", ")", "{", "// Check that this request is for the proper CA", "if", "bytes", ".", "Compare",...
// Response is called by the HTTP server to handle a new OCSP request.
[ "Response", "is", "called", "by", "the", "HTTP", "server", "to", "handle", "a", "new", "OCSP", "request", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/ocsp-responder/main.go#L110-L162
train
letsencrypt/boulder
bdns/problem.go
Timeout
func (d DNSError) Timeout() bool { if netErr, ok := d.underlying.(*net.OpError); ok { return netErr.Timeout() } else if d.underlying == context.Canceled || d.underlying == context.DeadlineExceeded { return true } return false }
go
func (d DNSError) Timeout() bool { if netErr, ok := d.underlying.(*net.OpError); ok { return netErr.Timeout() } else if d.underlying == context.Canceled || d.underlying == context.DeadlineExceeded { return true } return false }
[ "func", "(", "d", "DNSError", ")", "Timeout", "(", ")", "bool", "{", "if", "netErr", ",", "ok", ":=", "d", ".", "underlying", ".", "(", "*", "net", ".", "OpError", ")", ";", "ok", "{", "return", "netErr", ".", "Timeout", "(", ")", "\n", "}", "e...
// Timeout returns true if the underlying error was a timeout
[ "Timeout", "returns", "true", "if", "the", "underlying", "error", "was", "a", "timeout" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/problem.go#L46-L53
train
letsencrypt/boulder
features/features.go
Set
func Set(featureSet map[string]bool) error { fMu.Lock() defer fMu.Unlock() for n, v := range featureSet { f, present := nameToFeature[n] if !present { return fmt.Errorf("feature '%s' doesn't exist", n) } features[f] = v } return nil }
go
func Set(featureSet map[string]bool) error { fMu.Lock() defer fMu.Unlock() for n, v := range featureSet { f, present := nameToFeature[n] if !present { return fmt.Errorf("feature '%s' doesn't exist", n) } features[f] = v } return nil }
[ "func", "Set", "(", "featureSet", "map", "[", "string", "]", "bool", ")", "error", "{", "fMu", ".", "Lock", "(", ")", "\n", "defer", "fMu", ".", "Unlock", "(", ")", "\n", "for", "n", ",", "v", ":=", "range", "featureSet", "{", "f", ",", "present"...
// Set accepts a list of features and whether they should // be enabled or disabled, it will return a error if passed // a feature name that it doesn't know
[ "Set", "accepts", "a", "list", "of", "features", "and", "whether", "they", "should", "be", "enabled", "or", "disabled", "it", "will", "return", "a", "error", "if", "passed", "a", "feature", "name", "that", "it", "doesn", "t", "know" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/features/features.go#L96-L107
train
letsencrypt/boulder
features/features.go
Enabled
func Enabled(n FeatureFlag) bool { fMu.RLock() defer fMu.RUnlock() v, present := features[n] if !present { panic(fmt.Sprintf("feature '%s' doesn't exist", n.String())) } return v }
go
func Enabled(n FeatureFlag) bool { fMu.RLock() defer fMu.RUnlock() v, present := features[n] if !present { panic(fmt.Sprintf("feature '%s' doesn't exist", n.String())) } return v }
[ "func", "Enabled", "(", "n", "FeatureFlag", ")", "bool", "{", "fMu", ".", "RLock", "(", ")", "\n", "defer", "fMu", ".", "RUnlock", "(", ")", "\n", "v", ",", "present", ":=", "features", "[", "n", "]", "\n", "if", "!", "present", "{", "panic", "("...
// Enabled returns true if the feature is enabled or false // if it isn't, it will panic if passed a feature that it // doesn't know.
[ "Enabled", "returns", "true", "if", "the", "feature", "is", "enabled", "or", "false", "if", "it", "isn", "t", "it", "will", "panic", "if", "passed", "a", "feature", "that", "it", "doesn", "t", "know", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/features/features.go#L112-L120
train
letsencrypt/boulder
features/features.go
Reset
func Reset() { fMu.Lock() defer fMu.Unlock() for k, v := range initial { features[k] = v } }
go
func Reset() { fMu.Lock() defer fMu.Unlock() for k, v := range initial { features[k] = v } }
[ "func", "Reset", "(", ")", "{", "fMu", ".", "Lock", "(", ")", "\n", "defer", "fMu", ".", "Unlock", "(", ")", "\n", "for", "k", ",", "v", ":=", "range", "initial", "{", "features", "[", "k", "]", "=", "v", "\n", "}", "\n", "}" ]
// Reset resets the features to their initial state
[ "Reset", "resets", "the", "features", "to", "their", "initial", "state" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/features/features.go#L123-L129
train
letsencrypt/boulder
sa/database.go
NewDbMap
func NewDbMap(dbConnect string, maxOpenConns int) (*gorp.DbMap, error) { var err error var config *mysql.Config config, err = mysql.ParseDSN(dbConnect) if err != nil { return nil, err } return NewDbMapFromConfig(config, maxOpenConns) }
go
func NewDbMap(dbConnect string, maxOpenConns int) (*gorp.DbMap, error) { var err error var config *mysql.Config config, err = mysql.ParseDSN(dbConnect) if err != nil { return nil, err } return NewDbMapFromConfig(config, maxOpenConns) }
[ "func", "NewDbMap", "(", "dbConnect", "string", ",", "maxOpenConns", "int", ")", "(", "*", "gorp", ".", "DbMap", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "config", "*", "mysql", ".", "Config", "\n\n", "config", ",", "err", "=", "my...
// NewDbMap creates the root gorp mapping object. Create one of these for each // database schema you wish to map. Each DbMap contains a list of mapped // tables. It automatically maps the tables for the primary parts of Boulder // around the Storage Authority.
[ "NewDbMap", "creates", "the", "root", "gorp", "mapping", "object", ".", "Create", "one", "of", "these", "for", "each", "database", "schema", "you", "wish", "to", "map", ".", "Each", "DbMap", "contains", "a", "list", "of", "mapped", "tables", ".", "It", "...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/database.go#L18-L28
train
letsencrypt/boulder
sa/database.go
adjustMySQLConfig
func adjustMySQLConfig(conf *mysql.Config) *mysql.Config { // Required to turn DATETIME fields into time.Time conf.ParseTime = true // Required to make UPDATE return the number of rows matched, // instead of the number of rows changed by the UPDATE. conf.ClientFoundRows = true // Ensures that MySQL/MariaDB warn...
go
func adjustMySQLConfig(conf *mysql.Config) *mysql.Config { // Required to turn DATETIME fields into time.Time conf.ParseTime = true // Required to make UPDATE return the number of rows matched, // instead of the number of rows changed by the UPDATE. conf.ClientFoundRows = true // Ensures that MySQL/MariaDB warn...
[ "func", "adjustMySQLConfig", "(", "conf", "*", "mysql", ".", "Config", ")", "*", "mysql", ".", "Config", "{", "// Required to turn DATETIME fields into time.Time", "conf", ".", "ParseTime", "=", "true", "\n\n", "// Required to make UPDATE return the number of rows matched,"...
// adjustMySQLConfig sets certain flags that we want on every connection.
[ "adjustMySQLConfig", "sets", "certain", "flags", "that", "we", "want", "on", "every", "connection", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/database.go#L64-L95
train
letsencrypt/boulder
sa/database.go
SetSQLDebug
func SetSQLDebug(dbMap *gorp.DbMap, log blog.Logger) { dbMap.TraceOn("SQL: ", &SQLLogger{log}) }
go
func SetSQLDebug(dbMap *gorp.DbMap, log blog.Logger) { dbMap.TraceOn("SQL: ", &SQLLogger{log}) }
[ "func", "SetSQLDebug", "(", "dbMap", "*", "gorp", ".", "DbMap", ",", "log", "blog", ".", "Logger", ")", "{", "dbMap", ".", "TraceOn", "(", "\"", "\"", ",", "&", "SQLLogger", "{", "log", "}", ")", "\n", "}" ]
// SetSQLDebug enables GORP SQL-level Debugging
[ "SetSQLDebug", "enables", "GORP", "SQL", "-", "level", "Debugging" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/database.go#L98-L100
train
letsencrypt/boulder
sa/database.go
Printf
func (log *SQLLogger) Printf(format string, v ...interface{}) { log.Debugf(format, v...) }
go
func (log *SQLLogger) Printf(format string, v ...interface{}) { log.Debugf(format, v...) }
[ "func", "(", "log", "*", "SQLLogger", ")", "Printf", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "log", ".", "Debugf", "(", "format", ",", "v", "...", ")", "\n", "}" ]
// Printf adapts the AuditLogger to GORP's interface
[ "Printf", "adapts", "the", "AuditLogger", "to", "GORP", "s", "interface" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/database.go#L108-L110
train
letsencrypt/boulder
bdns/mocks.go
LookupTXT
func (mock *MockDNSClient) LookupTXT(_ context.Context, hostname string) ([]string, []string, error) { if hostname == "_acme-challenge.servfail.com" { return nil, nil, fmt.Errorf("SERVFAIL") } if hostname == "_acme-challenge.good-dns01.com" { // base64(sha256("LoqXcYV8q5ONbJQxbmR7SCTNo3tiAXDfowyjxAjEuX0" // ...
go
func (mock *MockDNSClient) LookupTXT(_ context.Context, hostname string) ([]string, []string, error) { if hostname == "_acme-challenge.servfail.com" { return nil, nil, fmt.Errorf("SERVFAIL") } if hostname == "_acme-challenge.good-dns01.com" { // base64(sha256("LoqXcYV8q5ONbJQxbmR7SCTNo3tiAXDfowyjxAjEuX0" // ...
[ "func", "(", "mock", "*", "MockDNSClient", ")", "LookupTXT", "(", "_", "context", ".", "Context", ",", "hostname", "string", ")", "(", "[", "]", "string", ",", "[", "]", "string", ",", "error", ")", "{", "if", "hostname", "==", "\"", "\"", "{", "re...
// LookupTXT is a mock
[ "LookupTXT", "is", "a", "mock" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/mocks.go#L19-L49
train
letsencrypt/boulder
bdns/mocks.go
LookupCAA
func (mock *MockDNSClient) LookupCAA(_ context.Context, domain string) ([]*dns.CAA, error) { return nil, nil }
go
func (mock *MockDNSClient) LookupCAA(_ context.Context, domain string) ([]*dns.CAA, error) { return nil, nil }
[ "func", "(", "mock", "*", "MockDNSClient", ")", "LookupCAA", "(", "_", "context", ".", "Context", ",", "domain", "string", ")", "(", "[", "]", "*", "dns", ".", "CAA", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// LookupCAA returns mock records for use in tests.
[ "LookupCAA", "returns", "mock", "records", "for", "use", "in", "tests", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/mocks.go#L102-L104
train
letsencrypt/boulder
sa/type-converter.go
ToDb
func (tc BoulderTypeConverter) ToDb(val interface{}) (interface{}, error) { switch t := val.(type) { case core.AcmeIdentifier, []core.Challenge, []string, [][]int: jsonBytes, err := json.Marshal(t) if err != nil { return nil, err } return string(jsonBytes), nil case jose.JSONWebKey: jsonBytes, err := t....
go
func (tc BoulderTypeConverter) ToDb(val interface{}) (interface{}, error) { switch t := val.(type) { case core.AcmeIdentifier, []core.Challenge, []string, [][]int: jsonBytes, err := json.Marshal(t) if err != nil { return nil, err } return string(jsonBytes), nil case jose.JSONWebKey: jsonBytes, err := t....
[ "func", "(", "tc", "BoulderTypeConverter", ")", "ToDb", "(", "val", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "t", ":=", "val", ".", "(", "type", ")", "{", "case", "core", ".", "AcmeIdentifier", ",", ...
// ToDb converts a Boulder object to one suitable for the DB representation.
[ "ToDb", "converts", "a", "Boulder", "object", "to", "one", "suitable", "for", "the", "DB", "representation", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/sa/type-converter.go#L18-L39
train
letsencrypt/boulder
metrics/scope.go
NewPromScope
func NewPromScope(registerer prometheus.Registerer, scopes ...string) Scope { return &promScope{ prefix: scopes, autoRegisterer: newAutoRegisterer(registerer), registerer: registerer, } }
go
func NewPromScope(registerer prometheus.Registerer, scopes ...string) Scope { return &promScope{ prefix: scopes, autoRegisterer: newAutoRegisterer(registerer), registerer: registerer, } }
[ "func", "NewPromScope", "(", "registerer", "prometheus", ".", "Registerer", ",", "scopes", "...", "string", ")", "Scope", "{", "return", "&", "promScope", "{", "prefix", ":", "scopes", ",", "autoRegisterer", ":", "newAutoRegisterer", "(", "registerer", ")", ",...
// NewPromScope returns a Scope that sends data to Prometheus
[ "NewPromScope", "returns", "a", "Scope", "that", "sends", "data", "to", "Prometheus" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L39-L45
train
letsencrypt/boulder
metrics/scope.go
NewScope
func (s *promScope) NewScope(scopes ...string) Scope { return &promScope{ prefix: append(s.prefix, scopes...), autoRegisterer: s.autoRegisterer, registerer: s.registerer, } }
go
func (s *promScope) NewScope(scopes ...string) Scope { return &promScope{ prefix: append(s.prefix, scopes...), autoRegisterer: s.autoRegisterer, registerer: s.registerer, } }
[ "func", "(", "s", "*", "promScope", ")", "NewScope", "(", "scopes", "...", "string", ")", "Scope", "{", "return", "&", "promScope", "{", "prefix", ":", "append", "(", "s", ".", "prefix", ",", "scopes", "...", ")", ",", "autoRegisterer", ":", "s", "."...
// NewScope generates a new Scope prefixed by this Scope's prefix plus the // prefixes given joined by periods
[ "NewScope", "generates", "a", "new", "Scope", "prefixed", "by", "this", "Scope", "s", "prefix", "plus", "the", "prefixes", "given", "joined", "by", "periods" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L53-L59
train
letsencrypt/boulder
metrics/scope.go
Inc
func (s *promScope) Inc(stat string, value int64) { s.autoCounter(s.statName(stat)).Add(float64(value)) }
go
func (s *promScope) Inc(stat string, value int64) { s.autoCounter(s.statName(stat)).Add(float64(value)) }
[ "func", "(", "s", "*", "promScope", ")", "Inc", "(", "stat", "string", ",", "value", "int64", ")", "{", "s", ".", "autoCounter", "(", "s", ".", "statName", "(", "stat", ")", ")", ".", "Add", "(", "float64", "(", "value", ")", ")", "\n", "}" ]
// Inc increments the given stat and adds the Scope's prefix to the name
[ "Inc", "increments", "the", "given", "stat", "and", "adds", "the", "Scope", "s", "prefix", "to", "the", "name" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L62-L64
train
letsencrypt/boulder
metrics/scope.go
GaugeDelta
func (s *promScope) GaugeDelta(stat string, value int64) { s.autoGauge(s.statName(stat)).Add(float64(value)) }
go
func (s *promScope) GaugeDelta(stat string, value int64) { s.autoGauge(s.statName(stat)).Add(float64(value)) }
[ "func", "(", "s", "*", "promScope", ")", "GaugeDelta", "(", "stat", "string", ",", "value", "int64", ")", "{", "s", ".", "autoGauge", "(", "s", ".", "statName", "(", "stat", ")", ")", ".", "Add", "(", "float64", "(", "value", ")", ")", "\n", "}" ...
// GaugeDelta sends the change in a gauge stat and adds the Scope's prefix to the name
[ "GaugeDelta", "sends", "the", "change", "in", "a", "gauge", "stat", "and", "adds", "the", "Scope", "s", "prefix", "to", "the", "name" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L72-L74
train
letsencrypt/boulder
metrics/scope.go
Timing
func (s *promScope) Timing(stat string, delta int64) { s.autoSummary(s.statName(stat) + "_seconds").Observe(float64(delta)) }
go
func (s *promScope) Timing(stat string, delta int64) { s.autoSummary(s.statName(stat) + "_seconds").Observe(float64(delta)) }
[ "func", "(", "s", "*", "promScope", ")", "Timing", "(", "stat", "string", ",", "delta", "int64", ")", "{", "s", ".", "autoSummary", "(", "s", ".", "statName", "(", "stat", ")", "+", "\"", "\"", ")", ".", "Observe", "(", "float64", "(", "delta", "...
// Timing sends a latency stat and adds the Scope's prefix to the name
[ "Timing", "sends", "a", "latency", "stat", "and", "adds", "the", "Scope", "s", "prefix", "to", "the", "name" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L77-L79
train
letsencrypt/boulder
metrics/scope.go
TimingDuration
func (s *promScope) TimingDuration(stat string, delta time.Duration) { s.autoSummary(s.statName(stat) + "_seconds").Observe(delta.Seconds()) }
go
func (s *promScope) TimingDuration(stat string, delta time.Duration) { s.autoSummary(s.statName(stat) + "_seconds").Observe(delta.Seconds()) }
[ "func", "(", "s", "*", "promScope", ")", "TimingDuration", "(", "stat", "string", ",", "delta", "time", ".", "Duration", ")", "{", "s", ".", "autoSummary", "(", "s", ".", "statName", "(", "stat", ")", "+", "\"", "\"", ")", ".", "Observe", "(", "del...
// TimingDuration sends a latency stat as a time.Duration and adds the Scope's // prefix to the name
[ "TimingDuration", "sends", "a", "latency", "stat", "as", "a", "time", ".", "Duration", "and", "adds", "the", "Scope", "s", "prefix", "to", "the", "name" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L83-L85
train
letsencrypt/boulder
metrics/scope.go
SetInt
func (s *promScope) SetInt(stat string, value int64) { s.autoGauge(s.statName(stat)).Set(float64(value)) }
go
func (s *promScope) SetInt(stat string, value int64) { s.autoGauge(s.statName(stat)).Set(float64(value)) }
[ "func", "(", "s", "*", "promScope", ")", "SetInt", "(", "stat", "string", ",", "value", "int64", ")", "{", "s", ".", "autoGauge", "(", "s", ".", "statName", "(", "stat", ")", ")", ".", "Set", "(", "float64", "(", "value", ")", ")", "\n", "}" ]
// SetInt sets a stat's integer value and adds the Scope's prefix to the name
[ "SetInt", "sets", "a", "stat", "s", "integer", "value", "and", "adds", "the", "Scope", "s", "prefix", "to", "the", "name" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L88-L90
train
letsencrypt/boulder
metrics/scope.go
statName
func (s *promScope) statName(stat string) string { if len(s.prefix) > 0 { return strings.Join(s.prefix, "_") + "_" + stat } return stat }
go
func (s *promScope) statName(stat string) string { if len(s.prefix) > 0 { return strings.Join(s.prefix, "_") + "_" + stat } return stat }
[ "func", "(", "s", "*", "promScope", ")", "statName", "(", "stat", "string", ")", "string", "{", "if", "len", "(", "s", ".", "prefix", ")", ">", "0", "{", "return", "strings", ".", "Join", "(", "s", ".", "prefix", ",", "\"", "\"", ")", "+", "\""...
// statName construct a name for a stat based on the prefix of this scope, plus // the provided string.
[ "statName", "construct", "a", "name", "for", "a", "stat", "based", "on", "the", "prefix", "of", "this", "scope", "plus", "the", "provided", "string", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/metrics/scope.go#L94-L99
train
letsencrypt/boulder
akamai/cache-client.go
NewCachePurgeClient
func NewCachePurgeClient( endpoint, clientToken, clientSecret, accessToken string, v3Network string, retries int, retryBackoff time.Duration, log blog.Logger, stats metrics.Scope, ) (*CachePurgeClient, error) { stats = stats.NewScope("CCU") if strings.HasSuffix(endpoint, "/") { endpoint = endpoint[:len(end...
go
func NewCachePurgeClient( endpoint, clientToken, clientSecret, accessToken string, v3Network string, retries int, retryBackoff time.Duration, log blog.Logger, stats metrics.Scope, ) (*CachePurgeClient, error) { stats = stats.NewScope("CCU") if strings.HasSuffix(endpoint, "/") { endpoint = endpoint[:len(end...
[ "func", "NewCachePurgeClient", "(", "endpoint", ",", "clientToken", ",", "clientSecret", ",", "accessToken", "string", ",", "v3Network", "string", ",", "retries", "int", ",", "retryBackoff", "time", ".", "Duration", ",", "log", "blog", ".", "Logger", ",", "sta...
// NewCachePurgeClient constructs a new CachePurgeClient
[ "NewCachePurgeClient", "constructs", "a", "new", "CachePurgeClient" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/akamai/cache-client.go#L73-L112
train
letsencrypt/boulder
akamai/cache-client.go
signingKey
func signingKey(clientSecret string, timestamp string) []byte { h := hmac.New(sha256.New, []byte(clientSecret)) h.Write([]byte(timestamp)) key := make([]byte, base64.StdEncoding.EncodedLen(32)) base64.StdEncoding.Encode(key, h.Sum(nil)) return key }
go
func signingKey(clientSecret string, timestamp string) []byte { h := hmac.New(sha256.New, []byte(clientSecret)) h.Write([]byte(timestamp)) key := make([]byte, base64.StdEncoding.EncodedLen(32)) base64.StdEncoding.Encode(key, h.Sum(nil)) return key }
[ "func", "signingKey", "(", "clientSecret", "string", ",", "timestamp", "string", ")", "[", "]", "byte", "{", "h", ":=", "hmac", ".", "New", "(", "sha256", ".", "New", ",", "[", "]", "byte", "(", "clientSecret", ")", ")", "\n", "h", ".", "Write", "(...
// signingKey makes a signing key by HMAC'ing the timestamp // using a client secret as the key.
[ "signingKey", "makes", "a", "signing", "key", "by", "HMAC", "ing", "the", "timestamp", "using", "a", "client", "secret", "as", "the", "key", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/akamai/cache-client.go#L154-L160
train
letsencrypt/boulder
akamai/cache-client.go
purge
func (cpc *CachePurgeClient) purge(urls []string) error { purgeReq := v3PurgeRequest{ Objects: urls, } endpoint := fmt.Sprintf("%s%s%s", cpc.apiEndpoint, v3PurgePath, cpc.v3Network) reqJSON, err := json.Marshal(purgeReq) if err != nil { return errFatal(err.Error()) } req, err := http.NewRequest( "POST", ...
go
func (cpc *CachePurgeClient) purge(urls []string) error { purgeReq := v3PurgeRequest{ Objects: urls, } endpoint := fmt.Sprintf("%s%s%s", cpc.apiEndpoint, v3PurgePath, cpc.v3Network) reqJSON, err := json.Marshal(purgeReq) if err != nil { return errFatal(err.Error()) } req, err := http.NewRequest( "POST", ...
[ "func", "(", "cpc", "*", "CachePurgeClient", ")", "purge", "(", "urls", "[", "]", "string", ")", "error", "{", "purgeReq", ":=", "v3PurgeRequest", "{", "Objects", ":", "urls", ",", "}", "\n", "endpoint", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ...
// purge actually sends the individual requests to the Akamai endpoint and checks // if they are successful
[ "purge", "actually", "sends", "the", "individual", "requests", "to", "the", "Akamai", "endpoint", "and", "checks", "if", "they", "are", "successful" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/akamai/cache-client.go#L164-L234
train
letsencrypt/boulder
akamai/cache-client.go
Purge
func (cpc *CachePurgeClient) Purge(urls []string) error { for i := 0; i < len(urls); { sliceEnd := i + akamaiBatchSize if sliceEnd > len(urls) { sliceEnd = len(urls) } err := cpc.purgeBatch(urls[i:sliceEnd]) if err != nil { return err } i += akamaiBatchSize } return nil }
go
func (cpc *CachePurgeClient) Purge(urls []string) error { for i := 0; i < len(urls); { sliceEnd := i + akamaiBatchSize if sliceEnd > len(urls) { sliceEnd = len(urls) } err := cpc.purgeBatch(urls[i:sliceEnd]) if err != nil { return err } i += akamaiBatchSize } return nil }
[ "func", "(", "cpc", "*", "CachePurgeClient", ")", "Purge", "(", "urls", "[", "]", "string", ")", "error", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "urls", ")", ";", "{", "sliceEnd", ":=", "i", "+", "akamaiBatchSize", "\n", "if", "sl...
// Purge attempts to send a purge request to the Akamai CCU API cpc.retries number // of times before giving up and returning ErrAllRetriesFailed
[ "Purge", "attempts", "to", "send", "a", "purge", "request", "to", "the", "Akamai", "CCU", "API", "cpc", ".", "retries", "number", "of", "times", "before", "giving", "up", "and", "returning", "ErrAllRetriesFailed" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/akamai/cache-client.go#L268-L281
train
letsencrypt/boulder
akamai/cache-client.go
CheckSignature
func CheckSignature(secret string, url string, r *http.Request, body []byte) error { bodyHash := sha256.Sum256(body) bodyHashB64 := base64.StdEncoding.EncodeToString(bodyHash[:]) authorization := r.Header.Get("Authorization") authValues := make(map[string]string) for _, v := range strings.Split(authorization, ";"...
go
func CheckSignature(secret string, url string, r *http.Request, body []byte) error { bodyHash := sha256.Sum256(body) bodyHashB64 := base64.StdEncoding.EncodeToString(bodyHash[:]) authorization := r.Header.Get("Authorization") authValues := make(map[string]string) for _, v := range strings.Split(authorization, ";"...
[ "func", "CheckSignature", "(", "secret", "string", ",", "url", "string", ",", "r", "*", "http", ".", "Request", ",", "body", "[", "]", "byte", ")", "error", "{", "bodyHash", ":=", "sha256", ".", "Sum256", "(", "body", ")", "\n", "bodyHashB64", ":=", ...
// CheckSignature is used for tests, it exported so that it can be used in akamai-test-srv
[ "CheckSignature", "is", "used", "for", "tests", "it", "exported", "so", "that", "it", "can", "be", "used", "in", "akamai", "-", "test", "-", "srv" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/akamai/cache-client.go#L284-L312
train
letsencrypt/boulder
cmd/id-exporter/main.go
findIDs
func (c idExporter) findIDs() ([]id, error) { var idsList []id _, err := c.dbMap.Select( &idsList, `SELECT id FROM registrations WHERE contact != 'null' AND id IN ( SELECT registrationID FROM certificates WHERE expires >= :expireCutoff );`, map[string]interface{}{ "expireCutoff": c.clk....
go
func (c idExporter) findIDs() ([]id, error) { var idsList []id _, err := c.dbMap.Select( &idsList, `SELECT id FROM registrations WHERE contact != 'null' AND id IN ( SELECT registrationID FROM certificates WHERE expires >= :expireCutoff );`, map[string]interface{}{ "expireCutoff": c.clk....
[ "func", "(", "c", "idExporter", ")", "findIDs", "(", ")", "(", "[", "]", "id", ",", "error", ")", "{", "var", "idsList", "[", "]", "id", "\n", "_", ",", "err", ":=", "c", ".", "dbMap", ".", "Select", "(", "&", "idsList", ",", "`SELECT id\n\t\tFRO...
// Find all registration IDs with unexpired certificates.
[ "Find", "all", "registration", "IDs", "with", "unexpired", "certificates", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/id-exporter/main.go#L34-L55
train
letsencrypt/boulder
cmd/id-exporter/main.go
writeIDs
func writeIDs(idsList []id, outfile string) error { data, err := json.Marshal(idsList) if err != nil { return err } data = append(data, '\n') if outfile != "" { return ioutil.WriteFile(outfile, data, 0644) } fmt.Printf("%s", data) return nil }
go
func writeIDs(idsList []id, outfile string) error { data, err := json.Marshal(idsList) if err != nil { return err } data = append(data, '\n') if outfile != "" { return ioutil.WriteFile(outfile, data, 0644) } fmt.Printf("%s", data) return nil }
[ "func", "writeIDs", "(", "idsList", "[", "]", "id", ",", "outfile", "string", ")", "error", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "idsList", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "data", ...
// The `writeIDs` function produces a file containing JSON serialized // contact objects
[ "The", "writeIDs", "function", "produces", "a", "file", "containing", "JSON", "serialized", "contact", "objects" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/id-exporter/main.go#L89-L102
train
letsencrypt/boulder
grpc/creds/creds.go
ClientHandshake
func (tc *clientTransportCredentials) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { var err error host := tc.hostOverride if host == "" { // IMPORTANT: Don't wrap the errors returned from this method. gRPC expects to be // able to check err.Temporar...
go
func (tc *clientTransportCredentials) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { var err error host := tc.hostOverride if host == "" { // IMPORTANT: Don't wrap the errors returned from this method. gRPC expects to be // able to check err.Temporar...
[ "func", "(", "tc", "*", "clientTransportCredentials", ")", "ClientHandshake", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ",", "rawConn", "net", ".", "Conn", ")", "(", "net", ".", "Conn", ",", "credentials", ".", "AuthInfo", ",", "error",...
// ClientHandshake does the authentication handshake specified by the corresponding // authentication protocol on rawConn for clients. It returns the authenticated // connection and the corresponding auth information about the connection. // Implementations must use the provided context to implement timely cancellation...
[ "ClientHandshake", "does", "the", "authentication", "handshake", "specified", "by", "the", "corresponding", "authentication", "protocol", "on", "rawConn", "for", "clients", ".", "It", "returns", "the", "authenticated", "connection", "and", "the", "corresponding", "aut...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L57-L89
train
letsencrypt/boulder
grpc/creds/creds.go
ServerHandshake
func (tc *clientTransportCredentials) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { return nil, nil, ServerHandshakeNopErr }
go
func (tc *clientTransportCredentials) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { return nil, nil, ServerHandshakeNopErr }
[ "func", "(", "tc", "*", "clientTransportCredentials", ")", "ServerHandshake", "(", "rawConn", "net", ".", "Conn", ")", "(", "net", ".", "Conn", ",", "credentials", ".", "AuthInfo", ",", "error", ")", "{", "return", "nil", ",", "nil", ",", "ServerHandshakeN...
// ServerHandshake is not implemented for a `clientTransportCredentials`, use // a `serverTransportCredentials` if you require `ServerHandshake`.
[ "ServerHandshake", "is", "not", "implemented", "for", "a", "clientTransportCredentials", "use", "a", "serverTransportCredentials", "if", "you", "require", "ServerHandshake", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L93-L95
train
letsencrypt/boulder
grpc/creds/creds.go
Clone
func (tc *clientTransportCredentials) Clone() credentials.TransportCredentials { return NewClientCredentials(tc.roots, tc.clients, tc.hostOverride) }
go
func (tc *clientTransportCredentials) Clone() credentials.TransportCredentials { return NewClientCredentials(tc.roots, tc.clients, tc.hostOverride) }
[ "func", "(", "tc", "*", "clientTransportCredentials", ")", "Clone", "(", ")", "credentials", ".", "TransportCredentials", "{", "return", "NewClientCredentials", "(", "tc", ".", "roots", ",", "tc", ".", "clients", ",", "tc", ".", "hostOverride", ")", "\n", "}...
// Clone returns a copy of the clientTransportCredentials
[ "Clone", "returns", "a", "copy", "of", "the", "clientTransportCredentials" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L116-L118
train
letsencrypt/boulder
grpc/creds/creds.go
ServerHandshake
func (tc *serverTransportCredentials) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { // Perform the server <- client TLS handshake. This will validate the peer's // client certificate. conn := tls.Server(rawConn, tc.serverConfig) if err := conn.Handshake(); err != nil { return nil, ni...
go
func (tc *serverTransportCredentials) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { // Perform the server <- client TLS handshake. This will validate the peer's // client certificate. conn := tls.Server(rawConn, tc.serverConfig) if err := conn.Handshake(); err != nil { return nil, ni...
[ "func", "(", "tc", "*", "serverTransportCredentials", ")", "ServerHandshake", "(", "rawConn", "net", ".", "Conn", ")", "(", "net", ".", "Conn", ",", "credentials", ".", "AuthInfo", ",", "error", ")", "{", "// Perform the server <- client TLS handshake. This will val...
// ServerHandshake does the authentication handshake for servers. It returns // the authenticated connection and the corresponding auth information about // the connection.
[ "ServerHandshake", "does", "the", "authentication", "handshake", "for", "servers", ".", "It", "returns", "the", "authenticated", "connection", "and", "the", "corresponding", "auth", "information", "about", "the", "connection", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L205-L220
train
letsencrypt/boulder
grpc/creds/creds.go
ClientHandshake
func (tc *serverTransportCredentials) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { return nil, nil, ClientHandshakeNopErr }
go
func (tc *serverTransportCredentials) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { return nil, nil, ClientHandshakeNopErr }
[ "func", "(", "tc", "*", "serverTransportCredentials", ")", "ClientHandshake", "(", "ctx", "context", ".", "Context", ",", "addr", "string", ",", "rawConn", "net", ".", "Conn", ")", "(", "net", ".", "Conn", ",", "credentials", ".", "AuthInfo", ",", "error",...
// ClientHandshake is not implemented for a `serverTransportCredentials`, use // a `clientTransportCredentials` if you require `ClientHandshake`.
[ "ClientHandshake", "is", "not", "implemented", "for", "a", "serverTransportCredentials", "use", "a", "clientTransportCredentials", "if", "you", "require", "ClientHandshake", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L224-L226
train
letsencrypt/boulder
grpc/creds/creds.go
GetRequestMetadata
func (tc *serverTransportCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { return nil, nil }
go
func (tc *serverTransportCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { return nil, nil }
[ "func", "(", "tc", "*", "serverTransportCredentials", ")", "GetRequestMetadata", "(", "ctx", "context", ".", "Context", ",", "uri", "...", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n",...
// GetRequestMetadata returns nil, nil since TLS credentials do not have metadata.
[ "GetRequestMetadata", "returns", "nil", "nil", "since", "TLS", "credentials", "do", "not", "have", "metadata", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L237-L239
train
letsencrypt/boulder
grpc/creds/creds.go
Clone
func (tc *serverTransportCredentials) Clone() credentials.TransportCredentials { clone, _ := NewServerCredentials(tc.serverConfig, tc.acceptedSANs) return clone }
go
func (tc *serverTransportCredentials) Clone() credentials.TransportCredentials { clone, _ := NewServerCredentials(tc.serverConfig, tc.acceptedSANs) return clone }
[ "func", "(", "tc", "*", "serverTransportCredentials", ")", "Clone", "(", ")", "credentials", ".", "TransportCredentials", "{", "clone", ",", "_", ":=", "NewServerCredentials", "(", "tc", ".", "serverConfig", ",", "tc", ".", "acceptedSANs", ")", "\n", "return",...
// Clone returns a copy of the serverTransportCredentials
[ "Clone", "returns", "a", "copy", "of", "the", "serverTransportCredentials" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/creds/creds.go#L247-L250
train
letsencrypt/boulder
core/objects.go
ValidChallenge
func ValidChallenge(name string) bool { switch name { case ChallengeTypeHTTP01, ChallengeTypeDNS01, ChallengeTypeTLSALPN01: return true default: return false } }
go
func ValidChallenge(name string) bool { switch name { case ChallengeTypeHTTP01, ChallengeTypeDNS01, ChallengeTypeTLSALPN01: return true default: return false } }
[ "func", "ValidChallenge", "(", "name", "string", ")", "bool", "{", "switch", "name", "{", "case", "ChallengeTypeHTTP01", ",", "ChallengeTypeDNS01", ",", "ChallengeTypeTLSALPN01", ":", "return", "true", "\n", "default", ":", "return", "false", "\n", "}", "\n", ...
// ValidChallenge tests whether the provided string names a known challenge
[ "ValidChallenge", "tests", "whether", "the", "provided", "string", "names", "a", "known", "challenge" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L75-L84
train
letsencrypt/boulder
core/objects.go
UnmarshalJSON
func (cr *CertificateRequest) UnmarshalJSON(data []byte) error { var raw RawCertificateRequest if err := json.Unmarshal(data, &raw); err != nil { return err } csr, err := x509.ParseCertificateRequest(raw.CSR) if err != nil { return err } cr.CSR = csr cr.Bytes = raw.CSR return nil }
go
func (cr *CertificateRequest) UnmarshalJSON(data []byte) error { var raw RawCertificateRequest if err := json.Unmarshal(data, &raw); err != nil { return err } csr, err := x509.ParseCertificateRequest(raw.CSR) if err != nil { return err } cr.CSR = csr cr.Bytes = raw.CSR return nil }
[ "func", "(", "cr", "*", "CertificateRequest", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "raw", "RawCertificateRequest", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "raw", ")", ";", "err...
// UnmarshalJSON provides an implementation for decoding CertificateRequest objects.
[ "UnmarshalJSON", "provides", "an", "implementation", "for", "decoding", "CertificateRequest", "objects", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L113-L127
train
letsencrypt/boulder
core/objects.go
MarshalJSON
func (cr CertificateRequest) MarshalJSON() ([]byte, error) { return json.Marshal(RawCertificateRequest{ CSR: cr.CSR.Raw, }) }
go
func (cr CertificateRequest) MarshalJSON() ([]byte, error) { return json.Marshal(RawCertificateRequest{ CSR: cr.CSR.Raw, }) }
[ "func", "(", "cr", "CertificateRequest", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "RawCertificateRequest", "{", "CSR", ":", "cr", ".", "CSR", ".", "Raw", ",", "}", ")", "\n", ...
// MarshalJSON provides an implementation for encoding CertificateRequest objects.
[ "MarshalJSON", "provides", "an", "implementation", "for", "encoding", "CertificateRequest", "objects", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L130-L134
train