repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
letsencrypt/boulder | ca/ca.go | integrateOrphan | func (ca *CertificateAuthorityImpl) integrateOrphan() error {
item, err := ca.orphanQueue.Peek()
if err != nil {
if err == goque.ErrEmpty {
return goque.ErrEmpty
}
return fmt.Errorf("failed to peek into orphan queue: %s", err)
}
var orphan orphanedCert
if err = item.ToObject(&orphan); err != nil {
retur... | go | func (ca *CertificateAuthorityImpl) integrateOrphan() error {
item, err := ca.orphanQueue.Peek()
if err != nil {
if err == goque.ErrEmpty {
return goque.ErrEmpty
}
return fmt.Errorf("failed to peek into orphan queue: %s", err)
}
var orphan orphanedCert
if err = item.ToObject(&orphan); err != nil {
retur... | [
"func",
"(",
"ca",
"*",
"CertificateAuthorityImpl",
")",
"integrateOrphan",
"(",
")",
"error",
"{",
"item",
",",
"err",
":=",
"ca",
".",
"orphanQueue",
".",
"Peek",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"goque",
".",
"ErrE... | // integrateOrpan removes an orphan from the queue and adds it to the database. The
// item isn't dequeued until it is actually added to the database to prevent items from
// being lost if the CA is restarted between the item being dequeued and being added to
// the database. It calculates the issuance time by subtract... | [
"integrateOrpan",
"removes",
"an",
"orphan",
"from",
"the",
"queue",
"and",
"adds",
"it",
"to",
"the",
"database",
".",
"The",
"item",
"isn",
"t",
"dequeued",
"until",
"it",
"is",
"actually",
"added",
"to",
"the",
"database",
"to",
"prevent",
"items",
"fro... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ca/ca.go#L711-L736 | train |
letsencrypt/boulder | wfe2/verify.go | enforceJWSAuthType | func (wfe *WebFrontEndImpl) enforceJWSAuthType(
jws *jose.JSONWebSignature,
expectedAuthType jwsAuthType) *probs.ProblemDetails {
// Check the auth type for the provided JWS
authType, prob := checkJWSAuthType(jws)
if prob != nil {
wfe.stats.joseErrorCount.With(prometheus.Labels{"type": "JWSAuthTypeInvalid"}).Inc... | go | func (wfe *WebFrontEndImpl) enforceJWSAuthType(
jws *jose.JSONWebSignature,
expectedAuthType jwsAuthType) *probs.ProblemDetails {
// Check the auth type for the provided JWS
authType, prob := checkJWSAuthType(jws)
if prob != nil {
wfe.stats.joseErrorCount.With(prometheus.Labels{"type": "JWSAuthTypeInvalid"}).Inc... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"enforceJWSAuthType",
"(",
"jws",
"*",
"jose",
".",
"JSONWebSignature",
",",
"expectedAuthType",
"jwsAuthType",
")",
"*",
"probs",
".",
"ProblemDetails",
"{",
"// Check the auth type for the provided JWS",
"authType",
"... | // enforceJWSAuthType enforces a provided JWS has the provided auth type. If there
// is an error determining the auth type or if it is not the expected auth type
// then a problem is returned. | [
"enforceJWSAuthType",
"enforces",
"a",
"provided",
"JWS",
"has",
"the",
"provided",
"auth",
"type",
".",
"If",
"there",
"is",
"an",
"error",
"determining",
"the",
"auth",
"type",
"or",
"if",
"it",
"is",
"not",
"the",
"expected",
"auth",
"type",
"then",
"a"... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L114-L135 | train |
letsencrypt/boulder | wfe2/verify.go | validPOSTURL | func (wfe *WebFrontEndImpl) validPOSTURL(
request *http.Request,
jws *jose.JSONWebSignature) *probs.ProblemDetails {
// validPOSTURL is called after parseJWS() which defends against the incorrect
// number of signatures.
header := jws.Signatures[0].Header
extraHeaders := header.ExtraHeaders
// Check that there i... | go | func (wfe *WebFrontEndImpl) validPOSTURL(
request *http.Request,
jws *jose.JSONWebSignature) *probs.ProblemDetails {
// validPOSTURL is called after parseJWS() which defends against the incorrect
// number of signatures.
header := jws.Signatures[0].Header
extraHeaders := header.ExtraHeaders
// Check that there i... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"validPOSTURL",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"jws",
"*",
"jose",
".",
"JSONWebSignature",
")",
"*",
"probs",
".",
"ProblemDetails",
"{",
"// validPOSTURL is called after parseJWS() which defends a... | // validPOSTURL checks the JWS' URL header against the expected URL based on the
// HTTP request. This prevents a JWS intended for one endpoint being replayed
// against a different endpoint. If the URL isn't present, is invalid, or
// doesn't match the HTTP request a problem is returned. | [
"validPOSTURL",
"checks",
"the",
"JWS",
"URL",
"header",
"against",
"the",
"expected",
"URL",
"based",
"on",
"the",
"HTTP",
"request",
".",
"This",
"prevents",
"a",
"JWS",
"intended",
"for",
"one",
"endpoint",
"being",
"replayed",
"against",
"a",
"different",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L199-L231 | train |
letsencrypt/boulder | wfe2/verify.go | matchJWSURLs | func (wfe *WebFrontEndImpl) matchJWSURLs(outer, inner *jose.JSONWebSignature) *probs.ProblemDetails {
// Verify that the outer JWS has a non-empty URL header. This is strictly
// defensive since the expectation is that endpoints using `matchJWSURLs`
// have received at least one of their JWS from calling validPOSTFo... | go | func (wfe *WebFrontEndImpl) matchJWSURLs(outer, inner *jose.JSONWebSignature) *probs.ProblemDetails {
// Verify that the outer JWS has a non-empty URL header. This is strictly
// defensive since the expectation is that endpoints using `matchJWSURLs`
// have received at least one of their JWS from calling validPOSTFo... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"matchJWSURLs",
"(",
"outer",
",",
"inner",
"*",
"jose",
".",
"JSONWebSignature",
")",
"*",
"probs",
".",
"ProblemDetails",
"{",
"// Verify that the outer JWS has a non-empty URL header. This is strictly",
"// defensive sin... | // matchJWSURLs checks two JWS' URL headers are equal. This is used during key
// rollover to check that the inner JWS URL matches the outer JWS URL. If the
// JWS URLs do not match a problem is returned. | [
"matchJWSURLs",
"checks",
"two",
"JWS",
"URL",
"headers",
"are",
"equal",
".",
"This",
"is",
"used",
"during",
"key",
"rollover",
"to",
"check",
"that",
"the",
"inner",
"JWS",
"URL",
"matches",
"the",
"outer",
"JWS",
"URL",
".",
"If",
"the",
"JWS",
"URLs... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L236-L263 | train |
letsencrypt/boulder | wfe2/verify.go | parseJWSRequest | func (wfe *WebFrontEndImpl) parseJWSRequest(request *http.Request) (*jose.JSONWebSignature, *probs.ProblemDetails) {
// Verify that the POST request has the expected headers
if prob := wfe.validPOSTRequest(request); prob != nil {
return nil, prob
}
// Read the POST request body's bytes. validPOSTRequest has alre... | go | func (wfe *WebFrontEndImpl) parseJWSRequest(request *http.Request) (*jose.JSONWebSignature, *probs.ProblemDetails) {
// Verify that the POST request has the expected headers
if prob := wfe.validPOSTRequest(request); prob != nil {
return nil, prob
}
// Read the POST request body's bytes. validPOSTRequest has alre... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"parseJWSRequest",
"(",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"jose",
".",
"JSONWebSignature",
",",
"*",
"probs",
".",
"ProblemDetails",
")",
"{",
"// Verify that the POST request has the expected h... | // parseJWSRequest extracts a JSONWebSignature from an HTTP POST request's body using parseJWS. | [
"parseJWSRequest",
"extracts",
"a",
"JSONWebSignature",
"from",
"an",
"HTTP",
"POST",
"request",
"s",
"body",
"using",
"parseJWS",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L326-L341 | train |
letsencrypt/boulder | wfe2/verify.go | extractJWK | func (wfe *WebFrontEndImpl) extractJWK(jws *jose.JSONWebSignature) (*jose.JSONWebKey, *probs.ProblemDetails) {
// extractJWK expects the request to be using an embedded JWK auth type and
// to not contain the mutually exclusive KeyID.
if prob := wfe.enforceJWSAuthType(jws, embeddedJWK); prob != nil {
return nil, p... | go | func (wfe *WebFrontEndImpl) extractJWK(jws *jose.JSONWebSignature) (*jose.JSONWebKey, *probs.ProblemDetails) {
// extractJWK expects the request to be using an embedded JWK auth type and
// to not contain the mutually exclusive KeyID.
if prob := wfe.enforceJWSAuthType(jws, embeddedJWK); prob != nil {
return nil, p... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"extractJWK",
"(",
"jws",
"*",
"jose",
".",
"JSONWebSignature",
")",
"(",
"*",
"jose",
".",
"JSONWebKey",
",",
"*",
"probs",
".",
"ProblemDetails",
")",
"{",
"// extractJWK expects the request to be using an embedde... | // extractJWK extracts a JWK from a provided JWS or returns a problem. It
// expects that the JWS is using the embedded JWK style of authentication and
// does not contain an embedded Key ID. Callers should have acquired the
// provided JWS from parseJWS to ensure it has the correct number of signatures
// present. | [
"extractJWK",
"extracts",
"a",
"JWK",
"from",
"a",
"provided",
"JWS",
"or",
"returns",
"a",
"problem",
".",
"It",
"expects",
"that",
"the",
"JWS",
"is",
"using",
"the",
"embedded",
"JWK",
"style",
"of",
"authentication",
"and",
"does",
"not",
"contain",
"a... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L348-L369 | train |
letsencrypt/boulder | wfe2/verify.go | acctIDFromURL | func (wfe *WebFrontEndImpl) acctIDFromURL(acctURL string, request *http.Request) (int64, *probs.ProblemDetails) {
// For normal ACME v2 accounts we expect the account URL has a prefix composed
// of the Host header and the acctPath.
expectedURLPrefix := web.RelativeEndpoint(request, acctPath)
// Process the acctUR... | go | func (wfe *WebFrontEndImpl) acctIDFromURL(acctURL string, request *http.Request) (int64, *probs.ProblemDetails) {
// For normal ACME v2 accounts we expect the account URL has a prefix composed
// of the Host header and the acctPath.
expectedURLPrefix := web.RelativeEndpoint(request, acctPath)
// Process the acctUR... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"acctIDFromURL",
"(",
"acctURL",
"string",
",",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"int64",
",",
"*",
"probs",
".",
"ProblemDetails",
")",
"{",
"// For normal ACME v2 accounts we expect the account UR... | // acctIDFromURL extracts the numeric int64 account ID from a ACMEv1 or ACMEv2
// account URL. If the acctURL has an invalid URL or the account ID in the
// acctURL is non-numeric a MalformedProblem is returned. | [
"acctIDFromURL",
"extracts",
"the",
"numeric",
"int64",
"account",
"ID",
"from",
"a",
"ACMEv1",
"or",
"ACMEv2",
"account",
"URL",
".",
"If",
"the",
"acctURL",
"has",
"an",
"invalid",
"URL",
"or",
"the",
"account",
"ID",
"in",
"the",
"acctURL",
"is",
"non",... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L374-L400 | train |
letsencrypt/boulder | wfe2/verify.go | lookupJWK | func (wfe *WebFrontEndImpl) lookupJWK(
jws *jose.JSONWebSignature,
ctx context.Context,
request *http.Request,
logEvent *web.RequestEvent) (*jose.JSONWebKey, *core.Registration, *probs.ProblemDetails) {
// We expect the request to be using an embedded Key ID auth type and to not
// contain the mutually exclusive ... | go | func (wfe *WebFrontEndImpl) lookupJWK(
jws *jose.JSONWebSignature,
ctx context.Context,
request *http.Request,
logEvent *web.RequestEvent) (*jose.JSONWebKey, *core.Registration, *probs.ProblemDetails) {
// We expect the request to be using an embedded Key ID auth type and to not
// contain the mutually exclusive ... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"lookupJWK",
"(",
"jws",
"*",
"jose",
".",
"JSONWebSignature",
",",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"http",
".",
"Request",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
")",
"("... | // lookupJWK finds a JWK associated with the Key ID present in a provided JWS,
// returning the JWK and a pointer to the associated account, or a problem. It
// expects that the JWS is using the embedded Key ID style of authentication
// and does not contain an embedded JWK. Callers should have acquired the
// provided... | [
"lookupJWK",
"finds",
"a",
"JWK",
"associated",
"with",
"the",
"Key",
"ID",
"present",
"in",
"a",
"provided",
"JWS",
"returning",
"the",
"JWK",
"and",
"a",
"pointer",
"to",
"the",
"associated",
"account",
"or",
"a",
"problem",
".",
"It",
"expects",
"that",... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L408-L456 | train |
letsencrypt/boulder | wfe2/verify.go | validPOSTForAccount | func (wfe *WebFrontEndImpl) validPOSTForAccount(
request *http.Request,
ctx context.Context,
logEvent *web.RequestEvent) ([]byte, *jose.JSONWebSignature, *core.Registration, *probs.ProblemDetails) {
// Parse the JWS from the POST request
jws, prob := wfe.parseJWSRequest(request)
if prob != nil {
return nil, nil... | go | func (wfe *WebFrontEndImpl) validPOSTForAccount(
request *http.Request,
ctx context.Context,
logEvent *web.RequestEvent) ([]byte, *jose.JSONWebSignature, *core.Registration, *probs.ProblemDetails) {
// Parse the JWS from the POST request
jws, prob := wfe.parseJWSRequest(request)
if prob != nil {
return nil, nil... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"validPOSTForAccount",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
")",
"(",
"[",
"]",
"byte",
",",
"*",
"jose",
... | // validPOSTForAccount checks that a given POST request has a valid JWS
// using `validJWSForAccount`. If valid, the authenticated JWS body and the
// registration that authenticated the body are returned. Otherwise a problem is
// returned. The returned JWS body may be empty if the request is a POST-as-GET
// request. | [
"validPOSTForAccount",
"checks",
"that",
"a",
"given",
"POST",
"request",
"has",
"a",
"valid",
"JWS",
"using",
"validJWSForAccount",
".",
"If",
"valid",
"the",
"authenticated",
"JWS",
"body",
"and",
"the",
"registration",
"that",
"authenticated",
"the",
"body",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L546-L556 | train |
letsencrypt/boulder | wfe2/verify.go | validSelfAuthenticatedPOST | func (wfe *WebFrontEndImpl) validSelfAuthenticatedPOST(
request *http.Request,
logEvent *web.RequestEvent) ([]byte, *jose.JSONWebKey, *probs.ProblemDetails) {
// Parse the JWS from the POST request
jws, prob := wfe.parseJWSRequest(request)
if prob != nil {
return nil, nil, prob
}
// Extract and validate the em... | go | func (wfe *WebFrontEndImpl) validSelfAuthenticatedPOST(
request *http.Request,
logEvent *web.RequestEvent) ([]byte, *jose.JSONWebKey, *probs.ProblemDetails) {
// Parse the JWS from the POST request
jws, prob := wfe.parseJWSRequest(request)
if prob != nil {
return nil, nil, prob
}
// Extract and validate the em... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"validSelfAuthenticatedPOST",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
")",
"(",
"[",
"]",
"byte",
",",
"*",
"jose",
".",
"JSONWebKey",
",",
"*",
"prob... | // validSelfAuthenticatedPOST checks that a given POST request has a valid JWS
// using `validSelfAuthenticatedJWS`. | [
"validSelfAuthenticatedPOST",
"checks",
"that",
"a",
"given",
"POST",
"request",
"has",
"a",
"valid",
"JWS",
"using",
"validSelfAuthenticatedJWS",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/verify.go#L619-L629 | train |
letsencrypt/boulder | bdns/dns.go | NewDNSClientImpl | func NewDNSClientImpl(
readTimeout time.Duration,
servers []string,
stats metrics.Scope,
clk clock.Clock,
maxTries int,
) *DNSClientImpl {
stats = stats.NewScope("DNS")
// TODO(jmhodges): make constructor use an Option func pattern
dnsClient := new(dns.Client)
// Set timeout for underlying net.Conn
dnsClient... | go | func NewDNSClientImpl(
readTimeout time.Duration,
servers []string,
stats metrics.Scope,
clk clock.Clock,
maxTries int,
) *DNSClientImpl {
stats = stats.NewScope("DNS")
// TODO(jmhodges): make constructor use an Option func pattern
dnsClient := new(dns.Client)
// Set timeout for underlying net.Conn
dnsClient... | [
"func",
"NewDNSClientImpl",
"(",
"readTimeout",
"time",
".",
"Duration",
",",
"servers",
"[",
"]",
"string",
",",
"stats",
"metrics",
".",
"Scope",
",",
"clk",
"clock",
".",
"Clock",
",",
"maxTries",
"int",
",",
")",
"*",
"DNSClientImpl",
"{",
"stats",
"... | // NewDNSClientImpl constructs a new DNS resolver object that utilizes the
// provided list of DNS servers for resolution. | [
"NewDNSClientImpl",
"constructs",
"a",
"new",
"DNS",
"resolver",
"object",
"that",
"utilizes",
"the",
"provided",
"list",
"of",
"DNS",
"servers",
"for",
"resolution",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/dns.go#L175-L225 | train |
letsencrypt/boulder | bdns/dns.go | LookupTXT | func (dnsClient *DNSClientImpl) LookupTXT(ctx context.Context, hostname string) ([]string, []string, error) {
var txt []string
dnsType := dns.TypeTXT
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode != dns.RcodeSuccess {
... | go | func (dnsClient *DNSClientImpl) LookupTXT(ctx context.Context, hostname string) ([]string, []string, error) {
var txt []string
dnsType := dns.TypeTXT
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode != dns.RcodeSuccess {
... | [
"func",
"(",
"dnsClient",
"*",
"DNSClientImpl",
")",
"LookupTXT",
"(",
"ctx",
"context",
".",
"Context",
",",
"hostname",
"string",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"txt",
"[",
"]",
"string",
"\n",... | // LookupTXT sends a DNS query to find all TXT records associated with
// the provided hostname which it returns along with the returned
// DNS authority section. | [
"LookupTXT",
"sends",
"a",
"DNS",
"query",
"to",
"find",
"all",
"TXT",
"records",
"associated",
"with",
"the",
"provided",
"hostname",
"which",
"it",
"returns",
"along",
"with",
"the",
"returned",
"DNS",
"authority",
"section",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/dns.go#L360-L385 | train |
letsencrypt/boulder | bdns/dns.go | LookupCAA | func (dnsClient *DNSClientImpl) LookupCAA(ctx context.Context, hostname string) ([]*dns.CAA, error) {
dnsType := dns.TypeCAA
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode == dns.RcodeServerFailure {
return nil, &DNSError{... | go | func (dnsClient *DNSClientImpl) LookupCAA(ctx context.Context, hostname string) ([]*dns.CAA, error) {
dnsType := dns.TypeCAA
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode == dns.RcodeServerFailure {
return nil, &DNSError{... | [
"func",
"(",
"dnsClient",
"*",
"DNSClientImpl",
")",
"LookupCAA",
"(",
"ctx",
"context",
".",
"Context",
",",
"hostname",
"string",
")",
"(",
"[",
"]",
"*",
"dns",
".",
"CAA",
",",
"error",
")",
"{",
"dnsType",
":=",
"dns",
".",
"TypeCAA",
"\n",
"r",... | // LookupCAA sends a DNS query to find all CAA records associated with
// the provided hostname. | [
"LookupCAA",
"sends",
"a",
"DNS",
"query",
"to",
"find",
"all",
"CAA",
"records",
"associated",
"with",
"the",
"provided",
"hostname",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/dns.go#L465-L483 | train |
letsencrypt/boulder | bdns/dns.go | LookupMX | func (dnsClient *DNSClientImpl) LookupMX(ctx context.Context, hostname string) ([]string, error) {
dnsType := dns.TypeMX
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode != dns.RcodeSuccess {
return nil, &DNSError{dnsType, ho... | go | func (dnsClient *DNSClientImpl) LookupMX(ctx context.Context, hostname string) ([]string, error) {
dnsType := dns.TypeMX
r, err := dnsClient.exchangeOne(ctx, hostname, dnsType)
if err != nil {
return nil, &DNSError{dnsType, hostname, err, -1}
}
if r.Rcode != dns.RcodeSuccess {
return nil, &DNSError{dnsType, ho... | [
"func",
"(",
"dnsClient",
"*",
"DNSClientImpl",
")",
"LookupMX",
"(",
"ctx",
"context",
".",
"Context",
",",
"hostname",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"dnsType",
":=",
"dns",
".",
"TypeMX",
"\n",
"r",
",",
"err",
":=... | // LookupMX sends a DNS query to find a MX record associated hostname and returns the
// record target. | [
"LookupMX",
"sends",
"a",
"DNS",
"query",
"to",
"find",
"a",
"MX",
"record",
"associated",
"hostname",
"and",
"returns",
"the",
"record",
"target",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/bdns/dns.go#L487-L505 | train |
letsencrypt/boulder | cmd/gen-key/rsa.go | rsaArgs | func rsaArgs(label string, modulusLen, exponent uint, keyID []byte) generateArgs {
// Encode as unpadded big endian encoded byte slice
expSlice := big.NewInt(int64(exponent)).Bytes()
log.Printf("\tEncoded public exponent (%d) as: %0X\n", exponent, expSlice)
return generateArgs{
mechanism: []*pkcs11.Mechanism{
... | go | func rsaArgs(label string, modulusLen, exponent uint, keyID []byte) generateArgs {
// Encode as unpadded big endian encoded byte slice
expSlice := big.NewInt(int64(exponent)).Bytes()
log.Printf("\tEncoded public exponent (%d) as: %0X\n", exponent, expSlice)
return generateArgs{
mechanism: []*pkcs11.Mechanism{
... | [
"func",
"rsaArgs",
"(",
"label",
"string",
",",
"modulusLen",
",",
"exponent",
"uint",
",",
"keyID",
"[",
"]",
"byte",
")",
"generateArgs",
"{",
"// Encode as unpadded big endian encoded byte slice",
"expSlice",
":=",
"big",
".",
"NewInt",
"(",
"int64",
"(",
"ex... | // rsaArgs constructs the private and public key template attributes sent to the
// device and specifies which mechanism should be used. modulusLen specifies the
// length of the modulus to be generated on the device in bits and exponent
// specifies the public exponent that should be used. | [
"rsaArgs",
"constructs",
"the",
"private",
"and",
"public",
"key",
"template",
"attributes",
"sent",
"to",
"the",
"device",
"and",
"specifies",
"which",
"mechanism",
"should",
"be",
"used",
".",
"modulusLen",
"specifies",
"the",
"length",
"of",
"the",
"modulus",... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/rsa.go#L21-L52 | train |
letsencrypt/boulder | cmd/gen-key/rsa.go | rsaPub | func rsaPub(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, modulusLen, exponent uint) (*rsa.PublicKey, error) {
pubKey, err := pkcs11helpers.GetRSAPublicKey(ctx, session, object)
if err != nil {
return nil, err
}
if pubKey.E != int(exponent) {
return nil, errors.New("returned... | go | func rsaPub(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, modulusLen, exponent uint) (*rsa.PublicKey, error) {
pubKey, err := pkcs11helpers.GetRSAPublicKey(ctx, session, object)
if err != nil {
return nil, err
}
if pubKey.E != int(exponent) {
return nil, errors.New("returned... | [
"func",
"rsaPub",
"(",
"ctx",
"pkcs11helpers",
".",
"PKCtx",
",",
"session",
"pkcs11",
".",
"SessionHandle",
",",
"object",
"pkcs11",
".",
"ObjectHandle",
",",
"modulusLen",
",",
"exponent",
"uint",
")",
"(",
"*",
"rsa",
".",
"PublicKey",
",",
"error",
")"... | // rsaPub extracts the generated public key, specified by the provided object
// handle, and constructs a rsa.PublicKey. It also checks that the key has the
// correct length modulus and that the public exponent is what was requested in
// the public key template. | [
"rsaPub",
"extracts",
"the",
"generated",
"public",
"key",
"specified",
"by",
"the",
"provided",
"object",
"handle",
"and",
"constructs",
"a",
"rsa",
".",
"PublicKey",
".",
"It",
"also",
"checks",
"that",
"the",
"key",
"has",
"the",
"correct",
"length",
"mod... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/rsa.go#L58-L72 | train |
letsencrypt/boulder | cmd/gen-key/rsa.go | rsaVerify | func rsaVerify(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, pub *rsa.PublicKey) error {
nonce, err := getRandomBytes(ctx, session)
if err != nil {
return fmt.Errorf("Failed to retrieve nonce: %s", err)
}
log.Printf("\tConstructed nonce: %d (%X)\n", big.NewInt(0).SetBytes(nonc... | go | func rsaVerify(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, pub *rsa.PublicKey) error {
nonce, err := getRandomBytes(ctx, session)
if err != nil {
return fmt.Errorf("Failed to retrieve nonce: %s", err)
}
log.Printf("\tConstructed nonce: %d (%X)\n", big.NewInt(0).SetBytes(nonc... | [
"func",
"rsaVerify",
"(",
"ctx",
"pkcs11helpers",
".",
"PKCtx",
",",
"session",
"pkcs11",
".",
"SessionHandle",
",",
"object",
"pkcs11",
".",
"ObjectHandle",
",",
"pub",
"*",
"rsa",
".",
"PublicKey",
")",
"error",
"{",
"nonce",
",",
"err",
":=",
"getRandom... | // rsaVerify verifies that the extracted public key corresponds with the generated
// private key on the device, specified by the provided object handle, by signing
// a nonce generated on the device and verifying the returned signature using the
// public key. | [
"rsaVerify",
"verifies",
"that",
"the",
"extracted",
"public",
"key",
"corresponds",
"with",
"the",
"generated",
"private",
"key",
"on",
"the",
"device",
"specified",
"by",
"the",
"provided",
"object",
"handle",
"by",
"signing",
"a",
"nonce",
"generated",
"on",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/rsa.go#L78-L97 | train |
letsencrypt/boulder | cmd/gen-key/rsa.go | rsaGenerate | func rsaGenerate(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label string, modulusLen, pubExponent uint) (*rsa.PublicKey, error) {
keyID := make([]byte, 4)
_, err := rand.Read(keyID)
if err != nil {
return nil, err
}
log.Printf("Generating RSA key with %d bit modulus and public exponent %d and ID %x\n... | go | func rsaGenerate(ctx pkcs11helpers.PKCtx, session pkcs11.SessionHandle, label string, modulusLen, pubExponent uint) (*rsa.PublicKey, error) {
keyID := make([]byte, 4)
_, err := rand.Read(keyID)
if err != nil {
return nil, err
}
log.Printf("Generating RSA key with %d bit modulus and public exponent %d and ID %x\n... | [
"func",
"rsaGenerate",
"(",
"ctx",
"pkcs11helpers",
".",
"PKCtx",
",",
"session",
"pkcs11",
".",
"SessionHandle",
",",
"label",
"string",
",",
"modulusLen",
",",
"pubExponent",
"uint",
")",
"(",
"*",
"rsa",
".",
"PublicKey",
",",
"error",
")",
"{",
"keyID"... | // rsaGenerate is used to generate and verify a RSA key pair of the size
// specified by modulusLen and with the exponent specified by pubExponent.
// It returns the public part of the generated key pair as a rsa.PublicKey. | [
"rsaGenerate",
"is",
"used",
"to",
"generate",
"and",
"verify",
"a",
"RSA",
"key",
"pair",
"of",
"the",
"size",
"specified",
"by",
"modulusLen",
"and",
"with",
"the",
"exponent",
"specified",
"by",
"pubExponent",
".",
"It",
"returns",
"the",
"public",
"part"... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/gen-key/rsa.go#L102-L127 | train |
letsencrypt/boulder | log/log.go | New | func New(log *syslog.Writer, stdoutLogLevel int, syslogLogLevel int) (Logger, error) {
if log == nil {
return nil, errors.New("Attempted to use a nil System Logger.")
}
return &impl{
&bothWriter{log, stdoutLogLevel, syslogLogLevel, clock.Default()},
}, nil
} | go | func New(log *syslog.Writer, stdoutLogLevel int, syslogLogLevel int) (Logger, error) {
if log == nil {
return nil, errors.New("Attempted to use a nil System Logger.")
}
return &impl{
&bothWriter{log, stdoutLogLevel, syslogLogLevel, clock.Default()},
}, nil
} | [
"func",
"New",
"(",
"log",
"*",
"syslog",
".",
"Writer",
",",
"stdoutLogLevel",
"int",
",",
"syslogLogLevel",
"int",
")",
"(",
"Logger",
",",
"error",
")",
"{",
"if",
"log",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"... | // New returns a new Logger that uses the given syslog.Writer as a backend. | [
"New",
"returns",
"a",
"new",
"Logger",
"that",
"uses",
"the",
"given",
"syslog",
".",
"Writer",
"as",
"a",
"backend",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L55-L62 | train |
letsencrypt/boulder | log/log.go | initialize | func initialize() {
// defaultPriority is never used because we always use specific priority-based
// logging methods.
const defaultPriority = syslog.LOG_INFO | syslog.LOG_LOCAL0
syslogger, err := syslog.Dial("", "", defaultPriority, "test")
if err != nil {
panic(err)
}
logger, err := New(syslogger, int(syslog... | go | func initialize() {
// defaultPriority is never used because we always use specific priority-based
// logging methods.
const defaultPriority = syslog.LOG_INFO | syslog.LOG_LOCAL0
syslogger, err := syslog.Dial("", "", defaultPriority, "test")
if err != nil {
panic(err)
}
logger, err := New(syslogger, int(syslog... | [
"func",
"initialize",
"(",
")",
"{",
"// defaultPriority is never used because we always use specific priority-based",
"// logging methods.",
"const",
"defaultPriority",
"=",
"syslog",
".",
"LOG_INFO",
"|",
"syslog",
".",
"LOG_LOCAL0",
"\n",
"syslogger",
",",
"err",
":=",
... | // initialize should only be used in unit tests. | [
"initialize",
"should",
"only",
"be",
"used",
"in",
"unit",
"tests",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L65-L79 | train |
letsencrypt/boulder | log/log.go | Set | func Set(logger Logger) (err error) {
if _Singleton.log != nil {
err = errors.New("You may not call Set after it has already been implicitly or explicitly set.")
_Singleton.log.Warning(err.Error())
} else {
_Singleton.log = logger
}
return
} | go | func Set(logger Logger) (err error) {
if _Singleton.log != nil {
err = errors.New("You may not call Set after it has already been implicitly or explicitly set.")
_Singleton.log.Warning(err.Error())
} else {
_Singleton.log = logger
}
return
} | [
"func",
"Set",
"(",
"logger",
"Logger",
")",
"(",
"err",
"error",
")",
"{",
"if",
"_Singleton",
".",
"log",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"_Singleton",
".",
"log",
".",
"Warning",
"(",
"err",
".",... | // Set configures the singleton Logger. This method
// must only be called once, and before calling Get the
// first time. | [
"Set",
"configures",
"the",
"singleton",
"Logger",
".",
"This",
"method",
"must",
"only",
"be",
"called",
"once",
"and",
"before",
"calling",
"Get",
"the",
"first",
"time",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L84-L92 | train |
letsencrypt/boulder | log/log.go | Get | func Get() Logger {
_Singleton.once.Do(func() {
if _Singleton.log == nil {
initialize()
}
})
return _Singleton.log
} | go | func Get() Logger {
_Singleton.once.Do(func() {
if _Singleton.log == nil {
initialize()
}
})
return _Singleton.log
} | [
"func",
"Get",
"(",
")",
"Logger",
"{",
"_Singleton",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"if",
"_Singleton",
".",
"log",
"==",
"nil",
"{",
"initialize",
"(",
")",
"\n",
"}",
"\n",
"}",
")",
"\n\n",
"return",
"_Singleton",
".",
"l... | // Get obtains the singleton Logger. If Set has not been called first, this
// method initializes with basic defaults. The basic defaults cannot error, and
// subsequent access to an already-set Logger also cannot error, so this method is
// error-safe. | [
"Get",
"obtains",
"the",
"singleton",
"Logger",
".",
"If",
"Set",
"has",
"not",
"been",
"called",
"first",
"this",
"method",
"initializes",
"with",
"basic",
"defaults",
".",
"The",
"basic",
"defaults",
"cannot",
"error",
"and",
"subsequent",
"access",
"to",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L98-L106 | train |
letsencrypt/boulder | log/log.go | logAtLevel | func (w *bothWriter) logAtLevel(level syslog.Priority, msg string) {
var prefix string
var err error
const red = "\033[31m\033[1m"
const yellow = "\033[33m"
switch syslogAllowed := int(level) <= w.syslogLevel; level {
case syslog.LOG_ERR:
if syslogAllowed {
err = w.Err(msg)
}
prefix = red + "E"
case s... | go | func (w *bothWriter) logAtLevel(level syslog.Priority, msg string) {
var prefix string
var err error
const red = "\033[31m\033[1m"
const yellow = "\033[33m"
switch syslogAllowed := int(level) <= w.syslogLevel; level {
case syslog.LOG_ERR:
if syslogAllowed {
err = w.Err(msg)
}
prefix = red + "E"
case s... | [
"func",
"(",
"w",
"*",
"bothWriter",
")",
"logAtLevel",
"(",
"level",
"syslog",
".",
"Priority",
",",
"msg",
"string",
")",
"{",
"var",
"prefix",
"string",
"\n",
"var",
"err",
"error",
"\n\n",
"const",
"red",
"=",
"\"",
"\\033",
"\\033",
"\"",
"\n",
... | // Log the provided message at the appropriate level, writing to
// both stdout and the Logger | [
"Log",
"the",
"provided",
"message",
"at",
"the",
"appropriate",
"level",
"writing",
"to",
"both",
"stdout",
"and",
"the",
"Logger"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L122-L171 | train |
letsencrypt/boulder | log/log.go | caller | func caller(level int) string {
_, file, line, _ := runtime.Caller(level)
splits := strings.Split(file, "/")
filename := splits[len(splits)-1]
return fmt.Sprintf("%s:%d:", filename, line)
} | go | func caller(level int) string {
_, file, line, _ := runtime.Caller(level)
splits := strings.Split(file, "/")
filename := splits[len(splits)-1]
return fmt.Sprintf("%s:%d:", filename, line)
} | [
"func",
"caller",
"(",
"level",
"int",
")",
"string",
"{",
"_",
",",
"file",
",",
"line",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"level",
")",
"\n",
"splits",
":=",
"strings",
".",
"Split",
"(",
"file",
",",
"\"",
"\"",
")",
"\n",
"filena... | // Return short format caller info for panic events, skipping to before the
// panic handler. | [
"Return",
"short",
"format",
"caller",
"info",
"for",
"panic",
"events",
"skipping",
"to",
"before",
"the",
"panic",
"handler",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L180-L185 | train |
letsencrypt/boulder | log/log.go | AuditPanic | func (log *impl) AuditPanic() {
if err := recover(); err != nil {
buf := make([]byte, 8192)
log.AuditErrf("Panic caused by err: %s", err)
runtime.Stack(buf, false)
log.AuditErrf("Stack Trace (Current frame) %s", buf)
runtime.Stack(buf, true)
log.Warningf("Stack Trace (All frames): %s", buf)
}
} | go | func (log *impl) AuditPanic() {
if err := recover(); err != nil {
buf := make([]byte, 8192)
log.AuditErrf("Panic caused by err: %s", err)
runtime.Stack(buf, false)
log.AuditErrf("Stack Trace (Current frame) %s", buf)
runtime.Stack(buf, true)
log.Warningf("Stack Trace (All frames): %s", buf)
}
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditPanic",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"8192",
")",
"\n",
"log",
".",
"AuditErrf",
"(",
"\"",
"... | // AuditPanic catches panicking executables. This method should be added
// in a defer statement as early as possible | [
"AuditPanic",
"catches",
"panicking",
"executables",
".",
"This",
"method",
"should",
"be",
"added",
"in",
"a",
"defer",
"statement",
"as",
"early",
"as",
"possible"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L189-L200 | train |
letsencrypt/boulder | log/log.go | Err | func (log *impl) Err(msg string) {
log.auditAtLevel(syslog.LOG_ERR, msg)
} | go | func (log *impl) Err(msg string) {
log.auditAtLevel(syslog.LOG_ERR, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Err",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"auditAtLevel",
"(",
"syslog",
".",
"LOG_ERR",
",",
"msg",
")",
"\n",
"}"
] | // Err level messages are always marked with the audit tag, for special handling
// at the upstream system logger. | [
"Err",
"level",
"messages",
"are",
"always",
"marked",
"with",
"the",
"audit",
"tag",
"for",
"special",
"handling",
"at",
"the",
"upstream",
"system",
"logger",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L204-L206 | train |
letsencrypt/boulder | log/log.go | Errf | func (log *impl) Errf(format string, a ...interface{}) {
log.Err(fmt.Sprintf(format, a...))
} | go | func (log *impl) Errf(format string, a ...interface{}) {
log.Err(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Errf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"Err",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // Errf level messages are always marked with the audit tag, for special handling
// at the upstream system logger. | [
"Errf",
"level",
"messages",
"are",
"always",
"marked",
"with",
"the",
"audit",
"tag",
"for",
"special",
"handling",
"at",
"the",
"upstream",
"system",
"logger",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L210-L212 | train |
letsencrypt/boulder | log/log.go | Warning | func (log *impl) Warning(msg string) {
log.w.logAtLevel(syslog.LOG_WARNING, msg)
} | go | func (log *impl) Warning(msg string) {
log.w.logAtLevel(syslog.LOG_WARNING, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Warning",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"w",
".",
"logAtLevel",
"(",
"syslog",
".",
"LOG_WARNING",
",",
"msg",
")",
"\n",
"}"
] | // Warning level messages pass through normally. | [
"Warning",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L215-L217 | train |
letsencrypt/boulder | log/log.go | Warningf | func (log *impl) Warningf(format string, a ...interface{}) {
log.Warning(fmt.Sprintf(format, a...))
} | go | func (log *impl) Warningf(format string, a ...interface{}) {
log.Warning(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Warningf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"Warning",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // Warningf level messages pass through normally. | [
"Warningf",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L220-L222 | train |
letsencrypt/boulder | log/log.go | Info | func (log *impl) Info(msg string) {
log.w.logAtLevel(syslog.LOG_INFO, msg)
} | go | func (log *impl) Info(msg string) {
log.w.logAtLevel(syslog.LOG_INFO, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Info",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"w",
".",
"logAtLevel",
"(",
"syslog",
".",
"LOG_INFO",
",",
"msg",
")",
"\n",
"}"
] | // Info level messages pass through normally. | [
"Info",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L225-L227 | train |
letsencrypt/boulder | log/log.go | Infof | func (log *impl) Infof(format string, a ...interface{}) {
log.Info(fmt.Sprintf(format, a...))
} | go | func (log *impl) Infof(format string, a ...interface{}) {
log.Info(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Infof",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // Infof level messages pass through normally. | [
"Infof",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L230-L232 | train |
letsencrypt/boulder | log/log.go | Debug | func (log *impl) Debug(msg string) {
log.w.logAtLevel(syslog.LOG_DEBUG, msg)
} | go | func (log *impl) Debug(msg string) {
log.w.logAtLevel(syslog.LOG_DEBUG, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Debug",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"w",
".",
"logAtLevel",
"(",
"syslog",
".",
"LOG_DEBUG",
",",
"msg",
")",
"\n",
"}"
] | // Debug level messages pass through normally. | [
"Debug",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L235-L237 | train |
letsencrypt/boulder | log/log.go | Debugf | func (log *impl) Debugf(format string, a ...interface{}) {
log.Debug(fmt.Sprintf(format, a...))
} | go | func (log *impl) Debugf(format string, a ...interface{}) {
log.Debug(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"Debugf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // Debugf level messages pass through normally. | [
"Debugf",
"level",
"messages",
"pass",
"through",
"normally",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L240-L242 | train |
letsencrypt/boulder | log/log.go | AuditInfo | func (log *impl) AuditInfo(msg string) {
log.auditAtLevel(syslog.LOG_INFO, msg)
} | go | func (log *impl) AuditInfo(msg string) {
log.auditAtLevel(syslog.LOG_INFO, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditInfo",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"auditAtLevel",
"(",
"syslog",
".",
"LOG_INFO",
",",
"msg",
")",
"\n",
"}"
] | // AuditInfo sends an INFO-severity message that is prefixed with the
// audit tag, for special handling at the upstream system logger. | [
"AuditInfo",
"sends",
"an",
"INFO",
"-",
"severity",
"message",
"that",
"is",
"prefixed",
"with",
"the",
"audit",
"tag",
"for",
"special",
"handling",
"at",
"the",
"upstream",
"system",
"logger",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L246-L248 | train |
letsencrypt/boulder | log/log.go | AuditInfof | func (log *impl) AuditInfof(format string, a ...interface{}) {
log.AuditInfo(fmt.Sprintf(format, a...))
} | go | func (log *impl) AuditInfof(format string, a ...interface{}) {
log.AuditInfo(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditInfof",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"AuditInfo",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // AuditInfof sends an INFO-severity message that is prefixed with the
// audit tag, for special handling at the upstream system logger. | [
"AuditInfof",
"sends",
"an",
"INFO",
"-",
"severity",
"message",
"that",
"is",
"prefixed",
"with",
"the",
"audit",
"tag",
"for",
"special",
"handling",
"at",
"the",
"upstream",
"system",
"logger",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L252-L254 | train |
letsencrypt/boulder | log/log.go | AuditObject | func (log *impl) AuditObject(msg string, obj interface{}) {
jsonObj, err := json.Marshal(obj)
if err != nil {
log.auditAtLevel(syslog.LOG_ERR, fmt.Sprintf("Object could not be serialized to JSON. Raw: %+v", obj))
return
}
log.auditAtLevel(syslog.LOG_INFO, fmt.Sprintf("%s JSON=%s", msg, jsonObj))
} | go | func (log *impl) AuditObject(msg string, obj interface{}) {
jsonObj, err := json.Marshal(obj)
if err != nil {
log.auditAtLevel(syslog.LOG_ERR, fmt.Sprintf("Object could not be serialized to JSON. Raw: %+v", obj))
return
}
log.auditAtLevel(syslog.LOG_INFO, fmt.Sprintf("%s JSON=%s", msg, jsonObj))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditObject",
"(",
"msg",
"string",
",",
"obj",
"interface",
"{",
"}",
")",
"{",
"jsonObj",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"auditA... | // AuditObject sends an INFO-severity JSON-serialized object message that is prefixed
// with the audit tag, for special handling at the upstream system logger. | [
"AuditObject",
"sends",
"an",
"INFO",
"-",
"severity",
"JSON",
"-",
"serialized",
"object",
"message",
"that",
"is",
"prefixed",
"with",
"the",
"audit",
"tag",
"for",
"special",
"handling",
"at",
"the",
"upstream",
"system",
"logger",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L258-L266 | train |
letsencrypt/boulder | log/log.go | AuditErr | func (log *impl) AuditErr(msg string) {
log.auditAtLevel(syslog.LOG_ERR, msg)
} | go | func (log *impl) AuditErr(msg string) {
log.auditAtLevel(syslog.LOG_ERR, msg)
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditErr",
"(",
"msg",
"string",
")",
"{",
"log",
".",
"auditAtLevel",
"(",
"syslog",
".",
"LOG_ERR",
",",
"msg",
")",
"\n",
"}"
] | // AuditErr can format an error for auditing; it does so at ERR level. | [
"AuditErr",
"can",
"format",
"an",
"error",
"for",
"auditing",
";",
"it",
"does",
"so",
"at",
"ERR",
"level",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L269-L271 | train |
letsencrypt/boulder | log/log.go | AuditErrf | func (log *impl) AuditErrf(format string, a ...interface{}) {
log.AuditErr(fmt.Sprintf(format, a...))
} | go | func (log *impl) AuditErrf(format string, a ...interface{}) {
log.AuditErr(fmt.Sprintf(format, a...))
} | [
"func",
"(",
"log",
"*",
"impl",
")",
"AuditErrf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"log",
".",
"AuditErr",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"a",
"...",
")",
")",
"\n",
"}"
] | // AuditErrf can format an error for auditing; it does so at ERR level. | [
"AuditErrf",
"can",
"format",
"an",
"error",
"for",
"auditing",
";",
"it",
"does",
"so",
"at",
"ERR",
"level",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/log.go#L274-L276 | train |
letsencrypt/boulder | va/caa.go | checkCAA | func (va *ValidationAuthorityImpl) checkCAA(
ctx context.Context,
identifier core.AcmeIdentifier,
params *caaParams) *probs.ProblemDetails {
present, valid, records, err := va.checkCAARecords(ctx, identifier, params)
if err != nil {
return probs.DNS("%v", err)
}
recordsStr, err := json.Marshal(&records)
if e... | go | func (va *ValidationAuthorityImpl) checkCAA(
ctx context.Context,
identifier core.AcmeIdentifier,
params *caaParams) *probs.ProblemDetails {
present, valid, records, err := va.checkCAARecords(ctx, identifier, params)
if err != nil {
return probs.DNS("%v", err)
}
recordsStr, err := json.Marshal(&records)
if e... | [
"func",
"(",
"va",
"*",
"ValidationAuthorityImpl",
")",
"checkCAA",
"(",
"ctx",
"context",
".",
"Context",
",",
"identifier",
"core",
".",
"AcmeIdentifier",
",",
"params",
"*",
"caaParams",
")",
"*",
"probs",
".",
"ProblemDetails",
"{",
"present",
",",
"vali... | // checkCAA performs a CAA lookup & validation for the provided identifier. If
// the CAA lookup & validation fail a problem is returned. | [
"checkCAA",
"performs",
"a",
"CAA",
"lookup",
"&",
"validation",
"for",
"the",
"provided",
"identifier",
".",
"If",
"the",
"CAA",
"lookup",
"&",
"validation",
"fail",
"a",
"problem",
"is",
"returned",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/caa.go#L47-L75 | train |
letsencrypt/boulder | va/caa.go | criticalUnknown | func (caaSet CAASet) criticalUnknown() bool {
if len(caaSet.Unknown) > 0 {
for _, caaRecord := range caaSet.Unknown {
// The critical flag is the bit with significance 128. However, many CAA
// record users have misinterpreted the RFC and concluded that the bit
// with significance 1 is the critical bit. Th... | go | func (caaSet CAASet) criticalUnknown() bool {
if len(caaSet.Unknown) > 0 {
for _, caaRecord := range caaSet.Unknown {
// The critical flag is the bit with significance 128. However, many CAA
// record users have misinterpreted the RFC and concluded that the bit
// with significance 1 is the critical bit. Th... | [
"func",
"(",
"caaSet",
"CAASet",
")",
"criticalUnknown",
"(",
")",
"bool",
"{",
"if",
"len",
"(",
"caaSet",
".",
"Unknown",
")",
">",
"0",
"{",
"for",
"_",
",",
"caaRecord",
":=",
"range",
"caaSet",
".",
"Unknown",
"{",
"// The critical flag is the bit wit... | // returns true if any CAA records have unknown tag properties and are flagged critical. | [
"returns",
"true",
"if",
"any",
"CAA",
"records",
"have",
"unknown",
"tag",
"properties",
"and",
"are",
"flagged",
"critical",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/caa.go#L86-L102 | train |
letsencrypt/boulder | va/caa.go | newCAASet | func newCAASet(CAAs []*dns.CAA) *CAASet {
var filtered CAASet
for _, caaRecord := range CAAs {
switch strings.ToLower(caaRecord.Tag) {
case "issue":
filtered.Issue = append(filtered.Issue, caaRecord)
case "issuewild":
filtered.Issuewild = append(filtered.Issuewild, caaRecord)
case "iodef":
filtered.... | go | func newCAASet(CAAs []*dns.CAA) *CAASet {
var filtered CAASet
for _, caaRecord := range CAAs {
switch strings.ToLower(caaRecord.Tag) {
case "issue":
filtered.Issue = append(filtered.Issue, caaRecord)
case "issuewild":
filtered.Issuewild = append(filtered.Issuewild, caaRecord)
case "iodef":
filtered.... | [
"func",
"newCAASet",
"(",
"CAAs",
"[",
"]",
"*",
"dns",
".",
"CAA",
")",
"*",
"CAASet",
"{",
"var",
"filtered",
"CAASet",
"\n\n",
"for",
"_",
",",
"caaRecord",
":=",
"range",
"CAAs",
"{",
"switch",
"strings",
".",
"ToLower",
"(",
"caaRecord",
".",
"T... | // Filter CAA records by property | [
"Filter",
"CAA",
"records",
"by",
"property"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/caa.go#L105-L122 | train |
letsencrypt/boulder | va/caa.go | checkAccountURI | func checkAccountURI(accountURI string, accountURIPrefixes []string, accountID int64) bool {
for _, prefix := range accountURIPrefixes {
if accountURI == fmt.Sprintf("%s%d", prefix, accountID) {
return true
}
}
return false
} | go | func checkAccountURI(accountURI string, accountURIPrefixes []string, accountID int64) bool {
for _, prefix := range accountURIPrefixes {
if accountURI == fmt.Sprintf("%s%d", prefix, accountID) {
return true
}
}
return false
} | [
"func",
"checkAccountURI",
"(",
"accountURI",
"string",
",",
"accountURIPrefixes",
"[",
"]",
"string",
",",
"accountID",
"int64",
")",
"bool",
"{",
"for",
"_",
",",
"prefix",
":=",
"range",
"accountURIPrefixes",
"{",
"if",
"accountURI",
"==",
"fmt",
".",
"Sp... | // checkAccountURI checks the specified full account URI against the
// given accountID and a list of valid prefixes. | [
"checkAccountURI",
"checks",
"the",
"specified",
"full",
"account",
"URI",
"against",
"the",
"given",
"accountID",
"and",
"a",
"list",
"of",
"valid",
"prefixes",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/va/caa.go#L311-L318 | train |
letsencrypt/boulder | core/util.go | RandomString | func RandomString(byteLength int) string {
b := make([]byte, byteLength)
_, err := io.ReadFull(RandReader, b)
if err != nil {
panic(fmt.Sprintf("Error reading random bytes: %s", err))
}
return base64.RawURLEncoding.EncodeToString(b)
} | go | func RandomString(byteLength int) string {
b := make([]byte, byteLength)
_, err := io.ReadFull(RandReader, b)
if err != nil {
panic(fmt.Sprintf("Error reading random bytes: %s", err))
}
return base64.RawURLEncoding.EncodeToString(b)
} | [
"func",
"RandomString",
"(",
"byteLength",
"int",
")",
"string",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"byteLength",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"RandReader",
",",
"b",
")",
"\n",
"if",
"err",
"!=",
... | // RandomString returns a randomly generated string of the requested length. | [
"RandomString",
"returns",
"a",
"randomly",
"generated",
"string",
"of",
"the",
"requested",
"length",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L58-L65 | train |
letsencrypt/boulder | core/util.go | Fingerprint256 | func Fingerprint256(data []byte) string {
d := sha256.New()
_, _ = d.Write(data) // Never returns an error
return base64.RawURLEncoding.EncodeToString(d.Sum(nil))
} | go | func Fingerprint256(data []byte) string {
d := sha256.New()
_, _ = d.Write(data) // Never returns an error
return base64.RawURLEncoding.EncodeToString(d.Sum(nil))
} | [
"func",
"Fingerprint256",
"(",
"data",
"[",
"]",
"byte",
")",
"string",
"{",
"d",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"_",
",",
"_",
"=",
"d",
".",
"Write",
"(",
"data",
")",
"// Never returns an error",
"\n",
"return",
"base64",
".",
"RawURL... | // Fingerprints
// Fingerprint256 produces an unpadded, URL-safe Base64-encoded SHA256 digest
// of the data. | [
"Fingerprints",
"Fingerprint256",
"produces",
"an",
"unpadded",
"URL",
"-",
"safe",
"Base64",
"-",
"encoded",
"SHA256",
"digest",
"of",
"the",
"data",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L84-L88 | train |
letsencrypt/boulder | core/util.go | KeyDigest | func KeyDigest(key crypto.PublicKey) (string, error) {
switch t := key.(type) {
case *jose.JSONWebKey:
if t == nil {
return "", fmt.Errorf("Cannot compute digest of nil key")
}
return KeyDigest(t.Key)
case jose.JSONWebKey:
return KeyDigest(t.Key)
default:
keyDER, err := x509.MarshalPKIXPublicKey(key)
... | go | func KeyDigest(key crypto.PublicKey) (string, error) {
switch t := key.(type) {
case *jose.JSONWebKey:
if t == nil {
return "", fmt.Errorf("Cannot compute digest of nil key")
}
return KeyDigest(t.Key)
case jose.JSONWebKey:
return KeyDigest(t.Key)
default:
keyDER, err := x509.MarshalPKIXPublicKey(key)
... | [
"func",
"KeyDigest",
"(",
"key",
"crypto",
".",
"PublicKey",
")",
"(",
"string",
",",
"error",
")",
"{",
"switch",
"t",
":=",
"key",
".",
"(",
"type",
")",
"{",
"case",
"*",
"jose",
".",
"JSONWebKey",
":",
"if",
"t",
"==",
"nil",
"{",
"return",
"... | // KeyDigest produces a padded, standard Base64-encoded SHA256 digest of a
// provided public key. | [
"KeyDigest",
"produces",
"a",
"padded",
"standard",
"Base64",
"-",
"encoded",
"SHA256",
"digest",
"of",
"a",
"provided",
"public",
"key",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L92-L111 | train |
letsencrypt/boulder | core/util.go | KeyDigestEquals | func KeyDigestEquals(j, k crypto.PublicKey) bool {
digestJ, errJ := KeyDigest(j)
digestK, errK := KeyDigest(k)
// Keys that don't have a valid digest (due to marshalling problems)
// are never equal. So, e.g. nil keys are not equal.
if errJ != nil || errK != nil {
return false
}
return digestJ == digestK
} | go | func KeyDigestEquals(j, k crypto.PublicKey) bool {
digestJ, errJ := KeyDigest(j)
digestK, errK := KeyDigest(k)
// Keys that don't have a valid digest (due to marshalling problems)
// are never equal. So, e.g. nil keys are not equal.
if errJ != nil || errK != nil {
return false
}
return digestJ == digestK
} | [
"func",
"KeyDigestEquals",
"(",
"j",
",",
"k",
"crypto",
".",
"PublicKey",
")",
"bool",
"{",
"digestJ",
",",
"errJ",
":=",
"KeyDigest",
"(",
"j",
")",
"\n",
"digestK",
",",
"errK",
":=",
"KeyDigest",
"(",
"k",
")",
"\n",
"// Keys that don't have a valid di... | // KeyDigestEquals determines whether two public keys have the same digest. | [
"KeyDigestEquals",
"determines",
"whether",
"two",
"public",
"keys",
"have",
"the",
"same",
"digest",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L114-L123 | train |
letsencrypt/boulder | core/util.go | PublicKeysEqual | func PublicKeysEqual(a, b interface{}) (bool, error) {
if a == nil || b == nil {
return false, errors.New("One or more nil arguments to PublicKeysEqual")
}
aBytes, err := x509.MarshalPKIXPublicKey(a)
if err != nil {
return false, err
}
bBytes, err := x509.MarshalPKIXPublicKey(b)
if err != nil {
return fals... | go | func PublicKeysEqual(a, b interface{}) (bool, error) {
if a == nil || b == nil {
return false, errors.New("One or more nil arguments to PublicKeysEqual")
}
aBytes, err := x509.MarshalPKIXPublicKey(a)
if err != nil {
return false, err
}
bBytes, err := x509.MarshalPKIXPublicKey(b)
if err != nil {
return fals... | [
"func",
"PublicKeysEqual",
"(",
"a",
",",
"b",
"interface",
"{",
"}",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"a",
"==",
"nil",
"||",
"b",
"==",
"nil",
"{",
"return",
"false",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
... | // PublicKeysEqual determines whether two public keys have the same marshalled
// bytes as one another | [
"PublicKeysEqual",
"determines",
"whether",
"two",
"public",
"keys",
"have",
"the",
"same",
"marshalled",
"bytes",
"as",
"one",
"another"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L127-L140 | train |
letsencrypt/boulder | core/util.go | ValidSerial | func ValidSerial(serial string) bool {
// Originally, serial numbers were 32 hex characters long. We later increased
// them to 36, but we allow the shorter ones because they exist in some
// production databases.
if len(serial) != 32 && len(serial) != 36 {
return false
}
_, err := hex.DecodeString(serial)
if ... | go | func ValidSerial(serial string) bool {
// Originally, serial numbers were 32 hex characters long. We later increased
// them to 36, but we allow the shorter ones because they exist in some
// production databases.
if len(serial) != 32 && len(serial) != 36 {
return false
}
_, err := hex.DecodeString(serial)
if ... | [
"func",
"ValidSerial",
"(",
"serial",
"string",
")",
"bool",
"{",
"// Originally, serial numbers were 32 hex characters long. We later increased",
"// them to 36, but we allow the shorter ones because they exist in some",
"// production databases.",
"if",
"len",
"(",
"serial",
")",
"... | // ValidSerial tests whether the input string represents a syntactically
// valid serial number, i.e., that it is a valid hex string between 32
// and 36 characters long. | [
"ValidSerial",
"tests",
"whether",
"the",
"input",
"string",
"represents",
"a",
"syntactically",
"valid",
"serial",
"number",
"i",
".",
"e",
".",
"that",
"it",
"is",
"a",
"valid",
"hex",
"string",
"between",
"32",
"and",
"36",
"characters",
"long",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L162-L174 | train |
letsencrypt/boulder | core/util.go | UniqueLowerNames | func UniqueLowerNames(names []string) (unique []string) {
nameMap := make(map[string]int, len(names))
for _, name := range names {
nameMap[strings.ToLower(name)] = 1
}
unique = make([]string, 0, len(nameMap))
for name := range nameMap {
unique = append(unique, name)
}
sort.Strings(unique)
return
} | go | func UniqueLowerNames(names []string) (unique []string) {
nameMap := make(map[string]int, len(names))
for _, name := range names {
nameMap[strings.ToLower(name)] = 1
}
unique = make([]string, 0, len(nameMap))
for name := range nameMap {
unique = append(unique, name)
}
sort.Strings(unique)
return
} | [
"func",
"UniqueLowerNames",
"(",
"names",
"[",
"]",
"string",
")",
"(",
"unique",
"[",
"]",
"string",
")",
"{",
"nameMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"len",
"(",
"names",
")",
")",
"\n",
"for",
"_",
",",
"name",
":=... | // UniqueLowerNames returns the set of all unique names in the input after all
// of them are lowercased. The returned names will be in their lowercased form
// and sorted alphabetically. | [
"UniqueLowerNames",
"returns",
"the",
"set",
"of",
"all",
"unique",
"names",
"in",
"the",
"input",
"after",
"all",
"of",
"them",
"are",
"lowercased",
".",
"The",
"returned",
"names",
"will",
"be",
"in",
"their",
"lowercased",
"form",
"and",
"sorted",
"alphab... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L206-L218 | train |
letsencrypt/boulder | core/util.go | LoadCertBundle | func LoadCertBundle(filename string) ([]*x509.Certificate, error) {
bundleBytes, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
var bundle []*x509.Certificate
var block *pem.Block
rest := bundleBytes
for {
block, rest = pem.Decode(rest)
if block == nil {
break
}
if block.Type != ... | go | func LoadCertBundle(filename string) ([]*x509.Certificate, error) {
bundleBytes, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
var bundle []*x509.Certificate
var block *pem.Block
rest := bundleBytes
for {
block, rest = pem.Decode(rest)
if block == nil {
break
}
if block.Type != ... | [
"func",
"LoadCertBundle",
"(",
"filename",
"string",
")",
"(",
"[",
"]",
"*",
"x509",
".",
"Certificate",
",",
"error",
")",
"{",
"bundleBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"... | // LoadCertBundle loads a PEM bundle of certificates from disk | [
"LoadCertBundle",
"loads",
"a",
"PEM",
"bundle",
"of",
"certificates",
"from",
"disk"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L221-L249 | train |
letsencrypt/boulder | core/util.go | LoadCert | func LoadCert(filename string) (cert *x509.Certificate, err error) {
certPEM, err := ioutil.ReadFile(filename)
if err != nil {
return
}
block, _ := pem.Decode(certPEM)
if block == nil {
return nil, fmt.Errorf("No data in cert PEM file %s", filename)
}
cert, err = x509.ParseCertificate(block.Bytes)
return
} | go | func LoadCert(filename string) (cert *x509.Certificate, err error) {
certPEM, err := ioutil.ReadFile(filename)
if err != nil {
return
}
block, _ := pem.Decode(certPEM)
if block == nil {
return nil, fmt.Errorf("No data in cert PEM file %s", filename)
}
cert, err = x509.ParseCertificate(block.Bytes)
return
} | [
"func",
"LoadCert",
"(",
"filename",
"string",
")",
"(",
"cert",
"*",
"x509",
".",
"Certificate",
",",
"err",
"error",
")",
"{",
"certPEM",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // LoadCert loads a PEM certificate specified by filename or returns an error | [
"LoadCert",
"loads",
"a",
"PEM",
"certificate",
"specified",
"by",
"filename",
"or",
"returns",
"an",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L252-L263 | train |
letsencrypt/boulder | core/util.go | IsASCII | func IsASCII(str string) bool {
for _, r := range str {
if r > unicode.MaxASCII {
return false
}
}
return true
} | go | func IsASCII(str string) bool {
for _, r := range str {
if r > unicode.MaxASCII {
return false
}
}
return true
} | [
"func",
"IsASCII",
"(",
"str",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"str",
"{",
"if",
"r",
">",
"unicode",
".",
"MaxASCII",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // IsASCII determines if every character in a string is encoded in
// the ASCII character set. | [
"IsASCII",
"determines",
"if",
"every",
"character",
"in",
"a",
"string",
"is",
"encoded",
"in",
"the",
"ASCII",
"character",
"set",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/core/util.go#L293-L300 | train |
letsencrypt/boulder | grpc/pb-marshalling.go | authzMetaToPB | func authzMetaToPB(authz core.Authorization) (*vapb.AuthzMeta, error) {
return &vapb.AuthzMeta{
Id: &authz.ID,
RegID: &authz.RegistrationID,
}, nil
} | go | func authzMetaToPB(authz core.Authorization) (*vapb.AuthzMeta, error) {
return &vapb.AuthzMeta{
Id: &authz.ID,
RegID: &authz.RegistrationID,
}, nil
} | [
"func",
"authzMetaToPB",
"(",
"authz",
"core",
".",
"Authorization",
")",
"(",
"*",
"vapb",
".",
"AuthzMeta",
",",
"error",
")",
"{",
"return",
"&",
"vapb",
".",
"AuthzMeta",
"{",
"Id",
":",
"&",
"authz",
".",
"ID",
",",
"RegID",
":",
"&",
"authz",
... | // This file defines functions to translate between the protobuf types and the
// code types. | [
"This",
"file",
"defines",
"functions",
"to",
"translate",
"between",
"the",
"protobuf",
"types",
"and",
"the",
"code",
"types",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/pb-marshalling.go#L26-L31 | train |
letsencrypt/boulder | grpc/pb-marshalling.go | orderValid | func orderValid(order *corepb.Order) bool {
return order.Id != nil && order.BeganProcessing != nil && order.Created != nil && newOrderValid(order)
} | go | func orderValid(order *corepb.Order) bool {
return order.Id != nil && order.BeganProcessing != nil && order.Created != nil && newOrderValid(order)
} | [
"func",
"orderValid",
"(",
"order",
"*",
"corepb",
".",
"Order",
")",
"bool",
"{",
"return",
"order",
".",
"Id",
"!=",
"nil",
"&&",
"order",
".",
"BeganProcessing",
"!=",
"nil",
"&&",
"order",
".",
"Created",
"!=",
"nil",
"&&",
"newOrderValid",
"(",
"o... | // orderValid checks that a corepb.Order is valid. In addition to the checks
// from `newOrderValid` it ensures the order ID, the BeganProcessing fields
// and the Created field are not nil. | [
"orderValid",
"checks",
"that",
"a",
"corepb",
".",
"Order",
"is",
"valid",
".",
"In",
"addition",
"to",
"the",
"checks",
"from",
"newOrderValid",
"it",
"ensures",
"the",
"order",
"ID",
"the",
"BeganProcessing",
"fields",
"and",
"the",
"Created",
"field",
"a... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/pb-marshalling.go#L410-L412 | train |
letsencrypt/boulder | grpc/pb-marshalling.go | newOrderValid | func newOrderValid(order *corepb.Order) bool {
return !(order.RegistrationID == nil || order.Expires == nil || order.Authorizations == nil || order.Names == nil)
} | go | func newOrderValid(order *corepb.Order) bool {
return !(order.RegistrationID == nil || order.Expires == nil || order.Authorizations == nil || order.Names == nil)
} | [
"func",
"newOrderValid",
"(",
"order",
"*",
"corepb",
".",
"Order",
")",
"bool",
"{",
"return",
"!",
"(",
"order",
".",
"RegistrationID",
"==",
"nil",
"||",
"order",
".",
"Expires",
"==",
"nil",
"||",
"order",
".",
"Authorizations",
"==",
"nil",
"||",
... | // newOrderValid checks that a corepb.Order is valid. It allows for a nil
// `order.Id` because the order has not been assigned an ID yet when it is being
// created initially. It allows `order.BeganProcessing` to be nil because
// `sa.NewOrder` explicitly sets it to the default value. It allows
// `order.Created` to b... | [
"newOrderValid",
"checks",
"that",
"a",
"corepb",
".",
"Order",
"is",
"valid",
".",
"It",
"allows",
"for",
"a",
"nil",
"order",
".",
"Id",
"because",
"the",
"order",
"has",
"not",
"been",
"assigned",
"an",
"ID",
"yet",
"when",
"it",
"is",
"being",
"cre... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/pb-marshalling.go#L421-L423 | train |
letsencrypt/boulder | policy/pa.go | New | func New(challengeTypes map[string]bool) (*AuthorityImpl, error) {
pa := AuthorityImpl{
log: blog.Get(),
enabledChallenges: challengeTypes,
// We don't need real randomness for this.
pseudoRNG: rand.New(rand.NewSource(99)),
}
return &pa, nil
} | go | func New(challengeTypes map[string]bool) (*AuthorityImpl, error) {
pa := AuthorityImpl{
log: blog.Get(),
enabledChallenges: challengeTypes,
// We don't need real randomness for this.
pseudoRNG: rand.New(rand.NewSource(99)),
}
return &pa, nil
} | [
"func",
"New",
"(",
"challengeTypes",
"map",
"[",
"string",
"]",
"bool",
")",
"(",
"*",
"AuthorityImpl",
",",
"error",
")",
"{",
"pa",
":=",
"AuthorityImpl",
"{",
"log",
":",
"blog",
".",
"Get",
"(",
")",
",",
"enabledChallenges",
":",
"challengeTypes",
... | // New constructs a Policy Authority. | [
"New",
"constructs",
"a",
"Policy",
"Authority",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L41-L51 | train |
letsencrypt/boulder | policy/pa.go | SetHostnamePolicyFile | func (pa *AuthorityImpl) SetHostnamePolicyFile(f string) error {
var loadHandler func([]byte) error
if strings.HasSuffix(f, ".json") {
loadHandler = pa.loadHostnamePolicy(json.Unmarshal)
} else if strings.HasSuffix(f, ".yml") || strings.HasSuffix(f, ".yaml") {
loadHandler = pa.loadHostnamePolicy(yaml.Unmarshal)
... | go | func (pa *AuthorityImpl) SetHostnamePolicyFile(f string) error {
var loadHandler func([]byte) error
if strings.HasSuffix(f, ".json") {
loadHandler = pa.loadHostnamePolicy(json.Unmarshal)
} else if strings.HasSuffix(f, ".yml") || strings.HasSuffix(f, ".yaml") {
loadHandler = pa.loadHostnamePolicy(yaml.Unmarshal)
... | [
"func",
"(",
"pa",
"*",
"AuthorityImpl",
")",
"SetHostnamePolicyFile",
"(",
"f",
"string",
")",
"error",
"{",
"var",
"loadHandler",
"func",
"(",
"[",
"]",
"byte",
")",
"error",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"f",
",",
"\"",
"\"",
")",
... | // SetHostnamePolicyFile will load the given policy file, returning error if it
// fails. It will also start a reloader in case the file changes. It supports
// YAML and JSON serialization formats and chooses the correct unserialization
// method based on the file extension which must be ".yaml", ".yml", or ".json". | [
"SetHostnamePolicyFile",
"will",
"load",
"the",
"given",
"policy",
"file",
"returning",
"error",
"if",
"it",
"fails",
".",
"It",
"will",
"also",
"start",
"a",
"reloader",
"in",
"case",
"the",
"file",
"changes",
".",
"It",
"supports",
"YAML",
"and",
"JSON",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L83-L98 | train |
letsencrypt/boulder | policy/pa.go | processHostnamePolicy | func (pa *AuthorityImpl) processHostnamePolicy(policy blockedNamesPolicy) error {
nameMap := make(map[string]bool)
for _, v := range policy.HighRiskBlockedNames {
nameMap[v] = true
}
for _, v := range policy.AdminBlockedNames {
nameMap[v] = true
}
exactNameMap := make(map[string]bool)
wildcardNameMap := make... | go | func (pa *AuthorityImpl) processHostnamePolicy(policy blockedNamesPolicy) error {
nameMap := make(map[string]bool)
for _, v := range policy.HighRiskBlockedNames {
nameMap[v] = true
}
for _, v := range policy.AdminBlockedNames {
nameMap[v] = true
}
exactNameMap := make(map[string]bool)
wildcardNameMap := make... | [
"func",
"(",
"pa",
"*",
"AuthorityImpl",
")",
"processHostnamePolicy",
"(",
"policy",
"blockedNamesPolicy",
")",
"error",
"{",
"nameMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"policy",
".",... | // processHostnamePolicy handles loading a new blockedNamesPolicy into the PA.
// All of the policy.ExactBlockedNames will be added to the
// wildcardExactBlocklist by processHostnamePolicy to ensure that wildcards for
// exact blocked names entries are forbidden. | [
"processHostnamePolicy",
"handles",
"loading",
"a",
"new",
"blockedNamesPolicy",
"into",
"the",
"PA",
".",
"All",
"of",
"the",
"policy",
".",
"ExactBlockedNames",
"will",
"be",
"added",
"to",
"the",
"wildcardExactBlocklist",
"by",
"processHostnamePolicy",
"to",
"ens... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L136-L172 | train |
letsencrypt/boulder | policy/pa.go | checkWildcardHostList | func (pa *AuthorityImpl) checkWildcardHostList(domain string) error {
pa.blocklistMu.RLock()
defer pa.blocklistMu.RUnlock()
if pa.blocklist == nil {
return fmt.Errorf("Hostname policy not yet loaded.")
}
if pa.wildcardExactBlocklist[domain] {
return errPolicyForbidden
}
return nil
} | go | func (pa *AuthorityImpl) checkWildcardHostList(domain string) error {
pa.blocklistMu.RLock()
defer pa.blocklistMu.RUnlock()
if pa.blocklist == nil {
return fmt.Errorf("Hostname policy not yet loaded.")
}
if pa.wildcardExactBlocklist[domain] {
return errPolicyForbidden
}
return nil
} | [
"func",
"(",
"pa",
"*",
"AuthorityImpl",
")",
"checkWildcardHostList",
"(",
"domain",
"string",
")",
"error",
"{",
"pa",
".",
"blocklistMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"pa",
".",
"blocklistMu",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"pa",
... | // checkWildcardHostList checks the wildcardExactBlocklist for a given domain.
// If the domain is not present on the list nil is returned, otherwise
// errPolicyForbidden is returned. | [
"checkWildcardHostList",
"checks",
"the",
"wildcardExactBlocklist",
"for",
"a",
"given",
"domain",
".",
"If",
"the",
"domain",
"is",
"not",
"present",
"on",
"the",
"list",
"nil",
"is",
"returned",
"otherwise",
"errPolicyForbidden",
"is",
"returned",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L403-L416 | train |
letsencrypt/boulder | policy/pa.go | ChallengesFor | func (pa *AuthorityImpl) ChallengesFor(identifier core.AcmeIdentifier) ([]core.Challenge, error) {
challenges := []core.Challenge{}
// If we are using the new authorization storage schema we only use a single
// token for all challenges rather than a unique token per challenge.
var token string
if features.Enable... | go | func (pa *AuthorityImpl) ChallengesFor(identifier core.AcmeIdentifier) ([]core.Challenge, error) {
challenges := []core.Challenge{}
// If we are using the new authorization storage schema we only use a single
// token for all challenges rather than a unique token per challenge.
var token string
if features.Enable... | [
"func",
"(",
"pa",
"*",
"AuthorityImpl",
")",
"ChallengesFor",
"(",
"identifier",
"core",
".",
"AcmeIdentifier",
")",
"(",
"[",
"]",
"core",
".",
"Challenge",
",",
"error",
")",
"{",
"challenges",
":=",
"[",
"]",
"core",
".",
"Challenge",
"{",
"}",
"\n... | // ChallengesFor makes a decision of what challenges are acceptable for
// the given identifier. | [
"ChallengesFor",
"makes",
"a",
"decision",
"of",
"what",
"challenges",
"are",
"acceptable",
"for",
"the",
"given",
"identifier",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L442-L490 | train |
letsencrypt/boulder | policy/pa.go | ChallengeTypeEnabled | func (pa *AuthorityImpl) ChallengeTypeEnabled(t string) bool {
pa.blocklistMu.RLock()
defer pa.blocklistMu.RUnlock()
return pa.enabledChallenges[t]
} | go | func (pa *AuthorityImpl) ChallengeTypeEnabled(t string) bool {
pa.blocklistMu.RLock()
defer pa.blocklistMu.RUnlock()
return pa.enabledChallenges[t]
} | [
"func",
"(",
"pa",
"*",
"AuthorityImpl",
")",
"ChallengeTypeEnabled",
"(",
"t",
"string",
")",
"bool",
"{",
"pa",
".",
"blocklistMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"pa",
".",
"blocklistMu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"pa",
".",
... | // ChallengeTypeEnabled returns whether the specified challenge type is enabled | [
"ChallengeTypeEnabled",
"returns",
"whether",
"the",
"specified",
"challenge",
"type",
"is",
"enabled"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/policy/pa.go#L493-L497 | train |
letsencrypt/boulder | nonce/nonce.go | NewNonceService | func NewNonceService(scope metrics.Scope) (*NonceService, error) {
scope = scope.NewScope("NonceService")
key := make([]byte, 16)
if _, err := rand.Read(key); err != nil {
return nil, err
}
c, err := aes.NewCipher(key)
if err != nil {
panic("Failure in NewCipher: " + err.Error())
}
gcm, err := cipher.NewGC... | go | func NewNonceService(scope metrics.Scope) (*NonceService, error) {
scope = scope.NewScope("NonceService")
key := make([]byte, 16)
if _, err := rand.Read(key); err != nil {
return nil, err
}
c, err := aes.NewCipher(key)
if err != nil {
panic("Failure in NewCipher: " + err.Error())
}
gcm, err := cipher.NewGC... | [
"func",
"NewNonceService",
"(",
"scope",
"metrics",
".",
"Scope",
")",
"(",
"*",
"NonceService",
",",
"error",
")",
"{",
"scope",
"=",
"scope",
".",
"NewScope",
"(",
"\"",
"\"",
")",
"\n",
"key",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"16",
")",... | // NewNonceService constructs a NonceService with defaults | [
"NewNonceService",
"constructs",
"a",
"NonceService",
"with",
"defaults"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/nonce/nonce.go#L68-L93 | train |
letsencrypt/boulder | nonce/nonce.go | Nonce | func (ns *NonceService) Nonce() (string, error) {
ns.mu.Lock()
ns.latest++
latest := ns.latest
ns.mu.Unlock()
defer ns.stats.Inc("Generated", 1)
return ns.encrypt(latest)
} | go | func (ns *NonceService) Nonce() (string, error) {
ns.mu.Lock()
ns.latest++
latest := ns.latest
ns.mu.Unlock()
defer ns.stats.Inc("Generated", 1)
return ns.encrypt(latest)
} | [
"func",
"(",
"ns",
"*",
"NonceService",
")",
"Nonce",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"ns",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"ns",
".",
"latest",
"++",
"\n",
"latest",
":=",
"ns",
".",
"latest",
"\n",
"ns",
".",
"mu",
... | // Nonce provides a new Nonce. | [
"Nonce",
"provides",
"a",
"new",
"Nonce",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/nonce/nonce.go#L145-L152 | train |
letsencrypt/boulder | nonce/nonce.go | Valid | func (ns *NonceService) Valid(nonce string) bool {
c, err := ns.decrypt(nonce)
if err != nil {
ns.stats.Inc("Invalid.Decrypt", 1)
return false
}
ns.mu.Lock()
defer ns.mu.Unlock()
if c > ns.latest {
ns.stats.Inc("Invalid.TooHigh", 1)
return false
}
if c <= ns.earliest {
ns.stats.Inc("Invalid.TooLow",... | go | func (ns *NonceService) Valid(nonce string) bool {
c, err := ns.decrypt(nonce)
if err != nil {
ns.stats.Inc("Invalid.Decrypt", 1)
return false
}
ns.mu.Lock()
defer ns.mu.Unlock()
if c > ns.latest {
ns.stats.Inc("Invalid.TooHigh", 1)
return false
}
if c <= ns.earliest {
ns.stats.Inc("Invalid.TooLow",... | [
"func",
"(",
"ns",
"*",
"NonceService",
")",
"Valid",
"(",
"nonce",
"string",
")",
"bool",
"{",
"c",
",",
"err",
":=",
"ns",
".",
"decrypt",
"(",
"nonce",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ns",
".",
"stats",
".",
"Inc",
"(",
"\"",
"\""... | // Valid determines whether the provided Nonce string is valid, returning
// true if so. | [
"Valid",
"determines",
"whether",
"the",
"provided",
"Nonce",
"string",
"is",
"valid",
"returning",
"true",
"if",
"so",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/nonce/nonce.go#L156-L191 | train |
letsencrypt/boulder | ctpolicy/ctpolicy.go | New | func New(pub core.Publisher,
groups []cmd.CTGroup,
informational []cmd.LogDescription,
log blog.Logger,
stats metrics.Scope,
) *CTPolicy {
var finalLogs []cmd.LogDescription
for _, group := range groups {
for _, log := range group.Logs {
if log.SubmitFinalCert {
finalLogs = append(finalLogs, log)
}
... | go | func New(pub core.Publisher,
groups []cmd.CTGroup,
informational []cmd.LogDescription,
log blog.Logger,
stats metrics.Scope,
) *CTPolicy {
var finalLogs []cmd.LogDescription
for _, group := range groups {
for _, log := range group.Logs {
if log.SubmitFinalCert {
finalLogs = append(finalLogs, log)
}
... | [
"func",
"New",
"(",
"pub",
"core",
".",
"Publisher",
",",
"groups",
"[",
"]",
"cmd",
".",
"CTGroup",
",",
"informational",
"[",
"]",
"cmd",
".",
"LogDescription",
",",
"log",
"blog",
".",
"Logger",
",",
"stats",
"metrics",
".",
"Scope",
",",
")",
"*"... | // New creates a new CTPolicy struct | [
"New",
"creates",
"a",
"new",
"CTPolicy",
"struct"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ctpolicy/ctpolicy.go#L32-L69 | train |
letsencrypt/boulder | ctpolicy/ctpolicy.go | GetSCTs | func (ctp *CTPolicy) GetSCTs(ctx context.Context, cert core.CertDER, expiration time.Time) (core.SCTDERs, error) {
results := make(chan result, len(ctp.groups))
subCtx, cancel := context.WithCancel(ctx)
defer cancel()
for i, g := range ctp.groups {
go func(i int, g cmd.CTGroup) {
sct, err := ctp.race(subCtx, c... | go | func (ctp *CTPolicy) GetSCTs(ctx context.Context, cert core.CertDER, expiration time.Time) (core.SCTDERs, error) {
results := make(chan result, len(ctp.groups))
subCtx, cancel := context.WithCancel(ctx)
defer cancel()
for i, g := range ctp.groups {
go func(i int, g cmd.CTGroup) {
sct, err := ctp.race(subCtx, c... | [
"func",
"(",
"ctp",
"*",
"CTPolicy",
")",
"GetSCTs",
"(",
"ctx",
"context",
".",
"Context",
",",
"cert",
"core",
".",
"CertDER",
",",
"expiration",
"time",
".",
"Time",
")",
"(",
"core",
".",
"SCTDERs",
",",
"error",
")",
"{",
"results",
":=",
"make"... | // GetSCTs attempts to retrieve a SCT from each configured grouping of logs and returns
// the set of SCTs to the caller. | [
"GetSCTs",
"attempts",
"to",
"retrieve",
"a",
"SCT",
"from",
"each",
"configured",
"grouping",
"of",
"logs",
"and",
"returns",
"the",
"set",
"of",
"SCTs",
"to",
"the",
"caller",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ctpolicy/ctpolicy.go#L143-L193 | train |
letsencrypt/boulder | ctpolicy/ctpolicy.go | SubmitFinalCert | func (ctp *CTPolicy) SubmitFinalCert(cert []byte, expiration time.Time) {
falseVar := false
for _, log := range ctp.finalLogs {
go func(l cmd.LogDescription) {
uri, key, err := l.Info(expiration)
if err != nil {
ctp.log.Errf("unable to get log info: %s", err)
return
}
_, err = ctp.pub.SubmitToSi... | go | func (ctp *CTPolicy) SubmitFinalCert(cert []byte, expiration time.Time) {
falseVar := false
for _, log := range ctp.finalLogs {
go func(l cmd.LogDescription) {
uri, key, err := l.Info(expiration)
if err != nil {
ctp.log.Errf("unable to get log info: %s", err)
return
}
_, err = ctp.pub.SubmitToSi... | [
"func",
"(",
"ctp",
"*",
"CTPolicy",
")",
"SubmitFinalCert",
"(",
"cert",
"[",
"]",
"byte",
",",
"expiration",
"time",
".",
"Time",
")",
"{",
"falseVar",
":=",
"false",
"\n",
"for",
"_",
",",
"log",
":=",
"range",
"ctp",
".",
"finalLogs",
"{",
"go",
... | // SubmitFinalCert submits finalized certificates created from precertificates
// to any configured logs | [
"SubmitFinalCert",
"submits",
"finalized",
"certificates",
"created",
"from",
"precertificates",
"to",
"any",
"configured",
"logs"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ctpolicy/ctpolicy.go#L197-L218 | train |
letsencrypt/boulder | web/context.go | WriteHeader | func (r *responseWriterWithStatus) WriteHeader(code int) {
r.code = code
r.ResponseWriter.WriteHeader(code)
} | go | func (r *responseWriterWithStatus) WriteHeader(code int) {
r.code = code
r.ResponseWriter.WriteHeader(code)
} | [
"func",
"(",
"r",
"*",
"responseWriterWithStatus",
")",
"WriteHeader",
"(",
"code",
"int",
")",
"{",
"r",
".",
"code",
"=",
"code",
"\n",
"r",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"code",
")",
"\n",
"}"
] | // WriteHeader stores a status code for generating stats. | [
"WriteHeader",
"stores",
"a",
"status",
"code",
"for",
"generating",
"stats",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/web/context.go#L83-L86 | train |
letsencrypt/boulder | grpc/va-wrappers.go | PerformValidation | func (vac ValidationAuthorityGRPCClient) PerformValidation(ctx context.Context, domain string, challenge core.Challenge, authz core.Authorization) ([]core.ValidationRecord, error) {
req, err := argsToPerformValidationRequest(domain, challenge, authz)
if err != nil {
return nil, err
}
gRecords, err := vac.gc.Perfo... | go | func (vac ValidationAuthorityGRPCClient) PerformValidation(ctx context.Context, domain string, challenge core.Challenge, authz core.Authorization) ([]core.ValidationRecord, error) {
req, err := argsToPerformValidationRequest(domain, challenge, authz)
if err != nil {
return nil, err
}
gRecords, err := vac.gc.Perfo... | [
"func",
"(",
"vac",
"ValidationAuthorityGRPCClient",
")",
"PerformValidation",
"(",
"ctx",
"context",
".",
"Context",
",",
"domain",
"string",
",",
"challenge",
"core",
".",
"Challenge",
",",
"authz",
"core",
".",
"Authorization",
")",
"(",
"[",
"]",
"core",
... | // PerformValidation has the VA revalidate the specified challenge and returns
// the updated Challenge object. | [
"PerformValidation",
"has",
"the",
"VA",
"revalidate",
"the",
"specified",
"challenge",
"and",
"returns",
"the",
"updated",
"Challenge",
"object",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/va-wrappers.go#L57-L77 | train |
letsencrypt/boulder | wfe2/wfe.go | requestProto | func requestProto(request *http.Request) string {
proto := "http"
// 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 this value
// to override our own guess.
if specifiedProto :=... | go | func requestProto(request *http.Request) string {
proto := "http"
// 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 this value
// to override our own guess.
if specifiedProto :=... | [
"func",
"requestProto",
"(",
"request",
"*",
"http",
".",
"Request",
")",
"string",
"{",
"proto",
":=",
"\"",
"\"",
"\n\n",
"// If the request was received via TLS, use `https://` for the protocol",
"if",
"request",
".",
"TLS",
"!=",
"nil",
"{",
"proto",
"=",
"\""... | // requestProto returns "http" for HTTP requests and "https" for HTTPS
// requests. It supports the use of "X-Forwarded-Proto" to override the protocol. | [
"requestProto",
"returns",
"http",
"for",
"HTTP",
"requests",
"and",
"https",
"for",
"HTTPS",
"requests",
".",
"It",
"supports",
"the",
"use",
"of",
"X",
"-",
"Forwarded",
"-",
"Proto",
"to",
"override",
"the",
"protocol",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L251-L266 | train |
letsencrypt/boulder | wfe2/wfe.go | Nonce | func (wfe *WebFrontEndImpl) Nonce(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
statusCode := http.StatusNoContent
// The ACME specification says GET requets should receive http.StatusNoContent
// and HEAD requests should receive http.StatusOK. We gate t... | go | func (wfe *WebFrontEndImpl) Nonce(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
statusCode := http.StatusNoContent
// The ACME specification says GET requets should receive http.StatusNoContent
// and HEAD requests should receive http.StatusOK. We gate t... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"Nonce",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"sta... | // Nonce is an endpoint for getting a fresh nonce with an HTTP GET or HEAD
// request. This endpoint only returns a status code header - the `HandleFunc`
// wrapper ensures that a nonce is written in the correct response header. | [
"Nonce",
"is",
"an",
"endpoint",
"for",
"getting",
"a",
"fresh",
"nonce",
"with",
"an",
"HTTP",
"GET",
"or",
"HEAD",
"request",
".",
"This",
"endpoint",
"only",
"returns",
"a",
"status",
"code",
"header",
"-",
"the",
"HandleFunc",
"wrapper",
"ensures",
"th... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L436-L450 | train |
letsencrypt/boulder | wfe2/wfe.go | processRevocation | func (wfe *WebFrontEndImpl) processRevocation(
ctx context.Context,
jwsBody []byte,
acctID int64,
authorizedToRevoke authorizedToRevokeCert,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// Read the revoke request from the JWS payload
var revokeRequest struct {
CertificateDER core... | go | func (wfe *WebFrontEndImpl) processRevocation(
ctx context.Context,
jwsBody []byte,
acctID int64,
authorizedToRevoke authorizedToRevokeCert,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// Read the revoke request from the JWS payload
var revokeRequest struct {
CertificateDER core... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"processRevocation",
"(",
"ctx",
"context",
".",
"Context",
",",
"jwsBody",
"[",
"]",
"byte",
",",
"acctID",
"int64",
",",
"authorizedToRevoke",
"authorizedToRevokeCert",
",",
"request",
"*",
"http",
".",
"Reque... | // processRevocation accepts the payload for a revocation request along with
// an account ID and a callback used to decide if the requester is authorized to
// revoke a given certificate. If the request can not be authenticated or the
// requester is not authorized to revoke the certificate requested a problem is
// ... | [
"processRevocation",
"accepts",
"the",
"payload",
"for",
"a",
"revocation",
"request",
"along",
"with",
"an",
"account",
"ID",
"and",
"a",
"callback",
"used",
"to",
"decide",
"if",
"the",
"requester",
"is",
"authorized",
"to",
"revoke",
"a",
"given",
"certific... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L629-L711 | train |
letsencrypt/boulder | wfe2/wfe.go | revokeCertByKeyID | func (wfe *WebFrontEndImpl) revokeCertByKeyID(
ctx context.Context,
outerJWS *jose.JSONWebSignature,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// For Key ID revocations we authenticate the outer JWS by using
// `validJWSForAccount` similar to other WFE endpoints
jwsBody, _, acct,... | go | func (wfe *WebFrontEndImpl) revokeCertByKeyID(
ctx context.Context,
outerJWS *jose.JSONWebSignature,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// For Key ID revocations we authenticate the outer JWS by using
// `validJWSForAccount` similar to other WFE endpoints
jwsBody, _, acct,... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"revokeCertByKeyID",
"(",
"ctx",
"context",
".",
"Context",
",",
"outerJWS",
"*",
"jose",
".",
"JSONWebSignature",
",",
"request",
"*",
"http",
".",
"Request",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",... | // revokeCertByKeyID processes an outer JWS as a revocation request that is
// authenticated by a KeyID and the associated account. | [
"revokeCertByKeyID",
"processes",
"an",
"outer",
"JWS",
"as",
"a",
"revocation",
"request",
"that",
"is",
"authenticated",
"by",
"a",
"KeyID",
"and",
"the",
"associated",
"account",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L715-L748 | train |
letsencrypt/boulder | wfe2/wfe.go | revokeCertByJWK | func (wfe *WebFrontEndImpl) revokeCertByJWK(
ctx context.Context,
outerJWS *jose.JSONWebSignature,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// We maintain the requestKey as a var that is closed-over by the
// `authorizedToRevoke` function to use
var requestKey *jose.JSONWebKey
... | go | func (wfe *WebFrontEndImpl) revokeCertByJWK(
ctx context.Context,
outerJWS *jose.JSONWebSignature,
request *http.Request,
logEvent *web.RequestEvent) *probs.ProblemDetails {
// We maintain the requestKey as a var that is closed-over by the
// `authorizedToRevoke` function to use
var requestKey *jose.JSONWebKey
... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"revokeCertByJWK",
"(",
"ctx",
"context",
".",
"Context",
",",
"outerJWS",
"*",
"jose",
".",
"JSONWebSignature",
",",
"request",
"*",
"http",
".",
"Request",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
... | // revokeCertByJWK processes an outer JWS as a revocation request that is
// authenticated by an embedded JWK. E.g. in the case where someone is
// requesting a revocation by using the keypair associated with the certificate
// to be revoked | [
"revokeCertByJWK",
"processes",
"an",
"outer",
"JWS",
"as",
"a",
"revocation",
"request",
"that",
"is",
"authenticated",
"by",
"an",
"embedded",
"JWK",
".",
"E",
".",
"g",
".",
"in",
"the",
"case",
"where",
"someone",
"is",
"requesting",
"a",
"revocation",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L754-L784 | train |
letsencrypt/boulder | wfe2/wfe.go | RevokeCertificate | func (wfe *WebFrontEndImpl) RevokeCertificate(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
// The ACME specification handles the verification of revocation requests
// differently from other endpoints. For this reason we do *not* immediately
// call `w... | go | func (wfe *WebFrontEndImpl) RevokeCertificate(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
// The ACME specification handles the verification of revocation requests
// differently from other endpoints. For this reason we do *not* immediately
// call `w... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"RevokeCertificate",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
... | // RevokeCertificate is used by clients to request the revocation of a cert. The
// revocation request is handled uniquely based on the method of authentication
// used. | [
"RevokeCertificate",
"is",
"used",
"by",
"clients",
"to",
"request",
"the",
"revocation",
"of",
"a",
"cert",
".",
"The",
"revocation",
"request",
"is",
"handled",
"uniquely",
"based",
"on",
"the",
"method",
"of",
"authentication",
"used",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L789-L831 | train |
letsencrypt/boulder | wfe2/wfe.go | prepChallengeForDisplay | func (wfe *WebFrontEndImpl) prepChallengeForDisplay(request *http.Request, authz core.Authorization, challenge *core.Challenge) {
// Update the challenge URL to be relative to the HTTP request Host
if authz.V2 {
challenge.URL = web.RelativeEndpoint(request, fmt.Sprintf("%sv2/%s/%s", challengePath, authz.ID, challen... | go | func (wfe *WebFrontEndImpl) prepChallengeForDisplay(request *http.Request, authz core.Authorization, challenge *core.Challenge) {
// Update the challenge URL to be relative to the HTTP request Host
if authz.V2 {
challenge.URL = web.RelativeEndpoint(request, fmt.Sprintf("%sv2/%s/%s", challengePath, authz.ID, challen... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"prepChallengeForDisplay",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"authz",
"core",
".",
"Authorization",
",",
"challenge",
"*",
"core",
".",
"Challenge",
")",
"{",
"// Update the challenge URL to be relat... | // prepChallengeForDisplay takes a core.Challenge and prepares it for display to
// the client by filling in its URL field and clearing its ID and URI fields. | [
"prepChallengeForDisplay",
"takes",
"a",
"core",
".",
"Challenge",
"and",
"prepares",
"it",
"for",
"display",
"to",
"the",
"client",
"by",
"filling",
"in",
"its",
"URL",
"field",
"and",
"clearing",
"its",
"ID",
"and",
"URI",
"fields",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L956-L985 | train |
letsencrypt/boulder | wfe2/wfe.go | Account | func (wfe *WebFrontEndImpl) Account(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
body, _, currAcct, prob := wfe.validPOSTForAccount(request, ctx, logEvent)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// validPOSTForAccount handle... | go | func (wfe *WebFrontEndImpl) Account(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
body, _, currAcct, prob := wfe.validPOSTForAccount(request, ctx, logEvent)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// validPOSTForAccount handle... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"Account",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"b... | // Account is used by a client to submit an update to their account. | [
"Account",
"is",
"used",
"by",
"a",
"client",
"to",
"submit",
"an",
"update",
"to",
"their",
"account",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1132-L1190 | train |
letsencrypt/boulder | wfe2/wfe.go | Issuer | func (wfe *WebFrontEndImpl) Issuer(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
// TODO Content negotiation
response.Header().Set("Content-Type", "application/pkix-cert")
response.WriteHeader(http.StatusOK)
if _, err := response.Write(wfe.IssuerCert); err !... | go | func (wfe *WebFrontEndImpl) Issuer(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
// TODO Content negotiation
response.Header().Set("Content-Type", "application/pkix-cert")
response.WriteHeader(http.StatusOK)
if _, err := response.Write(wfe.IssuerCert); err !... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"Issuer",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"//... | // Issuer obtains the issuer certificate used by this instance of Boulder. | [
"Issuer",
"obtains",
"the",
"issuer",
"certificate",
"used",
"by",
"this",
"instance",
"of",
"Boulder",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1498-L1505 | train |
letsencrypt/boulder | wfe2/wfe.go | BuildID | func (wfe *WebFrontEndImpl) BuildID(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
response.Header().Set("Content-Type", "text/plain")
response.WriteHeader(http.StatusOK)
detailsString := fmt.Sprintf("Boulder=(%s %s)", core.GetBuildID(), core.GetBuildTime())
... | go | func (wfe *WebFrontEndImpl) BuildID(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
response.Header().Set("Content-Type", "text/plain")
response.WriteHeader(http.StatusOK)
detailsString := fmt.Sprintf("Boulder=(%s %s)", core.GetBuildID(), core.GetBuildTime())
... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"BuildID",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"r... | // BuildID tells the requestor what build we're running. | [
"BuildID",
"tells",
"the",
"requestor",
"what",
"build",
"we",
"re",
"running",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1508-L1515 | train |
letsencrypt/boulder | wfe2/wfe.go | Options | func (wfe *WebFrontEndImpl) Options(response http.ResponseWriter, request *http.Request, methodsStr string, methodsMap map[string]bool) {
// Every OPTIONS request gets an Allow header with a list of supported methods.
response.Header().Set("Allow", methodsStr)
// CORS preflight requests get additional headers. See
... | go | func (wfe *WebFrontEndImpl) Options(response http.ResponseWriter, request *http.Request, methodsStr string, methodsMap map[string]bool) {
// Every OPTIONS request gets an Allow header with a list of supported methods.
response.Header().Set("Allow", methodsStr)
// CORS preflight requests get additional headers. See
... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"Options",
"(",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
",",
"methodsStr",
"string",
",",
"methodsMap",
"map",
"[",
"string",
"]",
"bool",
")",
"{",
"// Every ... | // Options responds to an HTTP OPTIONS request. | [
"Options",
"responds",
"to",
"an",
"HTTP",
"OPTIONS",
"request",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1518-L1531 | train |
letsencrypt/boulder | wfe2/wfe.go | NewOrder | func (wfe *WebFrontEndImpl) NewOrder(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
body, _, acct, prob := wfe.validPOSTForAccount(request, ctx, logEvent)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// validPOSTForAccount handles i... | go | func (wfe *WebFrontEndImpl) NewOrder(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
body, _, acct, prob := wfe.validPOSTForAccount(request, ctx, logEvent)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// validPOSTForAccount handles i... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"NewOrder",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"... | // NewOrder is used by clients to create a new order object from a CSR | [
"NewOrder",
"is",
"used",
"by",
"clients",
"to",
"create",
"a",
"new",
"order",
"object",
"from",
"a",
"CSR"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1718-L1789 | train |
letsencrypt/boulder | wfe2/wfe.go | GetOrder | func (wfe *WebFrontEndImpl) GetOrder(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
var requesterAccount *core.Registration
// Any POSTs to the Order endpoint should be POST-as-GET requests. There are
// no POSTs with a body allowed for this endpoint.
if requ... | go | func (wfe *WebFrontEndImpl) GetOrder(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
var requesterAccount *core.Registration
// Any POSTs to the Order endpoint should be POST-as-GET requests. There are
// no POSTs with a body allowed for this endpoint.
if requ... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"GetOrder",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"... | // GetOrder is used to retrieve a existing order object | [
"GetOrder",
"is",
"used",
"to",
"retrieve",
"a",
"existing",
"order",
"object"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe2/wfe.go#L1792-L1852 | train |
letsencrypt/boulder | cmd/notify-mailer/main.go | resolveEmailAddresses | func (m *mailer) resolveEmailAddresses() (emailToRecipientMap, error) {
result := make(emailToRecipientMap, len(m.destinations))
for _, r := range m.destinations {
// Get the email address for the reg ID
emails, err := emailsForReg(r.id, m.dbMap)
if err != nil {
return nil, err
}
for _, email := range ... | go | func (m *mailer) resolveEmailAddresses() (emailToRecipientMap, error) {
result := make(emailToRecipientMap, len(m.destinations))
for _, r := range m.destinations {
// Get the email address for the reg ID
emails, err := emailsForReg(r.id, m.dbMap)
if err != nil {
return nil, err
}
for _, email := range ... | [
"func",
"(",
"m",
"*",
"mailer",
")",
"resolveEmailAddresses",
"(",
")",
"(",
"emailToRecipientMap",
",",
"error",
")",
"{",
"result",
":=",
"make",
"(",
"emailToRecipientMap",
",",
"len",
"(",
"m",
".",
"destinations",
")",
")",
"\n\n",
"for",
"_",
",",... | // resolveEmailAddresses looks up the id of each recipient to find that
// account's email addresses, then adds that recipient to a map from address to
// recipient struct. | [
"resolveEmailAddresses",
"looks",
"up",
"the",
"id",
"of",
"each",
"recipient",
"to",
"find",
"that",
"account",
"s",
"email",
"addresses",
"then",
"adds",
"that",
"recipient",
"to",
"a",
"map",
"from",
"address",
"to",
"recipient",
"struct",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/notify-mailer/main.go#L184-L205 | train |
letsencrypt/boulder | cmd/notify-mailer/main.go | emailsForReg | func emailsForReg(id int, dbMap dbSelector) ([]string, error) {
var contact contactJSON
err := dbMap.SelectOne(&contact,
`SELECT id, contact
FROM registrations
WHERE contact != 'null' AND id = :id;`,
map[string]interface{}{
"id": id,
})
if err == sql.ErrNoRows {
return []string{}, nil
}
if err != ni... | go | func emailsForReg(id int, dbMap dbSelector) ([]string, error) {
var contact contactJSON
err := dbMap.SelectOne(&contact,
`SELECT id, contact
FROM registrations
WHERE contact != 'null' AND id = :id;`,
map[string]interface{}{
"id": id,
})
if err == sql.ErrNoRows {
return []string{}, nil
}
if err != ni... | [
"func",
"emailsForReg",
"(",
"id",
"int",
",",
"dbMap",
"dbSelector",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"contact",
"contactJSON",
"\n",
"err",
":=",
"dbMap",
".",
"SelectOne",
"(",
"&",
"contact",
",",
"`SELECT id, contact\n\t\tF... | // Finds the email addresses associated with a reg ID | [
"Finds",
"the",
"email",
"addresses",
"associated",
"with",
"a",
"reg",
"ID"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/notify-mailer/main.go#L216-L244 | train |
letsencrypt/boulder | cmd/notify-mailer/main.go | readRecipientsList | func readRecipientsList(filename string) ([]recipient, error) {
f, err := os.Open(filename)
if err != nil {
return nil, err
}
reader := csv.NewReader(f)
record, err := reader.Read()
if err != nil {
return nil, err
}
if len(record) == 0 {
return nil, fmt.Errorf("no entries in CSV")
}
if record[0] != "id"... | go | func readRecipientsList(filename string) ([]recipient, error) {
f, err := os.Open(filename)
if err != nil {
return nil, err
}
reader := csv.NewReader(f)
record, err := reader.Read()
if err != nil {
return nil, err
}
if len(record) == 0 {
return nil, fmt.Errorf("no entries in CSV")
}
if record[0] != "id"... | [
"func",
"readRecipientsList",
"(",
"filename",
"string",
")",
"(",
"[",
"]",
"recipient",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n"... | // readRecipientsList reads a CSV filename and parses that file into a list of
// recipient structs. It puts any columns after the first into a per-recipient
// map from column name -> value. | [
"readRecipientsList",
"reads",
"a",
"CSV",
"filename",
"and",
"parses",
"that",
"file",
"into",
"a",
"list",
"of",
"recipient",
"structs",
".",
"It",
"puts",
"any",
"columns",
"after",
"the",
"first",
"into",
"a",
"per",
"-",
"recipient",
"map",
"from",
"c... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/notify-mailer/main.go#L260-L313 | train |
letsencrypt/boulder | log/mock.go | newMockWriter | func newMockWriter() *mockWriter {
msgChan := make(chan string)
getChan := make(chan []string)
clearChan := make(chan struct{})
closeChan := make(chan struct{})
w := &mockWriter{
logged: []string{},
msgChan: msgChan,
getChan: getChan,
clearChan: clearChan,
closeChan: closeChan,
}
go func() {
f... | go | func newMockWriter() *mockWriter {
msgChan := make(chan string)
getChan := make(chan []string)
clearChan := make(chan struct{})
closeChan := make(chan struct{})
w := &mockWriter{
logged: []string{},
msgChan: msgChan,
getChan: getChan,
clearChan: clearChan,
closeChan: closeChan,
}
go func() {
f... | [
"func",
"newMockWriter",
"(",
")",
"*",
"mockWriter",
"{",
"msgChan",
":=",
"make",
"(",
"chan",
"string",
")",
"\n",
"getChan",
":=",
"make",
"(",
"chan",
"[",
"]",
"string",
")",
"\n",
"clearChan",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")"... | // newMockWriter returns a new mockWriter | [
"newMockWriter",
"returns",
"a",
"new",
"mockWriter"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/log/mock.go#L50-L77 | train |
letsencrypt/boulder | cmd/config.go | Pass | func (pc *PasswordConfig) Pass() (string, error) {
if pc.PasswordFile != "" {
contents, err := ioutil.ReadFile(pc.PasswordFile)
if err != nil {
return "", err
}
return strings.TrimRight(string(contents), "\n"), nil
}
return pc.Password, nil
} | go | func (pc *PasswordConfig) Pass() (string, error) {
if pc.PasswordFile != "" {
contents, err := ioutil.ReadFile(pc.PasswordFile)
if err != nil {
return "", err
}
return strings.TrimRight(string(contents), "\n"), nil
}
return pc.Password, nil
} | [
"func",
"(",
"pc",
"*",
"PasswordConfig",
")",
"Pass",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"pc",
".",
"PasswordFile",
"!=",
"\"",
"\"",
"{",
"contents",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"pc",
".",
"PasswordFile",
... | // Pass returns a password, either directly from the configuration
// struct or by reading from a specified file | [
"Pass",
"returns",
"a",
"password",
"either",
"directly",
"from",
"the",
"configuration",
"struct",
"or",
"by",
"reading",
"from",
"a",
"specified",
"file"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L25-L34 | train |
letsencrypt/boulder | cmd/config.go | URL | func (d *DBConfig) URL() (string, error) {
if d.DBConnectFile != "" {
url, err := ioutil.ReadFile(d.DBConnectFile)
return strings.TrimSpace(string(url)), err
}
return d.DBConnect, nil
} | go | func (d *DBConfig) URL() (string, error) {
if d.DBConnectFile != "" {
url, err := ioutil.ReadFile(d.DBConnectFile)
return strings.TrimSpace(string(url)), err
}
return d.DBConnect, nil
} | [
"func",
"(",
"d",
"*",
"DBConfig",
")",
"URL",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"d",
".",
"DBConnectFile",
"!=",
"\"",
"\"",
"{",
"url",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"d",
".",
"DBConnectFile",
")",
"\n",... | // URL returns the DBConnect URL represented by this DBConfig object, either
// loading it from disk or returning a default value. Leading and trailing
// whitespace is stripped. | [
"URL",
"returns",
"the",
"DBConnect",
"URL",
"represented",
"by",
"this",
"DBConfig",
"object",
"either",
"loading",
"it",
"from",
"disk",
"or",
"returning",
"a",
"default",
"value",
".",
"Leading",
"and",
"trailing",
"whitespace",
"is",
"stripped",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L58-L64 | train |
letsencrypt/boulder | cmd/config.go | CheckChallenges | func (pc PAConfig) CheckChallenges() error {
if len(pc.Challenges) == 0 {
return errors.New("empty challenges map in the Policy Authority config is not allowed")
}
for name := range pc.Challenges {
if !core.ValidChallenge(name) {
return fmt.Errorf("Invalid challenge in PA config: %s", name)
}
}
return nil... | go | func (pc PAConfig) CheckChallenges() error {
if len(pc.Challenges) == 0 {
return errors.New("empty challenges map in the Policy Authority config is not allowed")
}
for name := range pc.Challenges {
if !core.ValidChallenge(name) {
return fmt.Errorf("Invalid challenge in PA config: %s", name)
}
}
return nil... | [
"func",
"(",
"pc",
"PAConfig",
")",
"CheckChallenges",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"pc",
".",
"Challenges",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"name",
":=",
"range",
"p... | // CheckChallenges checks whether the list of challenges in the PA config
// actually contains valid challenge names | [
"CheckChallenges",
"checks",
"whether",
"the",
"list",
"of",
"challenges",
"in",
"the",
"PA",
"config",
"actually",
"contains",
"valid",
"challenge",
"names"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L89-L99 | train |
letsencrypt/boulder | cmd/config.go | UnmarshalJSON | func (d *ConfigDuration) UnmarshalJSON(b []byte) error {
s := ""
err := json.Unmarshal(b, &s)
if err != nil {
if _, ok := err.(*json.UnmarshalTypeError); ok {
return ErrDurationMustBeString
}
return err
}
dd, err := time.ParseDuration(s)
d.Duration = dd
return err
} | go | func (d *ConfigDuration) UnmarshalJSON(b []byte) error {
s := ""
err := json.Unmarshal(b, &s)
if err != nil {
if _, ok := err.(*json.UnmarshalTypeError); ok {
return ErrDurationMustBeString
}
return err
}
dd, err := time.ParseDuration(s)
d.Duration = dd
return err
} | [
"func",
"(",
"d",
"*",
"ConfigDuration",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"s",
":=",
"\"",
"\"",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // UnmarshalJSON parses a string into a ConfigDuration using
// time.ParseDuration. If the input does not unmarshal as a
// string, then UnmarshalJSON returns ErrDurationMustBeString. | [
"UnmarshalJSON",
"parses",
"a",
"string",
"into",
"a",
"ConfigDuration",
"using",
"time",
".",
"ParseDuration",
".",
"If",
"the",
"input",
"does",
"not",
"unmarshal",
"as",
"a",
"string",
"then",
"UnmarshalJSON",
"returns",
"ErrDurationMustBeString",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L210-L222 | train |
letsencrypt/boulder | cmd/config.go | MarshalJSON | func (d ConfigDuration) MarshalJSON() ([]byte, error) {
return []byte(d.Duration.String()), nil
} | go | func (d ConfigDuration) MarshalJSON() ([]byte, error) {
return []byte(d.Duration.String()), nil
} | [
"func",
"(",
"d",
"ConfigDuration",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"[",
"]",
"byte",
"(",
"d",
".",
"Duration",
".",
"String",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] | // MarshalJSON returns the string form of the duration, as a byte array. | [
"MarshalJSON",
"returns",
"the",
"string",
"form",
"of",
"the",
"duration",
"as",
"a",
"byte",
"array",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L225-L227 | train |
letsencrypt/boulder | cmd/config.go | Setup | func (ts *TemporalSet) Setup() error {
if ts.Name == "" {
return errors.New("Name cannot be empty")
}
if len(ts.Shards) == 0 {
return errors.New("temporal set contains no shards")
}
for i := range ts.Shards {
if ts.Shards[i].WindowEnd.Before(ts.Shards[i].WindowStart) ||
ts.Shards[i].WindowEnd.Equal(ts.Sha... | go | func (ts *TemporalSet) Setup() error {
if ts.Name == "" {
return errors.New("Name cannot be empty")
}
if len(ts.Shards) == 0 {
return errors.New("temporal set contains no shards")
}
for i := range ts.Shards {
if ts.Shards[i].WindowEnd.Before(ts.Shards[i].WindowStart) ||
ts.Shards[i].WindowEnd.Equal(ts.Sha... | [
"func",
"(",
"ts",
"*",
"TemporalSet",
")",
"Setup",
"(",
")",
"error",
"{",
"if",
"ts",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ts",
".",
"Shards",
")",
"=... | // Setup initializes the TemporalSet by parsing the start and end dates
// and verifying WindowEnd > WindowStart | [
"Setup",
"initializes",
"the",
"TemporalSet",
"by",
"parsing",
"the",
"start",
"and",
"end",
"dates",
"and",
"verifying",
"WindowEnd",
">",
"WindowStart"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L299-L313 | train |
letsencrypt/boulder | cmd/config.go | pick | func (ts *TemporalSet) pick(exp time.Time) (*LogShard, error) {
for _, shard := range ts.Shards {
if exp.Before(shard.WindowStart) {
continue
}
if !exp.Before(shard.WindowEnd) {
continue
}
return &shard, nil
}
return nil, fmt.Errorf("no valid shard available for temporal set %q for expiration date %q... | go | func (ts *TemporalSet) pick(exp time.Time) (*LogShard, error) {
for _, shard := range ts.Shards {
if exp.Before(shard.WindowStart) {
continue
}
if !exp.Before(shard.WindowEnd) {
continue
}
return &shard, nil
}
return nil, fmt.Errorf("no valid shard available for temporal set %q for expiration date %q... | [
"func",
"(",
"ts",
"*",
"TemporalSet",
")",
"pick",
"(",
"exp",
"time",
".",
"Time",
")",
"(",
"*",
"LogShard",
",",
"error",
")",
"{",
"for",
"_",
",",
"shard",
":=",
"range",
"ts",
".",
"Shards",
"{",
"if",
"exp",
".",
"Before",
"(",
"shard",
... | // pick chooses the correct shard from a TemporalSet to use for the given
// expiration time. In the case where two shards have overlapping windows
// the earlier of the two shards will be chosen. | [
"pick",
"chooses",
"the",
"correct",
"shard",
"from",
"a",
"TemporalSet",
"to",
"use",
"for",
"the",
"given",
"expiration",
"time",
".",
"In",
"the",
"case",
"where",
"two",
"shards",
"have",
"overlapping",
"windows",
"the",
"earlier",
"of",
"the",
"two",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L318-L329 | train |
letsencrypt/boulder | cmd/config.go | Info | func (ld LogDescription) Info(exp time.Time) (string, string, error) {
if ld.TemporalSet == nil {
return ld.URI, ld.Key, nil
}
shard, err := ld.TemporalSet.pick(exp)
if err != nil {
return "", "", err
}
return shard.URI, shard.Key, nil
} | go | func (ld LogDescription) Info(exp time.Time) (string, string, error) {
if ld.TemporalSet == nil {
return ld.URI, ld.Key, nil
}
shard, err := ld.TemporalSet.pick(exp)
if err != nil {
return "", "", err
}
return shard.URI, shard.Key, nil
} | [
"func",
"(",
"ld",
"LogDescription",
")",
"Info",
"(",
"exp",
"time",
".",
"Time",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"if",
"ld",
".",
"TemporalSet",
"==",
"nil",
"{",
"return",
"ld",
".",
"URI",
",",
"ld",
".",
"Key",
","... | // Info returns the URI and key of the log, either from a plain log description
// or from the earliest valid shard from a temporal log set | [
"Info",
"returns",
"the",
"URI",
"and",
"key",
"of",
"the",
"log",
"either",
"from",
"a",
"plain",
"log",
"description",
"or",
"from",
"the",
"earliest",
"valid",
"shard",
"from",
"a",
"temporal",
"log",
"set"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/cmd/config.go#L344-L353 | train |
letsencrypt/boulder | grpc/balancer.go | Resolve | func (sr *staticResolver) Resolve(target string) (naming.Watcher, error) {
return sr, nil
} | go | func (sr *staticResolver) Resolve(target string) (naming.Watcher, error) {
return sr, nil
} | [
"func",
"(",
"sr",
"*",
"staticResolver",
")",
"Resolve",
"(",
"target",
"string",
")",
"(",
"naming",
".",
"Watcher",
",",
"error",
")",
"{",
"return",
"sr",
",",
"nil",
"\n",
"}"
] | // Resolve just returns the staticResolver it was called from as it satisfies
// both the naming.Resolver and naming.Watcher interfaces | [
"Resolve",
"just",
"returns",
"the",
"staticResolver",
"it",
"was",
"called",
"from",
"as",
"it",
"satisfies",
"both",
"the",
"naming",
".",
"Resolver",
"and",
"naming",
".",
"Watcher",
"interfaces"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/balancer.go#L26-L28 | train |
letsencrypt/boulder | grpc/balancer.go | Next | func (sr *staticResolver) Next() ([]*naming.Update, error) {
if sr.addresses != nil {
addrs := sr.addresses
sr.addresses = nil
return addrs, nil
}
// Since staticResolver.Next is called in a tight loop block forever
// after returning the initial set of addresses
forever := make(chan struct{})
<-forever
re... | go | func (sr *staticResolver) Next() ([]*naming.Update, error) {
if sr.addresses != nil {
addrs := sr.addresses
sr.addresses = nil
return addrs, nil
}
// Since staticResolver.Next is called in a tight loop block forever
// after returning the initial set of addresses
forever := make(chan struct{})
<-forever
re... | [
"func",
"(",
"sr",
"*",
"staticResolver",
")",
"Next",
"(",
")",
"(",
"[",
"]",
"*",
"naming",
".",
"Update",
",",
"error",
")",
"{",
"if",
"sr",
".",
"addresses",
"!=",
"nil",
"{",
"addrs",
":=",
"sr",
".",
"addresses",
"\n",
"sr",
".",
"address... | // Next is called in a loop by grpc.RoundRobin expecting updates to which addresses are
// appropriate. Since we just want to return a static list once return a list on the first
// call then block forever on the second instead of sitting in a tight loop | [
"Next",
"is",
"called",
"in",
"a",
"loop",
"by",
"grpc",
".",
"RoundRobin",
"expecting",
"updates",
"to",
"which",
"addresses",
"are",
"appropriate",
".",
"Since",
"we",
"just",
"want",
"to",
"return",
"a",
"static",
"list",
"once",
"return",
"a",
"list",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/grpc/balancer.go#L33-L44 | train |
letsencrypt/boulder | wfe/wfe.go | NewAuthorization | func (wfe *WebFrontEndImpl) NewAuthorization(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
body, _, currReg, prob := wfe.verifyPOST(ctx, logEvent, request, true, core.ResourceNewAuthz)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// ver... | go | func (wfe *WebFrontEndImpl) NewAuthorization(ctx context.Context, logEvent *web.RequestEvent, response http.ResponseWriter, request *http.Request) {
body, _, currReg, prob := wfe.verifyPOST(ctx, logEvent, request, true, core.ResourceNewAuthz)
addRequesterHeader(response, logEvent.Requester)
if prob != nil {
// ver... | [
"func",
"(",
"wfe",
"*",
"WebFrontEndImpl",
")",
"NewAuthorization",
"(",
"ctx",
"context",
".",
"Context",
",",
"logEvent",
"*",
"web",
".",
"RequestEvent",
",",
"response",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
... | // NewAuthorization is used by clients to submit a new ID Authorization | [
"NewAuthorization",
"is",
"used",
"by",
"clients",
"to",
"submit",
"a",
"new",
"ID",
"Authorization"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/wfe/wfe.go#L656-L702 | train |
letsencrypt/boulder | iana/iana.go | ExtractSuffix | func ExtractSuffix(name string) (string, error) {
if name == "" {
return "", fmt.Errorf("Blank name argument passed to ExtractSuffix")
}
rule := publicsuffix.DefaultList.Find(name, &publicsuffix.FindOptions{IgnorePrivate: true, DefaultRule: nil})
if rule == nil {
return "", fmt.Errorf("Domain %s has no IANA TL... | go | func ExtractSuffix(name string) (string, error) {
if name == "" {
return "", fmt.Errorf("Blank name argument passed to ExtractSuffix")
}
rule := publicsuffix.DefaultList.Find(name, &publicsuffix.FindOptions{IgnorePrivate: true, DefaultRule: nil})
if rule == nil {
return "", fmt.Errorf("Domain %s has no IANA TL... | [
"func",
"ExtractSuffix",
"(",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"rule",
":=",
"publicsuffix",... | // ExtractSuffix returns the public suffix of the domain using only the "ICANN"
// section of the Public Suffix List database.
// If the domain does not end in a suffix that belongs to an IANA-assigned
// domain, ExtractSuffix returns an error. | [
"ExtractSuffix",
"returns",
"the",
"public",
"suffix",
"of",
"the",
"domain",
"using",
"only",
"the",
"ICANN",
"section",
"of",
"the",
"Public",
"Suffix",
"List",
"database",
".",
"If",
"the",
"domain",
"does",
"not",
"end",
"in",
"a",
"suffix",
"that",
"b... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/iana/iana.go#L13-L32 | train |
letsencrypt/boulder | web/probs.go | ProblemDetailsForError | func ProblemDetailsForError(err error, msg string) *probs.ProblemDetails {
switch e := err.(type) {
case *probs.ProblemDetails:
return e
case *berrors.BoulderError:
return problemDetailsForBoulderError(e, msg)
default:
// Internal server error messages may include sensitive data, so we do
// not include it.... | go | func ProblemDetailsForError(err error, msg string) *probs.ProblemDetails {
switch e := err.(type) {
case *probs.ProblemDetails:
return e
case *berrors.BoulderError:
return problemDetailsForBoulderError(e, msg)
default:
// Internal server error messages may include sensitive data, so we do
// not include it.... | [
"func",
"ProblemDetailsForError",
"(",
"err",
"error",
",",
"msg",
"string",
")",
"*",
"probs",
".",
"ProblemDetails",
"{",
"switch",
"e",
":=",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"probs",
".",
"ProblemDetails",
":",
"return",
"e",
"\n",
"... | // problemDetailsForError turns an error into a ProblemDetails with the special
// case of returning the same error back if its already a ProblemDetails. If the
// error is of an type unknown to ProblemDetailsForError, it will return a
// ServerInternal ProblemDetails. | [
"problemDetailsForError",
"turns",
"an",
"error",
"into",
"a",
"ProblemDetails",
"with",
"the",
"special",
"case",
"of",
"returning",
"the",
"same",
"error",
"back",
"if",
"its",
"already",
"a",
"ProblemDetails",
".",
"If",
"the",
"error",
"is",
"of",
"an",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/web/probs.go#L47-L58 | train |
letsencrypt/boulder | ratelimit/rate-limits.go | GetThreshold | func (rlp *RateLimitPolicy) GetThreshold(key string, regID int64) int {
regOverride, regOverrideExists := rlp.RegistrationOverrides[regID]
keyOverride, keyOverrideExists := rlp.Overrides[key]
if regOverrideExists && !keyOverrideExists {
// If there is a regOverride and no keyOverride use the regOverride
return ... | go | func (rlp *RateLimitPolicy) GetThreshold(key string, regID int64) int {
regOverride, regOverrideExists := rlp.RegistrationOverrides[regID]
keyOverride, keyOverrideExists := rlp.Overrides[key]
if regOverrideExists && !keyOverrideExists {
// If there is a regOverride and no keyOverride use the regOverride
return ... | [
"func",
"(",
"rlp",
"*",
"RateLimitPolicy",
")",
"GetThreshold",
"(",
"key",
"string",
",",
"regID",
"int64",
")",
"int",
"{",
"regOverride",
",",
"regOverrideExists",
":=",
"rlp",
".",
"RegistrationOverrides",
"[",
"regID",
"]",
"\n",
"keyOverride",
",",
"k... | // GetThreshold returns the threshold for this rate limit, taking into account
// any overrides for `key` or `regID`. If both `key` and `regID` have an
// override the largest of the two will be used. | [
"GetThreshold",
"returns",
"the",
"threshold",
"for",
"this",
"rate",
"limit",
"taking",
"into",
"account",
"any",
"overrides",
"for",
"key",
"or",
"regID",
".",
"If",
"both",
"key",
"and",
"regID",
"have",
"an",
"override",
"the",
"largest",
"of",
"the",
... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/ratelimit/rate-limits.go#L192-L214 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.