_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q30900
Open
train
func (o osFileSystem) Open(name string) (http.File, error) { return o(name) }
go
{ "resource": "" }
q30901
NewReferenceLoaderFileSystem
train
func NewReferenceLoaderFileSystem(source string, fs http.FileSystem) JSONLoader { return &jsonReferenceLoader{ fs: fs, source: source, } }
go
{ "resource": "" }
q30902
NewReaderLoader
train
func NewReaderLoader(source io.Reader) (JSONLoader, io.Reader) { buf := &bytes.Buffer{} return &jsonIOLoader{buf: buf}, io.TeeReader(source, buf) }
go
{ "resource": "" }
q30903
NewWriterLoader
train
func NewWriterLoader(source io.Writer) (JSONLoader, io.Writer) { buf := &bytes.Buffer{} return &jsonIOLoader{buf: buf}, io.MultiWriter(source, buf) }
go
{ "resource": "" }
q30904
Add
train
func (c *FormatCheckerChain) Add(name string, f FormatChecker) *FormatCheckerChain { lock.Lock() c.formatters[name] = f lock.Unlock() return c }
go
{ "resource": "" }
q30905
Has
train
func (c *FormatCheckerChain) Has(name string) bool { lock.Lock() _, ok := c.formatters[name] lock.Unlock() return ok }
go
{ "resource": "" }
q30906
IsFormat
train
func (c *FormatCheckerChain) IsFormat(name string, input interface{}) bool { lock.Lock() f, ok := c.formatters[name] lock.Unlock() if !ok { return false } return f.IsFormat(input) }
go
{ "resource": "" }
q30907
IsFormat
train
func (f EmailFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } _, err := mail.ParseAddress(asString) return err == nil }
go
{ "resource": "" }
q30908
IsFormat
train
func (f IPV4FormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } // Credit: https://github.com/asaskevich/govalidator ip := net.ParseIP(asString) return ip != nil && strings.Contains(asString, ".") }
go
{ "resource": "" }
q30909
IsFormat
train
func (f URIFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } u, err := url.Parse(asString) if err != nil || u.Scheme == "" { return false } return !strings.Contains(asString, `\`) }
go
{ "resource": "" }
q30910
IsFormat
train
func (f URIReferenceFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } _, err := url.Parse(asString) return err == nil && !strings.Contains(asString, `\`) }
go
{ "resource": "" }
q30911
IsFormat
train
func (f URITemplateFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } u, err := url.Parse(asString) if err != nil || strings.Contains(asString, `\`) { return false } return rxURITemplate.MatchString(u.Path) }
go
{ "resource": "" }
q30912
IsFormat
train
func (f HostnameFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } return rxHostname.MatchString(asString) && len(asString) < 256 }
go
{ "resource": "" }
q30913
IsFormat
train
func (f UUIDFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } return rxUUID.MatchString(asString) }
go
{ "resource": "" }
q30914
IsFormat
train
func (f RegexFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } if asString == "" { return true } _, err := regexp.Compile(asString) return err == nil }
go
{ "resource": "" }
q30915
IsFormat
train
func (f JSONPointerFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } return rxJSONPointer.MatchString(asString) }
go
{ "resource": "" }
q30916
IsFormat
train
func (f RelativeJSONPointerFormatChecker) IsFormat(input interface{}) bool { asString, ok := input.(string) if !ok { return false } return rxRelJSONPointer.MatchString(asString) }
go
{ "resource": "" }
q30917
String
train
func (c *JsonContext) String(del ...string) string { byteArr := make([]byte, 0, c.stringLen()) buf := bytes.NewBuffer(byteArr) c.writeStringToBuffer(buf, del) return buf.String() }
go
{ "resource": "" }
q30918
String
train
func (v ResultErrorFields) String() string { // as a fallback, the value is displayed go style valueString := fmt.Sprintf("%v", v.value) // marshal the go value value to json if v.value == nil { valueString = TYPE_NULL } else { if vs, err := marshalToJSONString(v.value); err == nil { if vs == nil { val...
go
{ "resource": "" }
q30919
mergeErrors
train
func (v *Result) mergeErrors(otherResult *Result) { v.errors = append(v.errors, otherResult.Errors()...) v.score += otherResult.score }
go
{ "resource": "" }
q30920
indexStringInSlice
train
func indexStringInSlice(s []string, what string) int { for i := range s { if s[i] == what { return i } } return -1 }
go
{ "resource": "" }
q30921
NewSchemaLoader
train
func NewSchemaLoader() *SchemaLoader { ps := &SchemaLoader{ pool: &schemaPool{ schemaPoolDocuments: make(map[string]*schemaPoolDocument), }, AutoDetect: true, Validate: false, Draft: Hybrid, } ps.pool.autoDetect = &ps.AutoDetect return ps }
go
{ "resource": "" }
q30922
AddSchema
train
func (sl *SchemaLoader) AddSchema(url string, loader JSONLoader) error { ref, err := gojsonreference.NewJsonReference(url) if err != nil { return err } doc, err := loader.LoadJSON() if err != nil { return err } if sl.Validate { if err := sl.validateMetaschema(doc); err != nil { return err } } ...
go
{ "resource": "" }
q30923
Compile
train
func (sl *SchemaLoader) Compile(rootSchema JSONLoader) (*Schema, error) { ref, err := rootSchema.JsonReference() if err != nil { return nil, err } d := Schema{} d.pool = sl.pool d.pool.jsonLoaderFactory = rootSchema.LoaderFactory() d.documentReference = ref d.referencePool = newSchemaReferencePool() var ...
go
{ "resource": "" }
q30924
GetRegistration
train
func (sa *StorageAuthority) GetRegistration(_ context.Context, id int64) (core.Registration, error) { if id == 100 { // Tag meaning "Missing" return core.Registration{}, errors.New("missing") } if id == 101 { // Tag meaning "Malformed" return core.Registration{}, nil } if id == 102 { // Tag meaning "Not ...
go
{ "resource": "" }
q30925
GetAuthorization
train
func (sa *StorageAuthority) GetAuthorization(_ context.Context, id string) (core.Authorization, error) { authz := core.Authorization{ ID: "valid", Status: core.StatusValid, RegistrationID: 1, Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"}, Challenges: []core...
go
{ "resource": "" }
q30926
RevokeAuthorizationsByDomain
train
func (sa *StorageAuthority) RevokeAuthorizationsByDomain(_ context.Context, ident core.AcmeIdentifier) (int64, int64, error) { return 0, 0, nil }
go
{ "resource": "" }
q30927
GetCertificate
train
func (sa *StorageAuthority) GetCertificate(_ context.Context, serial string) (core.Certificate, error) { // Serial ee == 238.crt if serial == "0000000000000000000000000000000000ee" { certPemBytes, _ := ioutil.ReadFile("test/238.crt") certBlock, _ := pem.Decode(certPemBytes) return core.Certificate{ Registrat...
go
{ "resource": "" }
q30928
GetCertificateStatus
train
func (sa *StorageAuthority) GetCertificateStatus(_ context.Context, serial string) (core.CertificateStatus, error) { // Serial ee == 238.crt if serial == "0000000000000000000000000000000000ee" { return core.CertificateStatus{ Status: core.OCSPStatusGood, }, nil } else if serial == "000000000000000000000000000...
go
{ "resource": "" }
q30929
AddCertificate
train
func (sa *StorageAuthority) AddCertificate(_ context.Context, certDER []byte, regID int64, _ []byte, _ *time.Time) (digest string, err error) { return }
go
{ "resource": "" }
q30930
FinalizeAuthorization
train
func (sa *StorageAuthority) FinalizeAuthorization(_ context.Context, authz core.Authorization) (err error) { return }
go
{ "resource": "" }
q30931
MarkCertificateRevoked
train
func (sa *StorageAuthority) MarkCertificateRevoked(_ context.Context, serial string, reasonCode revocation.Reason) (err error) { return }
go
{ "resource": "" }
q30932
NewPendingAuthorization
train
func (sa *StorageAuthority) NewPendingAuthorization(_ context.Context, authz core.Authorization) (core.Authorization, error) { return authz, nil }
go
{ "resource": "" }
q30933
NewRegistration
train
func (sa *StorageAuthority) NewRegistration(_ context.Context, reg core.Registration) (regR core.Registration, err error) { return }
go
{ "resource": "" }
q30934
UpdateRegistration
train
func (sa *StorageAuthority) UpdateRegistration(_ context.Context, reg core.Registration) (err error) { return }
go
{ "resource": "" }
q30935
CountFQDNSets
train
func (sa *StorageAuthority) CountFQDNSets(_ context.Context, since time.Duration, names []string) (int64, error) { return 0, nil }
go
{ "resource": "" }
q30936
FQDNSetExists
train
func (sa *StorageAuthority) FQDNSetExists(_ context.Context, names []string) (bool, error) { return false, nil }
go
{ "resource": "" }
q30937
GetValidAuthorizations
train
func (sa *StorageAuthority) GetValidAuthorizations(_ context.Context, regID int64, names []string, now time.Time) (map[string]*core.Authorization, error) { if regID == 1 { auths := make(map[string]*core.Authorization) for _, name := range names { if sa.authorizedDomains[name] || name == "not-an-example.com" { ...
go
{ "resource": "" }
q30938
CountCertificatesByNames
train
func (sa *StorageAuthority) CountCertificatesByNames(_ context.Context, _ []string, _, _ time.Time) (ret []*sapb.CountByNames_MapElement, err error) { return }
go
{ "resource": "" }
q30939
CountRegistrationsByIP
train
func (sa *StorageAuthority) CountRegistrationsByIP(_ context.Context, _ net.IP, _, _ time.Time) (int, error) { return 0, nil }
go
{ "resource": "" }
q30940
CountPendingAuthorizations
train
func (sa *StorageAuthority) CountPendingAuthorizations(_ context.Context, _ int64) (int, error) { return 0, nil }
go
{ "resource": "" }
q30941
CountOrders
train
func (sa *StorageAuthority) CountOrders(_ context.Context, _ int64, _, _ time.Time) (int, error) { return 0, nil }
go
{ "resource": "" }
q30942
DeactivateAuthorization
train
func (sa *StorageAuthority) DeactivateAuthorization(_ context.Context, _ string) error { return nil }
go
{ "resource": "" }
q30943
DeactivateRegistration
train
func (sa *StorageAuthority) DeactivateRegistration(_ context.Context, _ int64) error { return nil }
go
{ "resource": "" }
q30944
NewOrder
train
func (sa *StorageAuthority) NewOrder(_ context.Context, order *corepb.Order) (*corepb.Order, error) { return order, nil }
go
{ "resource": "" }
q30945
SetOrderProcessing
train
func (sa *StorageAuthority) SetOrderProcessing(_ context.Context, order *corepb.Order) error { return nil }
go
{ "resource": "" }
q30946
GetOrder
train
func (sa *StorageAuthority) GetOrder(_ context.Context, req *sapb.OrderRequest) (*corepb.Order, error) { if *req.Id == 2 { return nil, berrors.NotFoundError("bad") } else if *req.Id == 3 { return nil, errors.New("very bad") } status := string(core.StatusValid) one := int64(1) serial := "serial" exp := sa.cl...
go
{ "resource": "" }
q30947
GetAuthorizations
train
func (sa *StorageAuthority) GetAuthorizations(ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) { return &sapb.Authorizations{}, nil }
go
{ "resource": "" }
q30948
CountInvalidAuthorizations
train
func (sa *StorageAuthority) CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error) { return &sapb.Count{}, nil }
go
{ "resource": "" }
q30949
AddPendingAuthorizations
train
func (sa *StorageAuthority) AddPendingAuthorizations(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.AuthorizationIDs, error) { return &sapb.AuthorizationIDs{}, nil }
go
{ "resource": "" }
q30950
NewAuthorizations2
train
func (sa *StorageAuthority) NewAuthorizations2(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.Authorization2IDs, error) { return &sapb.Authorization2IDs{}, nil }
go
{ "resource": "" }
q30951
GetAuthorization2
train
func (sa *StorageAuthority) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2) (*corepb.Authorization, error) { authz := core.Authorization{ Status: core.StatusValid, RegistrationID: 1, Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"}, V2: true, ...
go
{ "resource": "" }
q30952
SubmitToSingleCTWithResult
train
func (*Publisher) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) { return nil, nil }
go
{ "resource": "" }
q30953
SendMail
train
func (m *Mailer) SendMail(to []string, subject, msg string) error { for _, rcpt := range to { m.Messages = append(m.Messages, MailerMessage{ To: rcpt, Subject: subject, Body: msg, }) } return nil }
go
{ "resource": "" }
q30954
ProblemDetailsToStatusCode
train
func ProblemDetailsToStatusCode(prob *ProblemDetails) int { if prob.HTTPStatus != 0 { return prob.HTTPStatus } switch prob.Type { case ConnectionProblem, MalformedProblem, BadSignatureAlgorithmProblem, BadPublicKeyProblem, TLSProblem, UnknownHostProblem, BadNonceProblem, InvalidEmailProblem, Rej...
go
{ "resource": "" }
q30955
BadNonce
train
func BadNonce(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: BadNonceProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30956
RejectedIdentifier
train
func RejectedIdentifier(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: RejectedIdentifierProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30957
Conflict
train
func Conflict(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: MalformedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusConflict, } }
go
{ "resource": "" }
q30958
AlreadyRevoked
train
func AlreadyRevoked(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: AlreadyRevokedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30959
Malformed
train
func Malformed(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: MalformedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30960
BadSignatureAlgorithm
train
func BadSignatureAlgorithm(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: BadSignatureAlgorithmProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30961
BadPublicKey
train
func BadPublicKey(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: BadPublicKeyProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30962
NotFound
train
func NotFound(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: MalformedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusNotFound, } }
go
{ "resource": "" }
q30963
ServerInternal
train
func ServerInternal(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: ServerInternalProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusInternalServerError, } }
go
{ "resource": "" }
q30964
Unauthorized
train
func Unauthorized(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: UnauthorizedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusForbidden, } }
go
{ "resource": "" }
q30965
InvalidContentType
train
func InvalidContentType(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: MalformedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusUnsupportedMediaType, } }
go
{ "resource": "" }
q30966
InvalidEmail
train
func InvalidEmail(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: InvalidEmailProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30967
ConnectionFailure
train
func ConnectionFailure(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: ConnectionProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30968
UnknownHost
train
func UnknownHost(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: UnknownHostProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30969
RateLimited
train
func RateLimited(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: RateLimitedProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: statusTooManyRequests, } }
go
{ "resource": "" }
q30970
TLSError
train
func TLSError(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: TLSProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30971
AccountDoesNotExist
train
func AccountDoesNotExist(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: AccountDoesNotExistProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30972
CAA
train
func CAA(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: CAAProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusForbidden, } }
go
{ "resource": "" }
q30973
DNS
train
func DNS(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: DNSProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusBadRequest, } }
go
{ "resource": "" }
q30974
OrderNotReady
train
func OrderNotReady(detail string, a ...interface{}) *ProblemDetails { return &ProblemDetails{ Type: OrderNotReadyProblem, Detail: fmt.Sprintf(detail, a...), HTTPStatus: http.StatusForbidden, } }
go
{ "resource": "" }
q30975
IssueCertificate
train
func (ca *MockCA) IssueCertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (core.Certificate, error) { if ca.PEM == nil { return core.Certificate{}, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate") } block, _ := pem.Decode(ca.PEM) cert, err := x509.ParseCertificate(block....
go
{ "resource": "" }
q30976
IssuePrecertificate
train
func (ca *MockCA) IssuePrecertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (*caPB.IssuePrecertificateResponse, error) { if ca.PEM == nil { return nil, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate") } block, _ := pem.Decode(ca.PEM) cert, err := x509.ParseCertificate(b...
go
{ "resource": "" }
q30977
IssueCertificateForPrecertificate
train
func (ca *MockCA) IssueCertificateForPrecertificate(ctx context.Context, req *caPB.IssueCertificateForPrecertificateRequest) (core.Certificate, error) { return core.Certificate{DER: req.DER}, nil }
go
{ "resource": "" }
q30978
GenerateOCSP
train
func (ca *MockCA) GenerateOCSP(ctx context.Context, xferObj core.OCSPSigningRequest) (ocsp []byte, err error) { return }
go
{ "resource": "" }
q30979
tlsDial
train
func (va *ValidationAuthorityImpl) tlsDial(ctx context.Context, hostPort string, config *tls.Config) (*tls.Conn, error) { ctx, cancel := context.WithTimeout(ctx, va.singleDialTimeout) defer cancel() dialer := &net.Dialer{} netConn, err := dialer.DialContext(ctx, "tcp", hostPort) if err != nil { return nil, err ...
go
{ "resource": "" }
q30980
NewValidationAuthorityImpl
train
func NewValidationAuthorityImpl( pc *cmd.PortConfig, resolver bdns.DNSClient, remoteVAs []RemoteVA, maxRemoteFailures int, userAgent string, issuerDomain string, stats metrics.Scope, clk clock.Clock, logger blog.Logger, accountURIPrefixes []string, ) (*ValidationAuthorityImpl, error) { if pc.HTTPPort == 0 { ...
go
{ "resource": "" }
q30981
detailedError
train
func detailedError(err error) *probs.ProblemDetails { // net/http wraps net.OpError in a url.Error. Unwrap them. if urlErr, ok := err.(*url.Error); ok { prob := detailedError(urlErr.Err) prob.Detail = fmt.Sprintf("Fetching %s: %s", urlErr.URL, prob.Detail) return prob } if tlsErr, ok := err.(tls.RecordHeader...
go
{ "resource": "" }
q30982
validate
train
func (va *ValidationAuthorityImpl) validate( ctx context.Context, identifier core.AcmeIdentifier, challenge core.Challenge, authz core.Authorization, ) ([]core.ValidationRecord, *probs.ProblemDetails) { // If the identifier is a wildcard domain we need to validate the base // domain by removing the "*." wildcard...
go
{ "resource": "" }
q30983
processRemoteResults
train
func (va *ValidationAuthorityImpl) processRemoteResults( domain string, challengeType string, primaryResult *probs.ProblemDetails, remoteErrors chan *probs.ProblemDetails, numRemoteVAs int) *probs.ProblemDetails { state := "failure" start := va.clk.Now() defer func() { va.metrics.remoteValidationTime.With(p...
go
{ "resource": "" }
q30984
logRemoteValidationDifferentials
train
func (va *ValidationAuthorityImpl) logRemoteValidationDifferentials( domain string, primaryResult *probs.ProblemDetails, remoteProbs []*probs.ProblemDetails) { var successes []*probs.ProblemDetails var failures []*probs.ProblemDetails allEqual := true for _, e := range remoteProbs { if e != primaryResult { ...
go
{ "resource": "" }
q30985
New
train
func New(errType ErrorType, msg string, args ...interface{}) error { return &BoulderError{ Type: errType, Detail: fmt.Sprintf(msg, args...), } }
go
{ "resource": "" }
q30986
Is
train
func Is(err error, errType ErrorType) bool { bErr, ok := err.(*BoulderError) if !ok { return false } return bErr.Type == errType }
go
{ "resource": "" }
q30987
New
train
func New(filename string, dataCallback func([]byte) error, errorCallback func(error)) (*Reloader, error) { if errorCallback == nil { errorCallback = func(e error) {} } fileInfo, err := os.Stat(filename) if err != nil { return nil, err } b, err := readFile(filename) if err != nil { return nil, err } stopC...
go
{ "resource": "" }
q30988
availableAddresses
train
func availableAddresses(allAddrs []net.IP) (v4 []net.IP, v6 []net.IP) { for _, addr := range allAddrs { if addr.To4() != nil { v4 = append(v4, addr) } else { v6 = append(v6, addr) } } return }
go
{ "resource": "" }
q30989
loadCertificateFile
train
func loadCertificateFile(aiaIssuerURL, certFile string) ([]byte, error) { pemBytes, err := ioutil.ReadFile(certFile) if err != nil { return nil, fmt.Errorf( "CertificateChain entry for AIA issuer url %q has an "+ "invalid chain file: %q - error reading contents: %s", aiaIssuerURL, certFile, err) } if by...
go
{ "resource": "" }
q30990
loadCertificateChains
train
func loadCertificateChains(chainConfig map[string][]string) (map[string][]byte, error) { results := make(map[string][]byte, len(chainConfig)) // For each AIA Issuer URL we need to read the chain cert files for aiaIssuerURL, certFiles := range chainConfig { var buffer bytes.Buffer // There must be at least one ...
go
{ "resource": "" }
q30991
NewMockPublisher
train
func NewMockPublisher(ctrl *gomock.Controller) *MockPublisher { mock := &MockPublisher{ctrl: ctrl} mock.recorder = &MockPublisherMockRecorder{mock} return mock }
go
{ "resource": "" }
q30992
SubmitToSingleCTWithResult
train
func (m *MockPublisher) SubmitToSingleCTWithResult(arg0 context.Context, arg1 *proto.Request) (*proto.Result, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SubmitToSingleCTWithResult", arg0, arg1) ret0, _ := ret[0].(*proto.Result) ret1, _ := ret[1].(error) return ret0, ret1 }
go
{ "resource": "" }
q30993
SubmitToSingleCTWithResult
train
func (mr *MockPublisherMockRecorder) SubmitToSingleCTWithResult(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitToSingleCTWithResult", reflect.TypeOf((*MockPublisher)(nil).SubmitToSingleCTWithResult), arg0, arg1) }
go
{ "resource": "" }
q30994
NewSQLStorageAuthority
train
func NewSQLStorageAuthority( dbMap *gorp.DbMap, clk clock.Clock, logger blog.Logger, scope metrics.Scope, parallelismPerRPC int, ) (*SQLStorageAuthority, error) { SetSQLDebug(dbMap, logger) ssa := &SQLStorageAuthority{ dbMap: dbMap, clk: clk, log: logger, parallel...
go
{ "resource": "" }
q30995
GetRegistration
train
func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error) { const query = "WHERE id = ?" model, err := selectRegistration(ssa.dbMap.WithContext(ctx), query, id) if err == sql.ErrNoRows { return core.Registration{}, berrors.NotFoundError("registration with ID '%d' not...
go
{ "resource": "" }
q30996
GetRegistrationByKey
train
func (ssa *SQLStorageAuthority) GetRegistrationByKey(ctx context.Context, key *jose.JSONWebKey) (core.Registration, error) { const query = "WHERE jwk_sha256 = ?" if key == nil { return core.Registration{}, fmt.Errorf("key argument to GetRegistrationByKey must not be nil") } sha, err := core.KeyDigest(key.Key) if...
go
{ "resource": "" }
q30997
GetAuthorization
train
func (ssa *SQLStorageAuthority) GetAuthorization(ctx context.Context, id string) (core.Authorization, error) { authz := core.Authorization{} tx, err := ssa.dbMap.Begin() if err != nil { return authz, err } txWithCtx := tx.WithContext(ctx) pa, err := selectPendingAuthz(txWithCtx, "WHERE id = ?", id) if err != ...
go
{ "resource": "" }
q30998
GetValidAuthorizations
train
func (ssa *SQLStorageAuthority) GetValidAuthorizations( ctx context.Context, registrationID int64, names []string, now time.Time) (map[string]*core.Authorization, error) { return ssa.getAuthorizations( ctx, authorizationTable, string(core.StatusValid), registrationID, names, now, false) }
go
{ "resource": "" }
q30999
incrementIP
train
func incrementIP(ip net.IP, index int) net.IP { bigInt := new(big.Int) bigInt.SetBytes([]byte(ip)) incr := new(big.Int).Lsh(big.NewInt(1), 128-uint(index)) bigInt.Add(bigInt, incr) // bigInt.Bytes can be shorter than 16 bytes, so stick it into a // full-sized net.IP. resultBytes := bigInt.Bytes() if len(resultB...
go
{ "resource": "" }