id
int32
0
167k
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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
31,200
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
31,201
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
31,202
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
31,203
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
31,204
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
31,205
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
31,206
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
31,207
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
31,208
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
31,209
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
31,210
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
31,211
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
31,212
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
31,213
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
31,214
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
31,215
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
31,216
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
31,217
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
31,218
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
31,219
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
31,220
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
31,221
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
31,222
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
31,223
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
31,224
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
31,225
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
31,226
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
31,227
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
31,228
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
31,229
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
31,230
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
31,231
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
31,232
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
31,233
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
31,234
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
31,235
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
31,236
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
31,237
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
31,238
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
31,239
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
31,240
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
31,241
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
31,242
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
31,243
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
31,244
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
31,245
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
31,246
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
31,247
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
31,248
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
31,249
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
31,250
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
31,251
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
31,252
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
31,253
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
31,254
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
31,255
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
31,256
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
31,257
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
31,258
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
31,259
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
31,260
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
31,261
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
31,262
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
31,263
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
31,264
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
31,265
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
31,266
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
31,267
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
31,268
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
31,269
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
31,270
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
31,271
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
31,272
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
31,273
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
31,274
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
31,275
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
31,276
letsencrypt/boulder
core/objects.go
ExpectedKeyAuthorization
func (ch Challenge) ExpectedKeyAuthorization(key *jose.JSONWebKey) (string, error) { if key == nil { return "", fmt.Errorf("Cannot authorize a nil key") } thumbprint, err := key.Thumbprint(crypto.SHA256) if err != nil { return "", err } return ch.Token + "." + base64.RawURLEncoding.EncodeToString(thumbprint...
go
func (ch Challenge) ExpectedKeyAuthorization(key *jose.JSONWebKey) (string, error) { if key == nil { return "", fmt.Errorf("Cannot authorize a nil key") } thumbprint, err := key.Thumbprint(crypto.SHA256) if err != nil { return "", err } return ch.Token + "." + base64.RawURLEncoding.EncodeToString(thumbprint...
[ "func", "(", "ch", "Challenge", ")", "ExpectedKeyAuthorization", "(", "key", "*", "jose", ".", "JSONWebKey", ")", "(", "string", ",", "error", ")", "{", "if", "key", "==", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// ExpectedKeyAuthorization computes the expected KeyAuthorization value for // the challenge.
[ "ExpectedKeyAuthorization", "computes", "the", "expected", "KeyAuthorization", "value", "for", "the", "challenge", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L251-L262
31,277
letsencrypt/boulder
core/objects.go
RecordsSane
func (ch Challenge) RecordsSane() bool { if ch.ValidationRecord == nil || len(ch.ValidationRecord) == 0 { return false } switch ch.Type { case ChallengeTypeHTTP01: for _, rec := range ch.ValidationRecord { if rec.URL == "" || rec.Hostname == "" || rec.Port == "" || rec.AddressUsed == nil || len(rec.Addr...
go
func (ch Challenge) RecordsSane() bool { if ch.ValidationRecord == nil || len(ch.ValidationRecord) == 0 { return false } switch ch.Type { case ChallengeTypeHTTP01: for _, rec := range ch.ValidationRecord { if rec.URL == "" || rec.Hostname == "" || rec.Port == "" || rec.AddressUsed == nil || len(rec.Addr...
[ "func", "(", "ch", "Challenge", ")", "RecordsSane", "(", ")", "bool", "{", "if", "ch", ".", "ValidationRecord", "==", "nil", "||", "len", "(", "ch", ".", "ValidationRecord", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "switch", "ch", "...
// RecordsSane checks the sanity of a ValidationRecord object before sending it // back to the RA to be stored.
[ "RecordsSane", "checks", "the", "sanity", "of", "a", "ValidationRecord", "object", "before", "sending", "it", "back", "to", "the", "RA", "to", "be", "stored", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L266-L303
31,278
letsencrypt/boulder
core/objects.go
CheckConsistencyForClientOffer
func (ch Challenge) CheckConsistencyForClientOffer() error { if err := ch.checkConsistency(); err != nil { return err } // Before completion, the key authorization field should be empty if ch.ProvidedKeyAuthorization != "" { return fmt.Errorf("A response to this challenge was already submitted.") } return ni...
go
func (ch Challenge) CheckConsistencyForClientOffer() error { if err := ch.checkConsistency(); err != nil { return err } // Before completion, the key authorization field should be empty if ch.ProvidedKeyAuthorization != "" { return fmt.Errorf("A response to this challenge was already submitted.") } return ni...
[ "func", "(", "ch", "Challenge", ")", "CheckConsistencyForClientOffer", "(", ")", "error", "{", "if", "err", ":=", "ch", ".", "checkConsistency", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Before completion, the key authoriz...
// CheckConsistencyForClientOffer checks the fields of a challenge object before it is // given to the client.
[ "CheckConsistencyForClientOffer", "checks", "the", "fields", "of", "a", "challenge", "object", "before", "it", "is", "given", "to", "the", "client", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L307-L317
31,279
letsencrypt/boulder
core/objects.go
CheckConsistencyForValidation
func (ch Challenge) CheckConsistencyForValidation() error { if err := ch.checkConsistency(); err != nil { return err } // If the challenge is completed, then there should be a key authorization return looksLikeKeyAuthorization(ch.ProvidedKeyAuthorization) }
go
func (ch Challenge) CheckConsistencyForValidation() error { if err := ch.checkConsistency(); err != nil { return err } // If the challenge is completed, then there should be a key authorization return looksLikeKeyAuthorization(ch.ProvidedKeyAuthorization) }
[ "func", "(", "ch", "Challenge", ")", "CheckConsistencyForValidation", "(", ")", "error", "{", "if", "err", ":=", "ch", ".", "checkConsistency", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// If the challenge is completed, then ...
// CheckConsistencyForValidation checks the fields of a challenge object before it is // given to the VA.
[ "CheckConsistencyForValidation", "checks", "the", "fields", "of", "a", "challenge", "object", "before", "it", "is", "given", "to", "the", "VA", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L321-L328
31,280
letsencrypt/boulder
core/objects.go
checkConsistency
func (ch Challenge) checkConsistency() error { if ch.Status != StatusPending { return fmt.Errorf("The challenge is not pending.") } // There always needs to be a token if !LooksLikeAToken(ch.Token) { return fmt.Errorf("The token is missing.") } return nil }
go
func (ch Challenge) checkConsistency() error { if ch.Status != StatusPending { return fmt.Errorf("The challenge is not pending.") } // There always needs to be a token if !LooksLikeAToken(ch.Token) { return fmt.Errorf("The token is missing.") } return nil }
[ "func", "(", "ch", "Challenge", ")", "checkConsistency", "(", ")", "error", "{", "if", "ch", ".", "Status", "!=", "StatusPending", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// There always needs to be a token", "if", "!...
// checkConsistency checks the sanity of a challenge object before issued to the client.
[ "checkConsistency", "checks", "the", "sanity", "of", "a", "challenge", "object", "before", "issued", "to", "the", "client", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L331-L341
31,281
letsencrypt/boulder
core/objects.go
StringID
func (ch Challenge) StringID() string { h := fnv.New128a() h.Write([]byte(ch.Token)) h.Write([]byte(ch.Type)) return base64.URLEncoding.EncodeToString(h.Sum(nil)[0:4]) }
go
func (ch Challenge) StringID() string { h := fnv.New128a() h.Write([]byte(ch.Token)) h.Write([]byte(ch.Type)) return base64.URLEncoding.EncodeToString(h.Sum(nil)[0:4]) }
[ "func", "(", "ch", "Challenge", ")", "StringID", "(", ")", "string", "{", "h", ":=", "fnv", ".", "New128a", "(", ")", "\n", "h", ".", "Write", "(", "[", "]", "byte", "(", "ch", ".", "Token", ")", ")", "\n", "h", ".", "Write", "(", "[", "]", ...
// StringID is used to generate a ID for challenges associated with new style authorizations. // This is necessary as these challenges no longer have a unique non-sequential identifier // in the new storage scheme. This identifier is generated by constructing a fnv hash over the // challenge token and type and encoding...
[ "StringID", "is", "used", "to", "generate", "a", "ID", "for", "challenges", "associated", "with", "new", "style", "authorizations", ".", "This", "is", "necessary", "as", "these", "challenges", "no", "longer", "have", "a", "unique", "non", "-", "sequential", ...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L347-L352
31,282
letsencrypt/boulder
core/objects.go
FindChallenge
func (authz *Authorization) FindChallenge(challengeID int64) int { for i, c := range authz.Challenges { if c.ID == challengeID { return i } } return -1 }
go
func (authz *Authorization) FindChallenge(challengeID int64) int { for i, c := range authz.Challenges { if c.ID == challengeID { return i } } return -1 }
[ "func", "(", "authz", "*", "Authorization", ")", "FindChallenge", "(", "challengeID", "int64", ")", "int", "{", "for", "i", ",", "c", ":=", "range", "authz", ".", "Challenges", "{", "if", "c", ".", "ID", "==", "challengeID", "{", "return", "i", "\n", ...
// FindChallenge will look for the given challenge inside this authorization. If // found, it will return the index of that challenge within the Authorization's // Challenges array. Otherwise it will return -1.
[ "FindChallenge", "will", "look", "for", "the", "given", "challenge", "inside", "this", "authorization", ".", "If", "found", "it", "will", "return", "the", "index", "of", "that", "challenge", "within", "the", "Authorization", "s", "Challenges", "array", ".", "O...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L407-L414
31,283
letsencrypt/boulder
core/objects.go
FindChallengeByStringID
func (authz *Authorization) FindChallengeByStringID(id string) int { for i, c := range authz.Challenges { if c.StringID() == id { return i } } return -1 }
go
func (authz *Authorization) FindChallengeByStringID(id string) int { for i, c := range authz.Challenges { if c.StringID() == id { return i } } return -1 }
[ "func", "(", "authz", "*", "Authorization", ")", "FindChallengeByStringID", "(", "id", "string", ")", "int", "{", "for", "i", ",", "c", ":=", "range", "authz", ".", "Challenges", "{", "if", "c", ".", "StringID", "(", ")", "==", "id", "{", "return", "...
// FindChallengeByStringID will look for a challenge matching the given ID inside // this authorization. If found, it will return the index of that challenge within // the Authorization's Challenges array. Otherwise it will return -1.
[ "FindChallengeByStringID", "will", "look", "for", "a", "challenge", "matching", "the", "given", "ID", "inside", "this", "authorization", ".", "If", "found", "it", "will", "return", "the", "index", "of", "that", "challenge", "within", "the", "Authorization", "s",...
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L419-L426
31,284
letsencrypt/boulder
core/objects.go
base64URLEncode
func base64URLEncode(data []byte) string { var result = base64.URLEncoding.EncodeToString(data) return strings.TrimRight(result, "=") }
go
func base64URLEncode(data []byte) string { var result = base64.URLEncoding.EncodeToString(data) return strings.TrimRight(result, "=") }
[ "func", "base64URLEncode", "(", "data", "[", "]", "byte", ")", "string", "{", "var", "result", "=", "base64", ".", "URLEncoding", ".", "EncodeToString", "(", "data", ")", "\n", "return", "strings", ".", "TrimRight", "(", "result", ",", "\"", "\"", ")", ...
// URL-safe base64 encode that strips padding
[ "URL", "-", "safe", "base64", "encode", "that", "strips", "padding" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L448-L451
31,285
letsencrypt/boulder
core/objects.go
base64URLDecode
func base64URLDecode(data string) ([]byte, error) { var missing = (4 - len(data)%4) % 4 data += strings.Repeat("=", missing) return base64.URLEncoding.DecodeString(data) }
go
func base64URLDecode(data string) ([]byte, error) { var missing = (4 - len(data)%4) % 4 data += strings.Repeat("=", missing) return base64.URLEncoding.DecodeString(data) }
[ "func", "base64URLDecode", "(", "data", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "missing", "=", "(", "4", "-", "len", "(", "data", ")", "%", "4", ")", "%", "4", "\n", "data", "+=", "strings", ".", "Repeat", "(", "\"...
// URL-safe base64 decoder that adds padding
[ "URL", "-", "safe", "base64", "decoder", "that", "adds", "padding" ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L454-L458
31,286
letsencrypt/boulder
core/objects.go
MarshalJSON
func (jb JSONBuffer) MarshalJSON() (result []byte, err error) { return json.Marshal(base64URLEncode(jb)) }
go
func (jb JSONBuffer) MarshalJSON() (result []byte, err error) { return json.Marshal(base64URLEncode(jb)) }
[ "func", "(", "jb", "JSONBuffer", ")", "MarshalJSON", "(", ")", "(", "result", "[", "]", "byte", ",", "err", "error", ")", "{", "return", "json", ".", "Marshal", "(", "base64URLEncode", "(", "jb", ")", ")", "\n", "}" ]
// MarshalJSON encodes a JSONBuffer for transmission.
[ "MarshalJSON", "encodes", "a", "JSONBuffer", "for", "transmission", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L461-L463
31,287
letsencrypt/boulder
core/objects.go
UnmarshalJSON
func (jb *JSONBuffer) UnmarshalJSON(data []byte) (err error) { var str string err = json.Unmarshal(data, &str) if err != nil { return err } *jb, err = base64URLDecode(str) return }
go
func (jb *JSONBuffer) UnmarshalJSON(data []byte) (err error) { var str string err = json.Unmarshal(data, &str) if err != nil { return err } *jb, err = base64URLDecode(str) return }
[ "func", "(", "jb", "*", "JSONBuffer", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "var", "str", "string", "\n", "err", "=", "json", ".", "Unmarshal", "(", "data", ",", "&", "str", ")", "\n", "if", "err...
// UnmarshalJSON decodes a JSONBuffer to an object.
[ "UnmarshalJSON", "decodes", "a", "JSONBuffer", "to", "an", "object", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/objects.go#L466-L474
31,288
letsencrypt/boulder
web/relative.go
RelativeEndpoint
func RelativeEndpoint(request *http.Request, endpoint string) string { var result string proto := "http" host := request.Host // If the request was received via TLS, use `https://` for the protocol if request.TLS != nil { proto = "https" } // Allow upstream proxies to specify the forwarded protocol. Allow t...
go
func RelativeEndpoint(request *http.Request, endpoint string) string { var result string proto := "http" host := request.Host // If the request was received via TLS, use `https://` for the protocol if request.TLS != nil { proto = "https" } // Allow upstream proxies to specify the forwarded protocol. Allow t...
[ "func", "RelativeEndpoint", "(", "request", "*", "http", ".", "Request", ",", "endpoint", "string", ")", "string", "{", "var", "result", "string", "\n", "proto", ":=", "\"", "\"", "\n", "host", ":=", "request", ".", "Host", "\n\n", "// If the request was rec...
// RelativeEndpoint takes a path component of URL and constructs a new URL using // the host and port from the request combined the provided path.
[ "RelativeEndpoint", "takes", "a", "path", "component", "of", "URL", "and", "constructs", "a", "new", "URL", "using", "the", "host", "and", "port", "from", "the", "request", "combined", "the", "provided", "path", "." ]
a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf
https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/web/relative.go#L10-L36
31,289
go-telegram-bot-api/telegram-bot-api
helpers.go
NewMessage
func NewMessage(chatID int64, text string) MessageConfig { return MessageConfig{ BaseChat: BaseChat{ ChatID: chatID, ReplyToMessageID: 0, }, Text: text, DisableWebPagePreview: false, } }
go
func NewMessage(chatID int64, text string) MessageConfig { return MessageConfig{ BaseChat: BaseChat{ ChatID: chatID, ReplyToMessageID: 0, }, Text: text, DisableWebPagePreview: false, } }
[ "func", "NewMessage", "(", "chatID", "int64", ",", "text", "string", ")", "MessageConfig", "{", "return", "MessageConfig", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", ",", "ReplyToMessageID", ":", "0", ",", "}", ",", "Text", ":", "text"...
// NewMessage creates a new Message. // // chatID is where to send it, text is the message text.
[ "NewMessage", "creates", "a", "new", "Message", ".", "chatID", "is", "where", "to", "send", "it", "text", "is", "the", "message", "text", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L10-L19
31,290
go-telegram-bot-api/telegram-bot-api
helpers.go
NewDeleteMessage
func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig { return DeleteMessageConfig{ ChatID: chatID, MessageID: messageID, } }
go
func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig { return DeleteMessageConfig{ ChatID: chatID, MessageID: messageID, } }
[ "func", "NewDeleteMessage", "(", "chatID", "int64", ",", "messageID", "int", ")", "DeleteMessageConfig", "{", "return", "DeleteMessageConfig", "{", "ChatID", ":", "chatID", ",", "MessageID", ":", "messageID", ",", "}", "\n", "}" ]
// NewDeleteMessage creates a request to delete a message.
[ "NewDeleteMessage", "creates", "a", "request", "to", "delete", "a", "message", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L22-L27
31,291
go-telegram-bot-api/telegram-bot-api
helpers.go
NewMessageToChannel
func NewMessageToChannel(username string, text string) MessageConfig { return MessageConfig{ BaseChat: BaseChat{ ChannelUsername: username, }, Text: text, } }
go
func NewMessageToChannel(username string, text string) MessageConfig { return MessageConfig{ BaseChat: BaseChat{ ChannelUsername: username, }, Text: text, } }
[ "func", "NewMessageToChannel", "(", "username", "string", ",", "text", "string", ")", "MessageConfig", "{", "return", "MessageConfig", "{", "BaseChat", ":", "BaseChat", "{", "ChannelUsername", ":", "username", ",", "}", ",", "Text", ":", "text", ",", "}", "\...
// NewMessageToChannel creates a new Message that is sent to a channel // by username. // // username is the username of the channel, text is the message text.
[ "NewMessageToChannel", "creates", "a", "new", "Message", "that", "is", "sent", "to", "a", "channel", "by", "username", ".", "username", "is", "the", "username", "of", "the", "channel", "text", "is", "the", "message", "text", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L33-L40
31,292
go-telegram-bot-api/telegram-bot-api
helpers.go
NewForward
func NewForward(chatID int64, fromChatID int64, messageID int) ForwardConfig { return ForwardConfig{ BaseChat: BaseChat{ChatID: chatID}, FromChatID: fromChatID, MessageID: messageID, } }
go
func NewForward(chatID int64, fromChatID int64, messageID int) ForwardConfig { return ForwardConfig{ BaseChat: BaseChat{ChatID: chatID}, FromChatID: fromChatID, MessageID: messageID, } }
[ "func", "NewForward", "(", "chatID", "int64", ",", "fromChatID", "int64", ",", "messageID", "int", ")", "ForwardConfig", "{", "return", "ForwardConfig", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "FromChatID", ":", "fromChatID", ...
// NewForward creates a new forward. // // chatID is where to send it, fromChatID is the source chat, // and messageID is the ID of the original message.
[ "NewForward", "creates", "a", "new", "forward", ".", "chatID", "is", "where", "to", "send", "it", "fromChatID", "is", "the", "source", "chat", "and", "messageID", "is", "the", "ID", "of", "the", "original", "message", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L46-L52
31,293
go-telegram-bot-api/telegram-bot-api
helpers.go
NewPhotoUpload
func NewPhotoUpload(chatID int64, file interface{}) PhotoConfig { return PhotoConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
go
func NewPhotoUpload(chatID int64, file interface{}) PhotoConfig { return PhotoConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
[ "func", "NewPhotoUpload", "(", "chatID", "int64", ",", "file", "interface", "{", "}", ")", "PhotoConfig", "{", "return", "PhotoConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "File", ":",...
// NewPhotoUpload creates a new photo uploader. // // chatID is where to send it, file is a string path to the file, // FileReader, or FileBytes. // // Note that you must send animated GIFs as a document.
[ "NewPhotoUpload", "creates", "a", "new", "photo", "uploader", ".", "chatID", "is", "where", "to", "send", "it", "file", "is", "a", "string", "path", "to", "the", "file", "FileReader", "or", "FileBytes", ".", "Note", "that", "you", "must", "send", "animated...
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L60-L68
31,294
go-telegram-bot-api/telegram-bot-api
helpers.go
NewPhotoShare
func NewPhotoShare(chatID int64, fileID string) PhotoConfig { return PhotoConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
go
func NewPhotoShare(chatID int64, fileID string) PhotoConfig { return PhotoConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
[ "func", "NewPhotoShare", "(", "chatID", "int64", ",", "fileID", "string", ")", "PhotoConfig", "{", "return", "PhotoConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "FileID", ":", "fileID", ...
// NewPhotoShare shares an existing photo. // You may use this to reshare an existing photo without reuploading it. // // chatID is where to send it, fileID is the ID of the file // already uploaded.
[ "NewPhotoShare", "shares", "an", "existing", "photo", ".", "You", "may", "use", "this", "to", "reshare", "an", "existing", "photo", "without", "reuploading", "it", ".", "chatID", "is", "where", "to", "send", "it", "fileID", "is", "the", "ID", "of", "the", ...
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L75-L83
31,295
go-telegram-bot-api/telegram-bot-api
helpers.go
NewAudioUpload
func NewAudioUpload(chatID int64, file interface{}) AudioConfig { return AudioConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
go
func NewAudioUpload(chatID int64, file interface{}) AudioConfig { return AudioConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
[ "func", "NewAudioUpload", "(", "chatID", "int64", ",", "file", "interface", "{", "}", ")", "AudioConfig", "{", "return", "AudioConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "File", ":",...
// NewAudioUpload creates a new audio uploader. // // chatID is where to send it, file is a string path to the file, // FileReader, or FileBytes.
[ "NewAudioUpload", "creates", "a", "new", "audio", "uploader", ".", "chatID", "is", "where", "to", "send", "it", "file", "is", "a", "string", "path", "to", "the", "file", "FileReader", "or", "FileBytes", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L89-L97
31,296
go-telegram-bot-api/telegram-bot-api
helpers.go
NewAudioShare
func NewAudioShare(chatID int64, fileID string) AudioConfig { return AudioConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
go
func NewAudioShare(chatID int64, fileID string) AudioConfig { return AudioConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
[ "func", "NewAudioShare", "(", "chatID", "int64", ",", "fileID", "string", ")", "AudioConfig", "{", "return", "AudioConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "FileID", ":", "fileID", ...
// NewAudioShare shares an existing audio file. // You may use this to reshare an existing audio file without // reuploading it. // // chatID is where to send it, fileID is the ID of the audio // already uploaded.
[ "NewAudioShare", "shares", "an", "existing", "audio", "file", ".", "You", "may", "use", "this", "to", "reshare", "an", "existing", "audio", "file", "without", "reuploading", "it", ".", "chatID", "is", "where", "to", "send", "it", "fileID", "is", "the", "ID...
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L105-L113
31,297
go-telegram-bot-api/telegram-bot-api
helpers.go
NewDocumentUpload
func NewDocumentUpload(chatID int64, file interface{}) DocumentConfig { return DocumentConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
go
func NewDocumentUpload(chatID int64, file interface{}) DocumentConfig { return DocumentConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
[ "func", "NewDocumentUpload", "(", "chatID", "int64", ",", "file", "interface", "{", "}", ")", "DocumentConfig", "{", "return", "DocumentConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "File...
// NewDocumentUpload creates a new document uploader. // // chatID is where to send it, file is a string path to the file, // FileReader, or FileBytes.
[ "NewDocumentUpload", "creates", "a", "new", "document", "uploader", ".", "chatID", "is", "where", "to", "send", "it", "file", "is", "a", "string", "path", "to", "the", "file", "FileReader", "or", "FileBytes", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L119-L127
31,298
go-telegram-bot-api/telegram-bot-api
helpers.go
NewDocumentShare
func NewDocumentShare(chatID int64, fileID string) DocumentConfig { return DocumentConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
go
func NewDocumentShare(chatID int64, fileID string) DocumentConfig { return DocumentConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, FileID: fileID, UseExisting: true, }, } }
[ "func", "NewDocumentShare", "(", "chatID", "int64", ",", "fileID", "string", ")", "DocumentConfig", "{", "return", "DocumentConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "FileID", ":", "f...
// NewDocumentShare shares an existing document. // You may use this to reshare an existing document without // reuploading it. // // chatID is where to send it, fileID is the ID of the document // already uploaded.
[ "NewDocumentShare", "shares", "an", "existing", "document", ".", "You", "may", "use", "this", "to", "reshare", "an", "existing", "document", "without", "reuploading", "it", ".", "chatID", "is", "where", "to", "send", "it", "fileID", "is", "the", "ID", "of", ...
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L135-L143
31,299
go-telegram-bot-api/telegram-bot-api
helpers.go
NewStickerUpload
func NewStickerUpload(chatID int64, file interface{}) StickerConfig { return StickerConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
go
func NewStickerUpload(chatID int64, file interface{}) StickerConfig { return StickerConfig{ BaseFile: BaseFile{ BaseChat: BaseChat{ChatID: chatID}, File: file, UseExisting: false, }, } }
[ "func", "NewStickerUpload", "(", "chatID", "int64", ",", "file", "interface", "{", "}", ")", "StickerConfig", "{", "return", "StickerConfig", "{", "BaseFile", ":", "BaseFile", "{", "BaseChat", ":", "BaseChat", "{", "ChatID", ":", "chatID", "}", ",", "File", ...
// NewStickerUpload creates a new sticker uploader. // // chatID is where to send it, file is a string path to the file, // FileReader, or FileBytes.
[ "NewStickerUpload", "creates", "a", "new", "sticker", "uploader", ".", "chatID", "is", "where", "to", "send", "it", "file", "is", "a", "string", "path", "to", "the", "file", "FileReader", "or", "FileBytes", "." ]
87e7035a900c7cb1fd896e5f33b461c96c3ac31e
https://github.com/go-telegram-bot-api/telegram-bot-api/blob/87e7035a900c7cb1fd896e5f33b461c96c3ac31e/helpers.go#L149-L157