text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (iter *CdbIterator) NextReader() (*io.SectionReader, error) {
if err := iter.next(); err != nil {
return nil, err
}
return io.NewSectionReader(iter.db.r, int64(iter.dpos), int64(iter.dlen)), nil
} | [
-0.45636042952537537,
-0.25069087743759155,
0.1295129358768463,
-0.1598227620124817,
-0.7988432049751282,
0.43143242597579956,
-0.3496139645576477,
-0.7129191756248474,
-0.4573124647140503,
0.06523013114929199,
1.010727882385254,
-0.22654442489147186,
-0.012130450457334518,
0.7591227889060... |
func (iter *CdbIterator) next() error {
if iter.initErr != nil {
return iter.initErr
}
var err error
var khash, recPos uint32
// Iterate through all of the hash slots until we find our key.
for {
// If we have seen every hash slot, we are done.
if iter.loop >= iter.hslots {
return io.EOF
}
khash, rec... | [
0.23261527717113495,
0.33147329092025757,
0.6310390830039978,
0.2445521056652069,
-1.0012669563293457,
-0.13777635991573334,
-0.09770520776510239,
-0.11439985036849976,
-0.8881407976150513,
0.15929801762104034,
0.5616797804832458,
-0.07394196093082428,
-0.2735309600830078,
0.33765146136283... |
func (c *Cdb) ForEachReader(onRecordFn func(keyReader, valReader *io.SectionReader) error) error {
buf := make([]byte, 8)
// The start is the first record after the header.
pos := headerSize
// The end is the start of the first hash table.
end, _, err := readNums(c.r, buf, 0)
if err != nil {
return err
}
for ... | [
0.10941360145807266,
-0.35313302278518677,
0.6513464450836182,
-0.12181305885314941,
-0.3070526123046875,
-0.5300139784812927,
0.6321540474891663,
-0.25760528445243835,
-0.917243480682373,
0.27384328842163086,
0.5151808261871338,
0.016952771693468094,
0.4014092981815338,
0.899691641330719,... |
func (c *Cdb) ForEachBytes(onRecordFn func(key, val []byte) error) error {
var kbuf, dbuf []byte
return c.ForEachReader(func(keyReader, valReader *io.SectionReader) error {
// Correctly size the buffers.
klen, dlen := keyReader.Size(), valReader.Size()
if int64(cap(kbuf)) < klen {
kbuf = make([]byte, klen)
... | [
0.1343090832233429,
0.4054792523384094,
0.506382942199707,
-0.20660604536533356,
-0.016217900440096855,
-0.44663968682289124,
0.08882807195186615,
-0.3035268783569336,
-0.7987152934074402,
0.3336954712867737,
0.4217391014099121,
0.33077654242515564,
0.12164627015590668,
1.1085582971572876,... |
func match(r io.ReaderAt, buf []byte, key []byte, pos uint32) (bool, error) {
klen := len(key)
for n := 0; n < klen; n += len(buf) {
nleft := klen - n
if len(buf) > nleft {
buf = buf[:nleft]
}
if _, err := r.ReadAt(buf, int64(pos)); err != nil {
return false, err
}
if !bytes.Equal(buf, key[n:n+len(b... | [
0.15936781466007233,
-0.527684211730957,
0.7380924820899963,
-0.42106887698173523,
-1.0127359628677368,
0.23333632946014404,
-0.7928306460380554,
-0.1560424417257309,
-0.9672425985336304,
0.49108633399009705,
-0.6313208341598511,
-0.9731783270835876,
-0.8739984631538391,
-0.288607716560363... |
func (c *Config) configureTLS(t *TLSConfig) error {
if c.HttpClient == nil {
c.HttpClient = DefaultConfig().HttpClient
}
clientTLSConfig := c.HttpClient.Transport.(*http.Transport).TLSClientConfig
var clientCert tls.Certificate
foundClientCert := false
switch {
case t.ClientCert != "" && t.ClientKey != "":
... | [
0.45376643538475037,
-0.27414560317993164,
0.6977509260177612,
-0.2240046262741089,
-0.6642573475837708,
-0.5098252296447754,
-0.2990935444831848,
-0.2382514327764511,
-0.0793902575969696,
0.16552984714508057,
-0.4886024296283722,
-0.11827898770570755,
0.032273244112730026,
0.3946003317832... |
func (c *Config) ConfigureTLS(t *TLSConfig) error {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
return c.configureTLS(t)
} | [
-0.4972953498363495,
0.6465057134628296,
0.18755315244197845,
-0.39915263652801514,
-0.19964048266410828,
-0.477158784866333,
-0.2707286477088928,
0.14206784963607788,
0.012607604265213013,
0.4440101683139801,
-1.2345805168151855,
-1.0721968412399292,
0.5057730078697205,
0.1935562044382095... |
func (c *Config) ReadEnvironment() error {
var envAddress string
var envAgentAddress string
var envCACert string
var envCACertBytes []byte
var envCAPath string
var envClientCert string
var envClientKey string
var envClientTimeout time.Duration
var envInsecure bool
var envTLSServerName string
var envMaxRetrie... | [
0.24573366343975067,
-0.5146642923355103,
0.8458587527275085,
-0.20972037315368652,
0.1297328621149063,
0.0617230087518692,
-0.02831459976732731,
-0.2254067361354828,
-0.5876246094703674,
0.6743940114974976,
-0.05669970437884331,
0.37265312671661377,
0.033710453659296036,
0.351121991872787... |
func (c *Config) ParseAddress(address string) (*url.URL, error) {
u, err := url.Parse(address)
if err != nil {
return nil, err
}
c.Address = address
if strings.HasPrefix(address, "unix://") {
// When the address begins with unix://, always change the transport's
// DialContext (to match previous behaviour)... | [
-0.48958611488342285,
0.061004288494586945,
0.8480020761489868,
-0.13120003044605255,
-0.26367196440696716,
-0.09847001731395721,
0.34418123960494995,
0.7230485677719116,
0.8946366906166077,
-0.11648247390985489,
-0.017111727967858315,
1.2911887168884277,
-0.09865881502628326,
0.2452366650... |
func NewClient(c *Config) (*Client, error) {
def := DefaultConfig()
if def == nil {
return nil, fmt.Errorf("could not create/read default configuration")
}
if def.Error != nil {
return nil, errwrap.Wrapf("error encountered setting up default configuration: {{err}}", def.Error)
}
if c == nil {
c = def
}
... | [
0.597464919090271,
-0.1795673817396164,
0.661474883556366,
0.39132896065711975,
-0.5060726404190063,
-0.19657191634178162,
0.06503654271364212,
-0.6942867636680603,
0.16046062111854553,
0.5308711528778076,
0.06463200598955154,
0.4351855516433716,
-0.23729193210601807,
-0.637703537940979,
... |
func (c *Client) SetAddress(addr string) error {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
parsedAddr, err := c.config.ParseAddress(addr)
if err != nil {
return errwrap.Wrapf("failed to set address: {{err}}", err)
}
c.addr = parsedAddr
return nil
} | [
-0.6715584397315979,
-0.30266520380973816,
0.22401268780231476,
-0.05956818163394928,
-0.30471673607826233,
0.685116171836853,
0.046954814344644547,
0.4902477562427521,
0.8642533421516418,
0.03887927159667015,
-0.3030463457107544,
1.1095011234283447,
-0.6505948305130005,
0.5561286807060242... |
func (c *Client) Address() string {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
return c.addr.String()
} | [
-0.714480459690094,
-1.2672232389450073,
0.49913862347602844,
-0.06886324286460876,
-0.4028255045413971,
1.281577229499817,
0.3825418949127197,
-0.1819954812526703,
0.6280677318572998,
0.13041847944259644,
1.0365911722183228,
0.5394946932792664,
-1.2227585315704346,
0.10370674729347229,
... |
func (c *Client) SetLimiter(rateLimit float64, burst int) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.Limiter = rate.NewLimiter(rate.Limit(rateLimit), burst)
} | [
-0.45117631554603577,
0.33586570620536804,
0.5604709386825562,
0.5468152165412903,
-0.3766093850135803,
0.5585469603538513,
-0.26029619574546814,
-0.039584483951330185,
-0.24459807574748993,
-0.017033681273460388,
-0.8542308211326599,
0.5152612328529358,
-0.9608963131904602,
0.465955108404... |
func (c *Client) SetMinRetryWait(retryWait time.Duration) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.MinRetryWait = retryWait
} | [
0.2378169596195221,
-0.7855274081230164,
0.2690476179122925,
0.06897756457328796,
-0.041193488985300064,
0.8167827725410461,
0.03518550470471382,
-0.2445978969335556,
0.040242090821266174,
-0.7017367482185364,
-0.5750759243965149,
0.6481751799583435,
-0.9890041947364807,
0.6031860709190369... |
func (c *Client) SetMaxRetryWait(retryWait time.Duration) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.MaxRetryWait = retryWait
} | [
-0.095435231924057,
-0.4147101938724518,
0.24733002483844757,
0.43717554211616516,
0.08725841343402863,
0.8295960426330566,
-0.3372422158718109,
0.6160892248153687,
-0.06781837344169617,
-0.5105307102203369,
-0.7596451640129089,
0.532120943069458,
-0.4259475767612457,
0.8110878467559814,
... |
func (c *Client) SetMaxRetries(retries int) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.MaxRetries = retries
} | [
-0.29944634437561035,
0.30787670612335205,
0.14777705073356628,
0.2651143968105316,
0.2950139045715332,
0.48840096592903137,
-0.20002318918704987,
0.275145947933197,
0.21263690292835236,
-0.2491694539785385,
-0.6929056644439697,
0.681439995765686,
-0.9221261739730835,
0.4221828877925873,
... |
func (c *Client) SetCheckRetry(checkRetry retryablehttp.CheckRetry) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.CheckRetry = checkRetry
} | [
-0.260765016078949,
-0.47834616899490356,
0.3004223108291626,
0.788726270198822,
0.9849619269371033,
0.06537105143070221,
0.22245001792907715,
-0.5753076076507568,
-0.3407210111618042,
0.12607839703559875,
-0.7512938380241394,
0.05906952917575836,
-0.9633417129516602,
0.8051818013191223,
... |
func (c *Client) SetClientTimeout(timeout time.Duration) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.Timeout = timeout
} | [
0.11059881001710892,
0.04804050177335739,
-0.008423672057688236,
-0.310344934463501,
0.24310703575611115,
0.15848985314369202,
0.7839416265487671,
0.2526918053627014,
-0.4372434914112091,
0.5552170872688293,
-0.870283305644989,
0.8188750743865967,
-0.3969278633594513,
0.4182540774345398,
... |
func (c *Client) CurrentWrappingLookupFunc() WrappingLookupFunc {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
return c.wrappingLookupFunc
} | [
-1.071803092956543,
-1.178802490234375,
0.2306302785873413,
-0.5189562439918518,
-0.5734068155288696,
0.21313194930553436,
1.107189655303955,
-0.16501949727535248,
0.06120150536298752,
-0.05177493393421173,
1.2594126462936401,
0.45524731278419495,
0.24375441670417786,
-1.2656404972076416,
... |
func (c *Client) SetWrappingLookupFunc(lookupFunc WrappingLookupFunc) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.wrappingLookupFunc = lookupFunc
} | [
-0.7127875685691833,
-0.3792226314544678,
0.25737255811691284,
-0.5935956239700317,
-0.4616653025150299,
0.34944474697113037,
1.037810206413269,
0.2697509527206421,
0.15375688672065735,
0.05941637605428696,
0.21459609270095825,
0.41047120094299316,
0.5730074048042297,
-1.253177285194397,
... |
func (c *Client) SetMFACreds(creds []string) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.mfaCreds = creds
} | [
-0.5592612624168396,
-0.06956146657466888,
0.294302374124527,
0.48020049929618835,
-0.40585801005363464,
0.3552785813808441,
-0.6187657713890076,
0.027791770175099373,
-0.21243572235107422,
-0.6067350506782532,
-0.5703578591346741,
1.0197958946228027,
-1.1123664379119873,
0.960365891456604... |
func (c *Client) SetNamespace(namespace string) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.setNamespace(namespace)
} | [
-1.188584566116333,
0.30956485867500305,
0.14743900299072266,
0.327607125043869,
-0.130638986825943,
-0.09799914062023163,
-0.21997475624084473,
-1.09687077999115,
1.2869579792022705,
-0.6114933490753174,
-0.6473291516304016,
0.7834891676902771,
-1.4837604761123657,
0.413383424282074,
0.... |
func (c *Client) ClearNamespace() {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
if c.headers != nil {
c.headers.Del(NamespaceHeaderName)
}
} | [
-0.454723060131073,
-0.15850278735160828,
0.42118972539901733,
-0.44215354323387146,
-0.42198994755744934,
-0.3859407603740692,
-1.0572532415390015,
-2.103586196899414,
1.1873738765716553,
0.07286398857831955,
0.11499056220054626,
0.8397324085235596,
-0.7801827788352966,
0.4777123928070068... |
func (c *Client) Namespace() string {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
if c.headers == nil {
return ""
}
return c.headers.Get(NamespaceHeaderName)
} | [
0.1258491575717926,
-0.5435295104980469,
0.3364918529987335,
0.3679168224334717,
-0.30378127098083496,
-0.4693003296852112,
-0.5088356733322144,
-1.8881994485855103,
0.9031088948249817,
-0.6400387287139893,
0.6864383220672607,
0.4621720314025879,
-1.159003734588623,
-0.47785481810569763,
... |
func (c *Client) WithNamespace(namespace string) *Client {
c2 := *c
c2.modifyLock = sync.RWMutex{}
c2.headers = c.Headers()
if namespace == "" {
c2.ClearNamespace()
} else {
c2.SetNamespace(namespace)
}
return &c2
} | [
-0.2735463082790375,
-0.5292806625366211,
0.4022406339645386,
-0.585960328578949,
-0.7686286568641663,
-0.8152745366096497,
-0.5552147030830383,
-1.8419876098632812,
1.5372384786605835,
-0.6239981651306152,
0.18764418363571167,
0.36158183217048645,
-0.663528561592102,
-0.10438661277294159,... |
func (c *Client) Token() string {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
return c.token
} | [
-0.6997748613357544,
-0.4846319258213043,
0.046621233224868774,
0.21223211288452148,
-0.36509090662002563,
0.27331387996673584,
1.1519908905029297,
0.12264957278966904,
-0.28882521390914917,
-1.2963552474975586,
-0.2064962089061737,
0.5315142869949341,
-0.5552231073379517,
-0.7368043661117... |
func (c *Client) SetToken(v string) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.token = v
} | [
-0.17280983924865723,
0.13873492181301117,
-0.0903414860367775,
0.4183526337146759,
-0.15485282242298126,
0.1675729602575302,
0.8096013069152832,
0.6804365515708923,
-0.28502312302589417,
-0.846068263053894,
-1.1061831712722778,
1.237937092781067,
-0.643287181854248,
0.042390335351228714,
... |
func (c *Client) ClearToken() {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.token = ""
} | [
-0.1064857468008995,
0.2260001301765442,
0.08925511687994003,
-0.22969770431518555,
0.029424304142594337,
0.11998818069696426,
0.031750068068504333,
0.46832919120788574,
-0.45551952719688416,
-0.30076703429222107,
-0.1774572879076004,
2.080528497695923,
-0.3935602307319641,
-0.308542072772... |
func (c *Client) Headers() http.Header {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
if c.headers == nil {
return nil
}
ret := make(http.Header)
for k, v := range c.headers {
for _, val := range v {
ret[k] = append(ret[k], val)
}
}
return ret
} | [
-0.8738136291503906,
-0.26409050822257996,
0.20988453924655914,
0.10528884828090668,
0.11064855754375458,
-0.4672508239746094,
-0.7058968544006348,
-1.3128771781921387,
-0.3616516888141632,
-0.7359715700149536,
0.1171838641166687,
0.12411315739154816,
-0.9321850538253784,
-0.24890755116939... |
func (c *Client) AddHeader(key, value string) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.headers.Add(key, value)
} | [
-0.8169021606445312,
0.06976793706417084,
0.45686662197113037,
0.3581295609474182,
-0.32044118642807007,
0.7080933451652527,
-1.0034785270690918,
-0.6848222017288208,
-0.24840256571769714,
-0.5302708148956299,
0.5340555906295776,
0.317182719707489,
-1.1820381879806519,
0.09477421641349792,... |
func (c *Client) SetHeaders(headers http.Header) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.headers = headers
} | [
-0.8887828588485718,
0.12652625143527985,
0.09791755676269531,
0.25524818897247314,
0.21809127926826477,
-0.09907280653715134,
-0.5177043080329895,
-0.5596094131469727,
-0.16957657039165497,
-0.3757140040397644,
-0.6909853219985962,
0.5474233031272888,
-1.5067874193191528,
-0.4392058253288... |
func (c *Client) SetBackoff(backoff retryablehttp.Backoff) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.Backoff = backoff
} | [
-0.05256682261824608,
0.11550018191337585,
0.26094338297843933,
0.6548574566841125,
0.41580823063850403,
0.88336181640625,
0.5008505582809448,
0.7202504277229309,
-0.08006592094898224,
0.004738376475870609,
-0.7389963865280151,
0.35609546303749084,
-0.9405747652053833,
-0.07402146607637405... |
func (c *Client) SetCloneHeaders(cloneHeaders bool) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
c.config.CloneHeaders = cloneHeaders
} | [
-0.8506031632423401,
0.01243280153721571,
0.4706495404243469,
0.42933332920074463,
0.2639397382736206,
0.6806669235229492,
0.21983015537261963,
-0.7519906163215637,
0.10162506252527237,
0.46605926752090454,
-0.503711462020874,
0.1240997463464737,
-1.7885855436325073,
-0.1365959197282791,
... |
func (c *Client) CloneHeaders() bool {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.RLock()
defer c.config.modifyLock.RUnlock()
return c.config.CloneHeaders
} | [
-0.9081695079803467,
0.1847953051328659,
0.6104008555412292,
0.30234745144844055,
0.04078786075115204,
0.5870782136917114,
-0.09289953112602234,
-0.9417369961738586,
0.05685107782483101,
0.7417119741439819,
-0.3291929066181183,
-0.42731204628944397,
-2.2824037075042725,
-0.2644900381565094... |
func (c *Client) CloneToken() bool {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.RLock()
defer c.config.modifyLock.RUnlock()
return c.config.CloneToken
} | [
-1.1009145975112915,
0.11875109374523163,
0.4182606637477875,
0.18336787819862366,
-0.04352311044931412,
0.6457510590553284,
0.2379724234342575,
0.6160716414451599,
0.13599741458892822,
0.30134978890419006,
-0.8701651692390442,
0.9540067315101624,
-1.1096807718276978,
-0.09627898037433624,... |
func (c *Client) SetReadYourWrites(preventStaleReads bool) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.config.modifyLock.Lock()
defer c.config.modifyLock.Unlock()
if preventStaleReads {
if c.replicationStateStore == nil {
c.replicationStateStore = &replicationStateStore{}
}
} else {
c.replicatio... | [
-0.7003293633460999,
0.25722193717956543,
0.48650580644607544,
-0.5732280015945435,
-0.5511161088943481,
0.22459913790225983,
1.3629677295684814,
0.6367251873016357,
0.5798436403274536,
0.05209601670503616,
-0.2189086377620697,
0.01442265510559082,
-0.7560655474662781,
-0.18237096071243286... |
func (c *Client) ReadYourWrites() bool {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
c.config.modifyLock.RLock()
defer c.config.modifyLock.RUnlock()
return c.config.ReadYourWrites
} | [
-1.139927864074707,
0.11110793799161911,
0.46145257353782654,
-0.44950997829437256,
-0.09798746556043625,
-0.04428591579198837,
0.9816274046897888,
0.7270276546478271,
-0.33917102217674255,
0.1995261311531067,
-0.4254796802997589,
-0.1269715130329132,
-1.4669039249420166,
0.048838712275028... |
func (c *Client) Clone() (*Client, error) {
return c.clone(c.config.CloneHeaders)
} | [
0.25946882367134094,
-0.681920051574707,
0.2760902941226959,
0.6622070074081421,
-0.36256155371665955,
0.8072157502174377,
-0.04591596499085426,
-1.2833154201507568,
-0.23230597376823425,
0.06728076934814453,
-0.3919875919818878,
0.198444202542305,
-0.9390252232551575,
-1.0488171577453613,... |
func (c *Client) CloneWithHeaders() (*Client, error) {
return c.clone(true)
} | [
0.8796855807304382,
-0.7459065914154053,
0.36002451181411743,
0.7705113887786865,
-1.0636180639266968,
0.3155341148376465,
-0.6404404640197754,
-2.378865957260132,
0.13892324268817902,
-0.07905976474285126,
-0.27661922574043274,
-0.3370780646800995,
-1.0303841829299927,
-0.7028608918190002... |
func (c *Client) clone(cloneHeaders bool) (*Client, error) {
c.modifyLock.RLock()
defer c.modifyLock.RUnlock()
config := c.config
config.modifyLock.RLock()
defer config.modifyLock.RUnlock()
newConfig := &Config{
Address: config.Address,
HttpClient: config.HttpClient,
MinRetryWait: config.MinR... | [
0.1796092391014099,
-0.43571117520332336,
0.8041777014732361,
-0.0007092644809745252,
-0.7680595517158508,
0.1964963972568512,
-0.028050536289811134,
-0.4654025435447693,
0.7202843427658081,
0.3964512348175049,
-0.2425011843442917,
0.3631117641925812,
-0.7594069242477417,
-1.16738939285278... |
func (c *Client) SetPolicyOverride(override bool) {
c.modifyLock.Lock()
defer c.modifyLock.Unlock()
c.policyOverride = override
} | [
0.12968118488788605,
0.3020491302013397,
0.22129230201244354,
0.09431963413953781,
0.5593971610069275,
0.5651165246963501,
-0.3109758198261261,
-0.36063826084136963,
0.14285686612129211,
-0.8681170344352722,
-0.23007602989673615,
0.6248477101325989,
-1.1086214780807495,
-0.2917393445968628... |
func (c *Client) NewRequest(method, requestPath string) *Request {
c.modifyLock.RLock()
addr := c.addr
token := c.token
mfaCreds := c.mfaCreds
wrappingLookupFunc := c.wrappingLookupFunc
policyOverride := c.policyOverride
c.modifyLock.RUnlock()
host := addr.Host
// if SRV records exist (see https://tools.ietf.... | [
-0.780916154384613,
-0.2455694079399109,
0.7714205384254456,
-0.23387715220451355,
-0.35197755694389343,
-0.22684606909751892,
-0.15975065529346466,
-0.3825794458389282,
0.5803640484809875,
0.3365819454193115,
1.2313103675842285,
0.8691446185112,
0.8326575756072998,
-0.05638914182782173,
... |
func (c *Client) RawRequest(r *Request) (*Response, error) {
return c.RawRequestWithContext(context.Background(), r)
} | [
-0.3225916624069214,
0.30002254247665405,
0.623016893863678,
0.3803330659866333,
-0.41144952178001404,
-0.22963252663612366,
0.018450651317834854,
-1.2485076189041138,
1.3878880739212036,
-0.19630524516105652,
0.4891292154788971,
0.444967657327652,
0.3785625100135803,
-0.19644486904144287,... |
func (c *Client) RawRequestWithContext(ctx context.Context, r *Request) (*Response, error) {
// Note: we purposefully do not call cancel manually. The reason is
// when canceled, the request.Body will EOF when reading due to the way
// it streams data in. Cancel will still be run when the timeout is
// hit, so this... | [
-0.027245409786701202,
-0.4582003653049469,
0.8050660490989685,
-0.12290819734334946,
-1.0868114233016968,
-0.259054571390152,
-1.1903183460235596,
-1.2988086938858032,
1.2947624921798706,
0.6683432459831238,
-0.11111743003129959,
-0.20082086324691772,
0.15855959057807922,
-0.5859217643737... |
func (c *Client) httpRequestWithContext(ctx context.Context, r *Request) (*Response, error) {
req, err := http.NewRequestWithContext(ctx, r.Method, r.URL.RequestURI(), r.Body)
if err != nil {
return nil, err
}
c.modifyLock.RLock()
token := c.token
c.config.modifyLock.RLock()
limiter := c.config.Limiter
http... | [
-0.13960210978984833,
-0.7492346167564392,
0.8158534169197083,
0.28776687383651733,
-0.6291164755821228,
-0.5850582718849182,
-0.9575489163398743,
-1.6625477075576782,
0.4407457113265991,
0.6292909383773804,
0.2882835865020752,
0.6261240243911743,
-0.3961872458457947,
-0.30500876903533936,... |
func (c *Client) WithRequestCallbacks(callbacks ...RequestCallback) *Client {
c2 := *c
c2.modifyLock = sync.RWMutex{}
c2.requestCallbacks = callbacks
return &c2
} | [
-0.37841957807540894,
-0.1636534184217453,
0.6478450894355774,
0.9817323684692383,
-0.38949134945869446,
-0.06251493096351624,
-0.5853816270828247,
-1.4764127731323242,
0.8626142144203186,
-1.2037835121154785,
-0.589945912361145,
-0.406664103269577,
-0.6412217617034912,
-0.7802048325538635... |
func (c *Client) WithResponseCallbacks(callbacks ...ResponseCallback) *Client {
c2 := *c
c2.modifyLock = sync.RWMutex{}
c2.responseCallbacks = callbacks
return &c2
} | [
0.3997531533241272,
-0.7770963907241821,
0.5038013458251953,
1.002968430519104,
-0.5315548777580261,
0.003571971319615841,
0.3085050582885742,
-1.718142032623291,
1.4551430940628052,
-1.0685046911239624,
-0.6524545550346375,
-1.2884526252746582,
-0.5926046967506409,
-0.761378824710846,
-... |
func (c *Client) withConfiguredTimeout(ctx context.Context) (context.Context, context.CancelFunc) {
timeout := c.ClientTimeout()
if timeout > 0 {
return context.WithTimeout(ctx, timeout)
}
return ctx, func() {}
} | [
1.2480660676956177,
-0.22954410314559937,
0.2955522835254669,
-0.07716520130634308,
-0.40188196301460266,
-0.4680255651473999,
-0.21647591888904572,
-0.18097876012325287,
0.877383828163147,
0.1465650498867035,
-0.40597718954086304,
-0.18832245469093323,
0.8853843212127686,
-0.1401770859956... |
func RecordState(state *string) ResponseCallback {
return func(resp *Response) {
*state = resp.Header.Get(HeaderIndex)
}
} | [
-0.022891027852892876,
-0.013861149549484253,
0.614232063293457,
-0.8293553590774536,
-0.43769559264183044,
-0.42523810267448425,
-0.23146139085292816,
-0.15811391174793243,
1.4788280725479126,
-0.43786486983299255,
-0.3684707283973694,
0.2400062084197998,
0.4088156223297119,
-0.9815309643... |
func RequireState(states ...string) RequestCallback {
return func(req *Request) {
for _, s := range states {
req.Headers.Add(HeaderIndex, s)
}
}
} | [
-1.3534250259399414,
0.08584125339984894,
0.6332691311836243,
0.2518232762813568,
-0.33441802859306335,
0.6778433918952942,
-0.28622397780418396,
-0.7246795296669006,
0.8841922283172607,
-0.3396482467651367,
0.1309828907251358,
-1.3101943731307983,
-0.23161086440086365,
-0.2455704063177108... |
func compareReplicationStates(s1, s2 string) (int, error) {
w1, err := ParseReplicationState(s1, nil)
if err != nil {
return 0, err
}
w2, err := ParseReplicationState(s2, nil)
if err != nil {
return 0, err
}
if w1.ClusterID != w2.ClusterID {
return 0, fmt.Errorf("can't compare replication states with diff... | [
0.07463091611862183,
-0.9703433513641357,
0.5377714037895203,
-0.9313831329345703,
-0.546175479888916,
-0.6445276141166687,
0.00272058742120862,
0.313432514667511,
0.48581087589263916,
0.12621723115444183,
-0.5424889922142029,
0.9633243083953857,
-0.5376532077789307,
-0.28643545508384705,
... |
func MergeReplicationStates(old []string, new string) []string {
if len(old) == 0 || len(old) > 2 {
return []string{new}
}
var ret []string
for _, o := range old {
c, err := compareReplicationStates(o, new)
if err != nil {
return []string{new}
}
switch c {
case 1:
ret = append(ret, o)
case -1:
... | [
-0.6711888909339905,
-0.00785016268491745,
0.7271221280097961,
0.18970781564712524,
-0.7225878238677979,
-0.3433145582675934,
-0.4005885124206543,
0.3687123954296112,
0.6419320702552795,
0.7058901190757751,
-0.25893136858940125,
-0.12255962193012238,
0.15021559596061707,
0.2387208193540573... |
func ForwardInconsistent() RequestCallback {
return func(req *Request) {
req.Headers.Set(HeaderInconsistent, "forward-active-node")
}
} | [
-0.5599305033683777,
-0.5745248198509216,
0.4650784432888031,
-0.6210328340530396,
0.41762998700141907,
0.2538115680217743,
0.35600510239601135,
0.025652529671788216,
-0.4373570680618286,
-0.32271918654441833,
0.629135251045227,
-0.1889091432094574,
0.3469550609588623,
-0.8119349479675293,... |
func ForwardAlways() RequestCallback {
return func(req *Request) {
req.Headers.Set(HeaderForward, "active-node")
}
} | [
-0.27720320224761963,
0.15857024490833282,
0.569817066192627,
-0.6695022583007812,
-0.24463796615600586,
0.0493280328810215,
-0.7271360158920288,
-0.3815828263759613,
-0.164552241563797,
-0.5252253413200378,
0.8560440540313721,
0.22711054980754852,
0.9268138408660889,
-0.29442495107650757,... |
func DefaultRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) {
retry, err := retryablehttp.DefaultRetryPolicy(ctx, resp, err)
if err != nil || retry {
return retry, err
}
if resp != nil && resp.StatusCode == 412 {
return true, nil
}
return false, nil
} | [
-0.1988857537508011,
-0.054357558488845825,
0.4946838319301605,
0.014767522923648357,
0.15493899583816528,
0.9407897591590881,
-0.23073655366897583,
-0.9003313779830933,
-0.24774204194545746,
0.08177737891674042,
-0.7022514343261719,
-0.37836048007011414,
-0.8671911358833313,
0.48088192939... |
func (w *replicationStateStore) recordState(resp *Response) {
w.m.Lock()
defer w.m.Unlock()
newState := resp.Header.Get(HeaderIndex)
if newState != "" {
w.store = MergeReplicationStates(w.store, newState)
}
} | [
-0.15165561437606812,
0.2110578417778015,
0.41085493564605713,
-0.5956761837005615,
0.11316715180873871,
-0.47247353196144104,
0.14818263053894043,
0.3609303832054138,
1.0817346572875977,
-0.1159384548664093,
-0.18156173825263977,
0.44877395033836365,
-0.9156486392021179,
-0.43495491147041... |
func (w *replicationStateStore) requireState(req *Request) {
w.m.RLock()
defer w.m.RUnlock()
for _, s := range w.store {
req.Headers.Add(HeaderIndex, s)
}
} | [
-1.3894188404083252,
-0.2615494132041931,
0.351391077041626,
-0.33567601442337036,
-0.08628027886152267,
0.5712305307388306,
0.398458868265152,
-0.22272664308547974,
0.8683012127876282,
-0.09615236520767212,
-0.08516734838485718,
-0.5804839134216309,
-0.9547930359840393,
0.0262891966849565... |
func validateToken(t string) error {
idx := strings.IndexFunc(t, func(c rune) bool {
return !unicode.IsPrint(c)
})
if idx != -1 {
return fmt.Errorf("configured Vault token contains non-printable characters and cannot be used")
}
return nil
} | [
-0.24657981097698212,
-0.2260393351316452,
0.2962864935398102,
-0.1570296585559845,
-0.09243901073932648,
0.419201523065567,
0.07693449407815933,
0.1589067280292511,
-0.5599657297134399,
0.06636654585599899,
-0.20451036095619202,
0.6200228929519653,
-0.0965038388967514,
0.19501321017742157... |
func (addr *Address) Encode() (string, error) {
ripe := addr.Ripe[:]
switch addr.Version {
case 2:
fallthrough
case 3:
if ripe[0] == 0x00 {
ripe = ripe[1:] // exclude first byte
if ripe[0] == 0x00 {
ripe = ripe[1:] // exclude second byte as well
}
}
case 4:
ripe = bytes.TrimLeft(ripe, "\x00")... | [
0.3653598427772522,
-0.9238741993904114,
0.64802086353302,
0.19164466857910156,
-0.3598778545856476,
-0.1973559856414795,
0.06656689941883087,
0.5804001688957214,
1.3341069221496582,
0.8342818021774292,
0.01953405700623989,
1.0396311283111572,
-0.49167928099632263,
0.28776419162750244,
0... |
func DecodeAddress(address string) (*Address, error) {
if address[:3] == "BM-" { // Clients should accept addresses without BM-
address = address[3:]
}
data := base58.Decode(address)
if len(data) <= 12 { // rough lower bound, also don't want it to be empty
return nil, ErrUnknownAddressType
}
hashData := dat... | [
0.1481305956840515,
-0.9685827493667603,
0.867940366268158,
-0.0931771844625473,
-0.23622220754623413,
-0.33791327476501465,
0.48095303773880005,
0.65244060754776,
1.570281982421875,
0.05122210457921028,
-0.4833095371723175,
0.7594712376594543,
-0.536169171333313,
0.12296692281961441,
1.... |
func (addr *Address) calcSingleHash() []byte {
var b bytes.Buffer
WriteVarInt(&b, addr.Version)
WriteVarInt(&b, addr.Stream)
b.Write(addr.Ripe[:])
return Sha512(b.Bytes())
} | [
0.5541775822639465,
-0.09502628445625305,
0.5091684460639954,
-0.16210408508777618,
-1.3667782545089722,
0.3721902370452881,
-0.09244761615991592,
0.7526348233222961,
1.2801532745361328,
0.3354610204696655,
-0.4216178059577942,
0.6040191650390625,
-0.711524248123169,
0.33387845754623413,
... |
func (addr *Address) calcDoubleHash() []byte {
return Sha512(addr.calcSingleHash())
} | [
0.4636942148208618,
0.31776365637779236,
0.5143523216247559,
0.4595652222633362,
-1.3986293077468872,
0.6076474189758301,
-0.06683609634637833,
0.0706549733877182,
0.8924407958984375,
0.21041594445705414,
-1.0809615850448608,
0.8055158257484436,
0.11276254057884216,
0.5873684883117676,
0... |
func (addr *Address) Tag() []byte {
var a = make([]byte, 32)
copy(a, addr.calcDoubleHash()[32:])
return a
} | [
-0.10125023871660233,
0.5759633779525757,
0.6291886568069458,
-0.8446632027626038,
0.20770666003227234,
0.7577847838401794,
-0.1708279401063919,
-0.7197455167770386,
0.08923028409481049,
-0.029856715351343155,
-0.9457229971885681,
0.2616063356399536,
0.0997994914650917,
0.13530820608139038... |
func (addr *Address) PrivateKey() *btcec.PrivateKey {
pk := addr.calcDoubleHash()[:32]
privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)
return privKey
} | [
0.4517180919647217,
0.40911558270454407,
0.4102359116077423,
-0.2300833910703659,
0.30578869581222534,
-0.20724627375602722,
0.483519971370697,
-0.6483250856399536,
0.9253020286560059,
0.5357809066772461,
0.12513746321201324,
0.6745511889457703,
-0.15820352733135223,
-0.02300894819200039,
... |
func (addr *Address) PrivateKeySingleHash() *btcec.PrivateKey {
pk := addr.calcSingleHash()[:32]
privKey, _ := btcec.PrivKeyFromBytes(btcec.S256(), pk)
return privKey
} | [
0.9663437008857727,
0.6352809071540833,
0.3632890284061432,
0.030695948749780655,
-0.28018999099731445,
0.17272619903087616,
0.37244048714637756,
0.2912449538707733,
0.9951226115226746,
0.941229522228241,
-0.24146699905395508,
0.7663723230361938,
-0.7233828902244568,
-0.20582032203674316,
... |
func main() {
fmt.Println(strings.Join(os.Args, " "))
} | [
0.7505642175674438,
-0.537064254283905,
0.7556673288345337,
0.2752804756164551,
0.9387691020965576,
1.2641090154647827,
0.22016547620296478,
0.06910141557455063,
-1.3283827304840088,
-0.06404824554920197,
0.1734398901462555,
1.0804129838943481,
-0.40616732835769653,
0.3532857298851013,
-... |
func ClearLabels(issue *models.Issue, doer *models.User) (err error) {
if err = issue.ClearLabels(doer); err != nil {
return
}
notification.NotifyIssueClearLabels(doer, issue)
return nil
} | [
-0.3864443600177765,
0.2737772762775421,
0.15796694159507751,
-0.10091183334589005,
-0.7640913128852844,
0.5575360655784607,
-0.549027144908905,
-0.11994808167219162,
0.5870972275733948,
0.7896034121513367,
0.7789528369903564,
-0.08639980852603912,
0.19245290756225586,
0.08504023402929306,... |
func isSubstitutableNode(ctx context.Context, deploymentID, nodeName string) (bool, error) {
node, err := getNodeTemplate(ctx, deploymentID, nodeName)
if err != nil {
return false, errors.Wrapf(err, "Can't get directives for node %q", nodeName)
}
substitutable := false
if node.Directives != nil {
for _, valu... | [
-0.21423502266407013,
0.08217419683933258,
0.5728067755699158,
-0.7249175906181335,
-0.6142308712005615,
0.1331816464662552,
-0.2554003596305847,
0.7729485034942627,
-0.41972616314888,
1.4660097360610962,
-0.26935067772865295,
1.0166120529174805,
-0.0692337304353714,
-0.39259955286979675,
... |
func storeSubstitutionMappingAttributeNamesInSet(ctx context.Context, deploymentID, nodeName string, set map[string]struct{}) error {
substMapping, err := getDeploymentSubstitutionMapping(ctx, deploymentID)
if err != nil {
return err
}
capabilityToAttrNames := make(map[string][]string)
exploreParents := true
... | [
-1.1913825273513794,
-0.5733558535575867,
0.701533317565918,
-1.3272472620010376,
-0.6807066798210144,
-0.4341594874858856,
-0.11292166262865067,
0.43378138542175293,
-0.31988659501075745,
0.5494900345802307,
-0.015129799954593182,
-0.009143263101577759,
0.5649014115333557,
0.2332317084074... |
func getSubstitutionMappingAttribute(ctx context.Context, deploymentID, nodeName, instanceName, attributeName string, nestedKeys ...string) (*TOSCAValue, error) {
if !isSubstitutionMappingAttribute(attributeName) {
return nil, nil
}
log.Debugf("Attempting to substitute attribute %s in %s %s %s", attributeName, d... | [
-0.8824973702430725,
-0.20718957483768463,
0.6902664303779602,
-0.20192262530326843,
-1.030134916305542,
-0.5835481882095337,
0.790043830871582,
1.2491154670715332,
0.400223046541214,
0.7114629149436951,
0.5349552035331726,
0.29929137229919434,
0.202841654419899,
-0.18318355083465576,
1.... |
func getSubstitutionNodeInstancesIds(ctx context.Context, deploymentID, nodeName string) ([]string, error) {
var names []string
substitutable, err := isSubstitutableNode(ctx, deploymentID, nodeName)
if err == nil && substitutable {
names = []string{substitutableNodeInstance}
}
return names, err
} | [
-0.7483450174331665,
0.24252600967884064,
0.28691914677619934,
-1.1557600498199463,
-0.37539973855018616,
0.4187045395374298,
-0.6709970235824585,
0.37543684244155884,
-0.2854333221912384,
1.647794246673584,
0.09486348181962967,
1.3895483016967773,
-0.6511431932449341,
-0.11036603897809982... |
func getSubstitutableNodeType(ctx context.Context, deploymentID, nodeName, nodeType string) (string, error) {
_, err := GetParentType(ctx, deploymentID, nodeType)
if err == nil {
// Reference to an external service, this node type is a real abstract
// node type
return nodeType, nil
} else if !IsTypeMissingErr... | [
-0.08620618283748627,
0.13807092607021332,
0.81761634349823,
-1.0020509958267212,
-0.2324344962835312,
0.1708657592535019,
0.5009408593177795,
-0.11985272914171219,
0.07297424972057343,
1.187171459197998,
0.5958071947097778,
0.588738203048706,
-0.46055904030799866,
0.13194261491298676,
0... |
func getSubstitutionInstanceAttribute(deploymentID, nodeName, instanceName, attributeName string) (bool, string) {
switch attributeName {
case "tosca_name":
return true, nodeName
case "tosca_id":
return true, nodeName + "-" + instanceName
default:
return false, ""
}
} | [
-0.7356858849525452,
-0.11631584167480469,
0.5705539584159851,
-0.9840046167373657,
-0.6808404922485352,
0.2786216735839844,
0.189029723405838,
1.5878146886825562,
-0.3373771607875824,
1.2931922674179077,
-0.007455749902874231,
0.6252779364585876,
0.04056992381811142,
-0.5439087748527527,
... |
func getSubstitutionInstanceCapabilityAttribute(ctx context.Context, deploymentID, nodeName,
instanceName, capabilityName, attributeType, attributeName string, nestedKeys ...string) (*TOSCAValue, error) {
nodeAttrName := fmt.Sprintf(capabilityFormat, capabilityName, attributeName)
return getNodeAttributeValue(ctx, ... | [
-0.7319355607032776,
-0.5446440577507019,
0.4030971825122833,
-0.06100660562515259,
-0.8771082758903503,
-0.19386649131774902,
0.6233908534049988,
1.5069438219070435,
-0.44457951188087463,
0.7695255875587463,
0.300637423992157,
0.9441244006156921,
-0.21573595702648163,
-0.7520677447319031,... |
func NewSocketsTraversalExtension() *SocketsTraversalExtension {
return &SocketsTraversalExtension{
SocketsToken: traversalSocketsToken,
}
} | [
0.16727906465530396,
0.5178145170211792,
0.19647054374217987,
-0.36616241931915283,
-1.6349246501922607,
-0.7773202061653137,
-0.4479001462459564,
-0.6662293076515198,
1.2127561569213867,
0.2373839169740677,
-0.9099439382553101,
0.5594764351844788,
-0.22882652282714844,
0.2418547421693802,... |
func (e *SocketsTraversalExtension) ScanIdent(s string) (traversal.Token, bool) {
switch s {
case "SOCKETS":
return e.SocketsToken, true
}
return traversal.IDENT, false
} | [
-1.0268385410308838,
0.24847440421581268,
0.5276470184326172,
-0.04365510866045952,
-1.6828221082687378,
0.27816587686538696,
-0.026587333530187607,
-0.5515484809875488,
1.2322344779968262,
0.4718087911605835,
-0.7319596409797668,
0.012143748812377453,
-1.0800044536590576,
-0.2268244773149... |
func (e *SocketsTraversalExtension) ParseStep(t traversal.Token, p traversal.GremlinTraversalContext) (traversal.GremlinTraversalStep, error) {
switch t {
case e.SocketsToken:
return &SocketsGremlinTraversalStep{GremlinTraversalContext: p}, nil
}
return nil, nil
} | [
0.43672874569892883,
1.010735034942627,
0.4145528972148895,
-0.08125033229589462,
-0.09952572733163834,
-0.29882198572158813,
-0.33764880895614624,
-0.43654105067253113,
0.4509550929069519,
0.11933472007513046,
-0.4723389148712158,
0.0222255177795887,
-0.6653140187263489,
0.608483493328094... |
func (s *SocketsGremlinTraversalStep) Exec(last traversal.GraphTraversalStep) (traversal.GraphTraversalStep, error) {
switch tv := last.(type) {
case *traversal.GraphTraversalV:
return Sockets(s.StepContext, tv), nil
case *FlowTraversalStep:
return tv.Sockets(s.StepContext), nil
}
return nil, traversal.ErrExec... | [
0.013324102386832237,
0.9309242963790894,
0.5406008958816528,
0.07805097103118896,
0.039091795682907104,
0.07053930312395096,
0.3711700737476349,
-0.7225760221481323,
-0.4224754571914673,
0.13620492815971375,
0.21049125492572784,
0.4804318845272064,
-0.5308412909507751,
0.15253543853759766... |
func (s *SocketsTraversalStep) PropertyValues(ctx traversal.StepContext, keys ...interface{}) *traversal.GraphTraversalValue {
if s.error != nil {
return traversal.NewGraphTraversalValueFromError(s.error)
}
key := keys[0].(string)
var values []interface{}
for _, sockets := range s.sockets {
for _, socket := r... | [
-0.6649283766746521,
0.06201055273413658,
0.5316731333732605,
0.1811526119709015,
-0.1285725235939026,
-0.3741057217121124,
-0.29933711886405945,
-0.12059911340475082,
-0.6715742349624634,
-0.34450477361679077,
0.3913660943508148,
0.3415302336215973,
-0.3463011384010315,
0.0982332527637481... |
func (s *SocketsTraversalStep) Values() []interface{} {
if len(s.sockets) == 0 {
return []interface{}{}
}
return []interface{}{s.sockets}
} | [
-0.9048181176185608,
0.6472329497337341,
0.43598228693008423,
-0.06784924119710922,
0.8229831457138062,
-0.016610147431492805,
-0.06604788452386856,
-0.578985869884491,
0.19421567022800446,
-0.13401886820793152,
-0.1236666738986969,
0.49033716320991516,
-0.5189776420593262,
1.7541483640670... |
func (s *SocketsTraversalStep) MarshalJSON() ([]byte, error) {
values := s.Values()
s.GraphTraversal.RLock()
defer s.GraphTraversal.RUnlock()
return json.Marshal(values)
} | [
-0.31852850317955017,
0.5678684711456299,
0.07842360436916351,
-0.1952187567949295,
-0.4655570387840271,
-0.259737491607666,
0.5516738891601562,
-0.6889020800590515,
-0.42934754490852356,
-0.10745738446712494,
-0.8527933359146118,
0.5604991316795349,
-0.37262916564941406,
1.152108550071716... |
func NewSocketIndexer(g *graph.Graph) *graph.Indexer {
hashNode := func(n *graph.Node) map[string]interface{} {
sockets := getSockets(n)
kv := make(map[string]interface{}, len(sockets))
for _, socket := range sockets {
kv[socket.Hash()] = socket
}
return kv
}
graphIndexer := graph.NewIndexer(g, g, hash... | [
-0.47897854447364807,
0.3794236183166504,
0.6344314217567444,
-0.7076237797737122,
-1.2845289707183838,
-0.41769662499427795,
0.5491958260536194,
-0.5464470982551575,
0.2301836907863617,
-0.060121215879917145,
-0.22983095049858093,
0.7765451669692993,
-0.2950216233730316,
0.709034621715545... |
func NewAttestationLocalInfra(dc *hwsec.DaemonController) *AttestationLocalInfra {
return &AttestationLocalInfra{dc, nil, filesnapshot.NewSnapshot(), false}
} | [
0.4763493537902832,
-0.5648817420005798,
-0.07264355570077896,
-0.2723023295402527,
-0.6553894281387329,
-0.5621069669723511,
1.3246604204177856,
0.6701908111572266,
-0.17471517622470856,
-0.5557859539985657,
0.5870031714439392,
0.2736203074455261,
-0.1363295018672943,
0.7411205768585205,
... |
func (ali *AttestationLocalInfra) Enable(ctx context.Context) (lastErr error) {
if err := RestoreTPMOwnerPasswordIfNeeded(ctx, ali.dc); err != nil {
return errors.Wrap(err, "failed to restore tpm owner password")
}
if _, err := os.Stat(hwsec.AttestationDBPath); err == nil {
// Note: we don't restart attestationd... | [
-0.08441910147666931,
0.41746652126312256,
0.7377495765686035,
-0.17468519508838654,
0.37830567359924316,
0.12597040832042694,
0.9439858198165894,
0.3304162919521332,
0.28537875413894653,
0.3512721061706543,
0.6269308924674988,
0.25589966773986816,
-0.40424686670303345,
0.2233242690563202,... |
func (ali *AttestationLocalInfra) Disable(ctx context.Context) error {
var lastErr error
if ali.dbStashed {
if err := ali.snapshot.Pop(hwsec.AttestationDBPath); err != nil {
testing.ContextLog(ctx, "Failed to pop the snapshot of attestation database back: ", err)
lastErr = errors.Wrap(err, "failed to pop the ... | [
-0.0015871665673330426,
0.08988229185342789,
0.7353729009628296,
0.23140858113765717,
0.24691861867904663,
0.5526299476623535,
1.2050827741622925,
1.0260947942733765,
0.17788074910640717,
0.27992483973503113,
0.4383133351802826,
-0.07583726197481155,
-0.8963634967803955,
0.5020137429237366... |
func (ali *AttestationLocalInfra) injectWellKnownGoogleKeys(ctx context.Context) (lastErr error) {
if _, err := os.Stat(googleKeysDataPath); os.IsNotExist(err) {
if _, err := testexec.CommandContext(ctx, "attestation-injected-keys").Output(); err != nil {
return errors.Wrap(err, "failed to create key file")
}
... | [
-0.23209306597709656,
0.5634049773216248,
0.5462177395820618,
-1.2027397155761719,
0.2620595693588257,
0.4533770680427551,
0.8035501837730408,
-0.12810853123664856,
-0.02246107906103134,
0.5337314009666443,
-0.5649466514587402,
0.7828212380409241,
-1.0910158157348633,
0.4474802315235138,
... |
func (ali *AttestationLocalInfra) injectNormalGoogleKeys(ctx context.Context) error {
if err := os.Remove(googleKeysDataPath); err != nil {
return errors.Wrap(err, "failed to remove injected key file")
}
if err := ali.dc.Restart(ctx, hwsec.AttestationDaemon); err != nil {
return errors.Wrap(err, "failed to resta... | [
-0.8572937846183777,
0.2938663959503174,
0.17321033775806427,
-0.5645652413368225,
-0.7930333614349365,
0.7882726192474365,
0.37768152356147766,
0.20854490995407104,
-0.39290371537208557,
0.5977192521095276,
0.10038771480321884,
0.9323516488075256,
-1.0602909326553345,
0.4068228304386139,
... |
func (ali *AttestationLocalInfra) enableFakePCAAgent(ctx context.Context) (lastErr error) {
if err := ali.dc.Stop(ctx, hwsec.PCAAgentDaemon); err != nil {
return errors.Wrap(err, "failed to stop normal pca agent")
}
defer func() {
if lastErr != nil {
if err := ali.dc.Start(ctx, hwsec.PCAAgentDaemon); err != n... | [
0.0371505431830883,
-0.7363917827606201,
0.6064764857292175,
-0.25764256715774536,
0.3971336781978607,
0.04276952147483826,
0.6919113397598267,
0.3748413324356079,
0.9970805048942566,
0.12449416518211365,
-0.3475095331668854,
0.6433007121086121,
-0.8120298385620117,
0.5820621848106384,
0... |
func (ali *AttestationLocalInfra) disableFakePCAAgent(ctx context.Context) error {
var firstErr error
if ali.fpca != nil {
if err := ali.fpca.Stop(); err != nil {
testing.ContextLog(ctx, "Failed to stop fake pca agent: ", err)
firstErr = errors.Wrap(err, "failed to stop fake pca agent")
} else {
ali.fpca... | [
-0.027087926864624023,
-0.6487700343132019,
0.5663721561431885,
-0.1963174194097519,
-0.2792370021343231,
-0.1347392499446869,
1.153012752532959,
0.3800681233406067,
0.63454270362854,
0.49606022238731384,
0.09475018084049225,
0.1221182569861412,
-1.147489309310913,
0.6006074547767639,
1.... |
func (emailTemplate EmailTemplate) create() (Entity, error) {
et := emailTemplate
if err := db.Create(&et).Error; err != nil {
return nil, err
}
err := et.GetPreloadDb(false,false, nil).First(&et, et.Id).Error
if err != nil {
return nil, err
}
var newItem Entity = &et
return newItem, nil
} | [
-0.37543803453445435,
0.23170053958892822,
0.4289705753326416,
-0.13431280851364136,
0.5072324872016907,
0.39508458971977234,
-0.43482956290245056,
-0.18940705060958862,
-0.6012493371963501,
0.5480700135231018,
-0.5477191805839539,
-1.050850510597229,
-0.6666511297225952,
0.585733413696289... |
func (g *GPG) KeysById(id uint64) []openpgp.Key {
return append(g.secring.KeysById(id), g.pubring.KeysById(id)...)
} | [
-0.07216686755418777,
-0.25534674525260925,
0.20256149768829346,
-0.6075439453125,
0.07754069566726685,
-0.14888887107372284,
-0.6671223044395447,
-0.9244274497032166,
-0.04971315339207649,
0.8828189373016357,
-0.534206748008728,
0.6625098586082458,
-0.36991873383522034,
0.447029173374176,... |
func (g *GPG) DecryptionKeys() []openpgp.Key {
return append(g.secring.DecryptionKeys(), g.pubring.DecryptionKeys()...)
} | [
-0.4161292612552643,
0.5235915184020996,
0.25993117690086365,
0.4244346022605896,
0.43020784854888916,
-0.20588275790214539,
-0.47541388869285583,
-0.11788107454776764,
-0.6722662448883057,
1.0259042978286743,
-0.344908207654953,
0.39208683371543884,
-0.4083682596683502,
0.3481621146202087... |
func (g *GPG) SigningKeys() []openpgp.Key {
keys := []openpgp.Key{}
for _, e := range g.secring {
for _, subKey := range e.Subkeys {
if subKey.PrivateKey != nil && (!subKey.Sig.FlagsValid || subKey.Sig.FlagSign) {
keys = append(keys, openpgp.Key{
Entity: e,
PublicKey: subKey.PublicKey,
... | [
-0.9263693690299988,
-0.21664589643478394,
0.4650510847568512,
0.4244232773780823,
-0.19065812230110168,
0.43295809626579285,
-0.48939278721809387,
0.37025830149650574,
-0.7243891358375549,
0.4852573275566101,
-0.06882427632808685,
0.15650521218776703,
-0.8443825244903564,
0.69110739231109... |
func NewCrawler(siteURL string) *Crawler {
siteURL = strings.Trim(siteURL, " ")
siteURL = strings.TrimRight(siteURL, "/")
var siteURLWWW string
var baseURL string
if strings.Index(siteURL, "http://") == 0 {
siteURL = strings.Replace(siteURL, "https://", "", 1)
} else if strings.Index(siteURL, "https://") ==... | [
-0.5259619951248169,
-0.8215771913528442,
0.33002686500549316,
-0.05474099889397621,
-0.39771220088005066,
-0.37604042887687683,
0.818507730960846,
0.03907615691423416,
0.5109986066818237,
-0.42714256048202515,
-0.2926485538482666,
0.016058437526226044,
-0.7271901369094849,
1.0107046365737... |
func (c *Crawler) CrawlAndScrape() {
var wg sync.WaitGroup
//Crawl BaseURL to find the urls
c.crawlURL(c.BaseURL)
for {
e := c.CrawlQueue.Front()
if e == nil {
break
}
c.crawlURL(e.Value.(string))
c.CrawlQueue.Remove(e)
fmt.Printf("URLS Queue: %d \n", c.CrawlQueue.Len())
fmt.Printf("URLS Cra... | [
-0.5455835461616516,
-0.0894700139760971,
0.5683104991912842,
-1.0651326179504395,
0.48690229654312134,
-0.3217691481113434,
0.738426148891449,
0.7718012928962708,
-0.05997686833143234,
-0.023438163101673126,
-0.3896329700946808,
-0.35561081767082214,
-0.3022739291191101,
1.310021638870239... |
func (mock *MockLogger) Printf(format string, v ...interface{}) {
mock.appendToLog(fmt.Sprintf(format, v...))
} | [
-0.2568731904029846,
-0.13126790523529053,
0.532502293586731,
0.17489799857139587,
0.45668676495552063,
0.11391080170869827,
-0.1586686074733734,
0.15158316493034363,
-0.2795020341873169,
-0.6625270247459412,
0.4040726125240326,
0.39876341819763184,
0.26708483695983887,
1.5671364068984985,... |
func (mock *MockLogger) Println(v ...interface{}) {
mock.appendToLog(fmt.Sprintln(v...))
} | [
-0.8007927536964417,
-0.08877240866422653,
0.5934197902679443,
0.5405123233795166,
0.09391725808382034,
0.1343875527381897,
-0.349504679441452,
0.054347943514585495,
0.13045857846736908,
-0.43458592891693115,
-0.4042118787765503,
0.07177116721868515,
0.3532816171646118,
1.23268723487854,
... |
func New() *Credentials {
c := Credentials{}
c.whitelist = make(map[string]struct{}, 1)
return &c
} | [
-0.559141993522644,
-0.7782406210899353,
0.18776310980319977,
-0.3065592348575592,
-0.6331154108047485,
-0.3992479145526886,
-0.23643139004707336,
0.15175682306289673,
-0.4066615700721741,
-0.3876834511756897,
-0.16923028230667114,
0.71540367603302,
0.03586410731077194,
0.6707838177680969,... |
func EncryptUser(username, password string) string {
key := fmt.Sprintf("%v.%v", username, password)
tmp := sha256.Sum256([]byte(key))
eKey := tmp[:]
return hex.EncodeToString(eKey)
} | [
-0.6184916496276855,
-0.13093255460262299,
0.5163678526878357,
0.24284084141254425,
-0.5962309837341309,
-0.06699929386377335,
-0.3540206551551819,
0.17543552815914154,
-0.16117225587368011,
1.1066545248031616,
-1.1635985374450684,
0.27629753947257996,
-0.03944021463394165,
-0.652046859264... |
func (c *Credentials) Register(username, password string) {
user := EncryptUser(username, password)
c.whitelist[user] = struct{}{}
} | [
-1.0585999488830566,
0.7856506109237671,
0.1452733725309372,
-0.13095082342624664,
0.01963694579899311,
0.12166561186313629,
-0.29891228675842285,
0.2559351325035095,
-0.756615936756134,
0.037803132086992264,
-1.6167958974838257,
1.29887855052948,
-0.630027174949646,
0.11710193753242493,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.