id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c173200
if x, ok := key.(interface { Public() crypto.PublicKey }); ok { ks.PubKey = x.Public() } return ks.PubKey, ks.PubKey != nil } return nil, false }
c173201
defer ks.rw.RUnlock() return ks.Key, ks.Key != nil }
c173202
nil { t.loc = make(map[string]string) } if _, exists := t.loc[loc]; exists { panic("location " + loc + " already registered") } t.loc[loc] = path }
c173203
pointer. out := &Arena{ n: 1, buf: make([]byte, size), } return out }
c173204
headOffset := arena.GetPointerOffset(unsafe.Pointer(head)) tailOffset := arena.GetPointerOffset(unsafe.Pointer(tail)) for i := 0; i < maxHeight; i++ { head.tower[i].nextOffset = tailOffset tail.tower[i].prevOffset = headOffset } skl := &Skiplist{ arena: arena, head: head, tail: tail, height: 1, } return skl }
c173205
= list.arena it.nd = nil it.value = 0 }
c173206
it.arena.GetBytes(valOffset, uint32(valSize)) }
c173207
:= it.list.allocVal(val, meta) if err != nil { return err } return it.trySetValue(new) }
c173208
the interim. if meta > decodeMeta(it.value) { valOffset, valSize := decodeValue(it.value) new := encodeValue(valOffset, valSize, meta) return it.trySetValue(new) } return it.Set(it.Value(), meta) }
c173209
// Deletion succeeded, so position iterator on next non-deleted node. next := it.list.getNext(it.nd, 0) it.setNode(next, false) return nil }
c173210
return &val1[0] == &val2[0] } return false }
c173211
:= x509.SystemCertPool() if err != nil { return nil, errSysCerts } c.http.Transport = &http.Transport{ TLSClientConfig: &tls.Config{ RootCAs: pool, InsecureSkipVerify: opts.Insecure, }, } } if opts.ShowHTTP { c.showHTTP = true } c.debug = debug return c, nil }
c173212
err != nil { return err } if !s.Scan() { break } l = s.Text() if _, err := fmt.Fprint(w, "\n"); err != nil { return err } } return nil }
c173213
return WriteIndentedN(w, b, 4) }
c173214
r.reports = make(chan *statReport, bufferSize) r.done = make(chan bool) r.wg = new(sync.WaitGroup) for i := 0; i < poolSize; i++ { r.wg.Add(1) go r.processReports() } return r }
c173215
DefaultReporter.PostCount(statKey, userKey, count) }
c173216
return DefaultReporter.PostCountTime(statKey, userKey, count, timestamp) }
c173217
DefaultReporter.PostValue(statKey, userKey, value) }
c173218
return DefaultReporter.PostValueTime(statKey, userKey, value, timestamp) }
c173219
DefaultReporter.PostEZCount(statName, ezkey, count) }
c173220
return DefaultReporter.PostEZCountTime(statName, ezkey, count, timestamp) }
c173221
DefaultReporter.PostEZValue(statName, ezkey, value) }
c173222
return DefaultReporter.PostEZValueTime(statName, ezkey, value, timestamp) }
c173223
r.add(newClassicStatCount(statKey, userKey, count)) return nil }
c173224
int64) error { x := newClassicStatCount(statKey, userKey, count) x.Timestamp = timestamp r.add(x) return nil }
c173225
return r.PostCount(statKey, userKey, 1) }
c173226
r.add(newClassicStatValue(statKey, userKey, value)) return nil }
c173227
int64) error { x := newClassicStatValue(statKey, userKey, value) x.Timestamp = timestamp r.add(x) return nil }
c173228
return r.PostEZCount(statName, ezkey, 1) }
c173229
r.add(newEZStatCount(statName, ezkey, count)) return nil }
c173230
int64) error { x := newEZStatCount(statName, ezkey, count) x.Timestamp = timestamp r.add(x) return nil }
c173231
r.add(newEZStatValue(statName, ezkey, value)) return nil }
c173232
timestamp int64) error { x := newEZStatValue(statName, ezkey, value) x.Timestamp = timestamp r.add(x) return nil }
c173233
make(map[string]*statCache), shutdownBatchCh: make(chan struct{}), } go br.batchLoop() return br }
c173234
hostname := range host.Hostnames.Hostnames { output.Hostnames = append(output.Hostnames, Hostname{hostname.Name, hostname.Type}) } for _, port := range host.Ports.Ports { output.Ports = append(output.Ports, port.cleanPort()) } return output }
c173235
range host.Hostnames { if hostname.Name == hostTarget { return host, true } } } return Host{}, false }
c173236
AddUDPPorts(h.parentScan.configUDPPorts...). AddHosts(h.Address). AddFlags(h.parentScan.configOpts...) }
c173237
} } removedWithClosed := array.Except(targetPorts, altPorts).([]Port) for _, remove := range removedWithClosed { if remove.State != "closed" { removed = append(removed, remove) } } return }
c173238
%s/%s\n", hostname.Name, hostname.Type) } } if len(h.Ports) != 0 { out += "Ports:\n" for _, port := range h.Ports { for _, line := range strings.Split(port.ToString(), "\n") { if line != "" { out += fmt.Sprintf(" %s\n", line) } } } } return }
c173239
make(map[string]Host, 0) return scan }
c173240
append(s.configHosts, hosts...) return s }
c173241
Scan { s.configHosts = hosts return s }
c173242
append(s.configPorts, ports...) return s }
c173243
Scan { s.configPorts = ports return s }
c173244
Scan { s.configTCPPorts = ports return s }
c173245
Scan { s.configUDPPorts = ports return s }
c173246
spaces in them") return s } for _, df := range DisallowedFlags { if flag == df { s.configErr = &DisallowedFlagError{df} return s } } } s.configOpts = append(s.configOpts, flags...) return s }
c173247
SetPorts(). SetUDPPorts(). SetTCPPorts(). AddPortRange(1, 65535) }
c173248
:= range s.Hosts { out += fmt.Sprintf("%s\n", host.ToString()) } return }
c173249
0 { s.configOpts = append(s.configOpts, tcpOptions[1]) } // Check UDP flag if len(s.configUDPPorts) != 0 && !array.In("-sU", s.configOpts) { s.configOpts = append(s.configOpts, "-sU") } // Append arguments args = append(args, s.configOpts...) // Append port list if portList != "" { args = append(args, "-p"+portList) } // Append hosts if len(s.configHosts) == 0 { s.configErr = errors.New("No hosts added") } args = append(args, s.configHosts...) fmt.Println(args) return args, nil }
c173250
o = append(o, strconv.FormatUint(uint64(s), 10)) } return }
c173251
output += fmt.Sprintf(" %s\n", line) } out += fmt.Sprintf(" Script: %s\n%s\n", script.Name, output) } return }
c173252
:= binary.BigEndian.Uint64(otp.counter[:]) return counter }
c173253
otp.counter[i] != 0 { return } } }
c173254
= new([ctrSize]byte) binary.BigEndian.PutUint64(otp.counter[:], counter) return otp }
c173255
u.Scheme = "otpauth" u.Host = "hotp" u.Path = label v.Add("secret", secret) v.Add("counter", fmt.Sprintf("%d", otp.Counter())) u.RawQuery = v.Encode() return u.String() }
c173256
!= nil { return nil, err } return code.PNG(), nil }
c173257
int32((p[0] & 0x7f)) << 24 binCode += int32((p[1] & 0xff)) << 16 binCode += int32((p[2] & 0xff)) << 8 binCode += int32((p[3] & 0xff)) return int64(binCode) & 0x7FFFFFFF }
c173258
secret, err := base32.StdEncoding.DecodeString(v.Get("secret")) if err != nil { return nil, "", ErrInvalidHOTPURL } var digits int64 = 6 if v.Get("digits") != "" { digits, err = strconv.ParseInt(v.Get("digits"), 10, 8) if err != nil { return nil, "", ErrInvalidHOTPURL } } otp := NewHOTP(secret, counter, int(digits)) return otp, identity, nil }
c173259
rand.Int(PRNG, big.NewInt(int64(math.MaxInt64))) if err != nil { return nil, err } counter = ctr.Uint64() } return NewHOTP(key, counter, digits), nil }
c173260
"", "", false } otpStart := len(in) - otp.Digits code := in[otpStart:] pubid := in[:otpStart] return code, pubid, true }
c173261
mod = mod.Mod(big.NewInt(result), mod) fmtStr := fmt.Sprintf("%%0%dd", otp.Digits) return fmt.Sprintf(fmtStr, mod.Uint64()), otp.Counter() }
c173262
if subtle.ConstantTimeCompare(codeBytes, genCode) != 1 { otp.setCounter(otp.Counter() - 1) return false } return true }
c173263
asnHOTP.Counter = new(big.Int).SetUint64(otp.Counter()) asnHOTP.Digits = otp.Digits return asn1.Marshal(asnHOTP) }
c173264
otp = &HOTP{ Key: asnHOTP.Key[:], Digits: asnHOTP.Digits, } otp.setCounter(asnHOTP.Counter.Uint64()) return }
c173265
maxBurst, givenOut: make(map[ThrottlerWriter]struct{}), } }
c173266
// make the initial rate be 0, the actual rate is // set in the call to `setSharedRates`. wr := ThrottledWriter(w, 0, pool.maxBurst) pool.mu.Lock() pool.givenOut[wr] = struct{}{} pool.setSharedRates() pool.mu.Unlock() return wr, func() { pool.mu.Lock() delete(pool.givenOut, wr) pool.setSharedRates() pool.mu.Unlock() } }
c173267
l := len(pool.givenOut) pool.mu.Unlock() return l }
c173268
maxBurst, givenOut: make(map[ThrottlerReader]struct{}), } }
c173269
// make the initial rate be 0, the actual rate is // set in the call to `setSharedRates`. rd := ThrottledReader(r, 0, pool.maxBurst) pool.mu.Lock() pool.givenOut[rd] = struct{}{} pool.setSharedRates() pool.mu.Unlock() return rd, func() { pool.mu.Lock() delete(pool.givenOut, rd) pool.setSharedRates() pool.mu.Unlock() } }
c173270
old := pool.maxRate pool.maxRate = rate pool.setSharedRates() pool.mu.Unlock() return old }
c173271
pool.mu.Unlock() return len(pool.givenOut) }
c173272
{ return &MeasuredWriter{wrap: w, rate: newCounter()} }
c173273
uint64(m.rate.Rate(time.Second)) }
c173274
{ return &MeasuredReader{wrap: r, rate: newCounter()} }
c173275
return uint64(m.rate.Rate(perPeriod)) }
c173276
uint64(m.rate.Rate(time.Second)) }
c173277
r, limiter: newRateLimiter(bytesPerSec, maxBurst), } }
c173278
w, limiter: newRateLimiter(bytesPerSec, maxBurst), } }
c173279
map[string][]SRVRecord{}, aMutex: sync.RWMutex{}, srvMutex: sync.RWMutex{}, } }
c173280
fmt.Sprintf("_%s._%s.%s", service, protocol, ds.Domain) }
c173281
srv := range srvs { newsrvs = append(newsrvs, SRVRecord{ Host: ds.qualifyHost(srv.Host), Port: srv.Port, }) } return newsrvs }
c173282
Hdr: dns.RR_Header{ Name: fqdn, Rrtype: dns.TypeA, Class: dns.ClassINET, // 0 TTL results in UB for DNS resolvers and generally causes problems. Ttl: 1, }, A: val, } } return nil }
c173283
ds.aRecords[ds.qualifyHost(host)] = ip ds.aMutex.Unlock() }
c173284
ds.qualifyHost(host)) ds.aMutex.Unlock() }
c173285
protocol)] = ds.qualifySrvHosts(srvs) ds.srvMutex.Unlock() }
c173286
ds.qualifySrv(service, protocol)) ds.srvMutex.Unlock() }
c173287
err := json.Unmarshal(data, &m) return Typed(m), err }
c173288
if err := json.Unmarshal(data, &m); err != nil { panic(err) } return Typed(m) }
c173289
:= ioutil.ReadAll(reader); err != nil { return nil, err } else { return Json(data) } }
c173290
ioutil.ReadFile(path) if err != nil { return nil, err } return Json(data) }
c173291
return nil, nil } typed := make([]Typed, l) for i := 0; i < l; i++ { value := m[i] if t, ok := value.(map[string]interface{}); ok { typed[i] = t } else { typed[i] = map[string]interface{}{"0": value} } } return typed, nil }
c173292
return nil, err } return JsonArray(data) }
c173293
t.BoolOr(key, false) }
c173294
t.BoolIf(key); exists { return value } return d }
c173295
if exists == false { panic("expected boolean value for " + key) } return b }
c173296
false { return false, false } if n, ok := value.(bool); ok { return n, true } return false, false }
c173297
exists { return value } return d }
c173298
if exists == false { panic("expected int value for " + key) } return i }
c173299
case int64: return int(t), true case float64: return int(t), true case string: i, err := strconv.Atoi(t) return i, err == nil } return 0, false }