text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func StrLower(s string) string {
return strings.ToLower(s)
} | [
0.491909384727478,
-0.7439169883728027,
0.36777064204216003,
-0.7426194548606873,
-0.6539450883865356,
-0.40727469325065613,
-0.7853137850761414,
-1.1745465993881226,
0.2668302357196808,
-0.17933215200901031,
-0.015961822122335434,
-0.15906111896038055,
-0.42036905884742737,
-0.17868503928... |
func StrTrim(s string) string {
return strings.TrimSpace(s)
} | [
0.23886971175670624,
-0.34647053480148315,
0.1995442509651184,
-0.85575932264328,
-1.1324071884155273,
-0.4665473997592926,
-0.9095252156257629,
-0.9144639372825623,
0.8106090426445007,
0.3152339458465576,
-0.41314077377319336,
0.5173210501670837,
0.2208988219499588,
-0.9058243632316589,
... |
func StrRandom(length int) string {
result := make([]rune, length)
for i := range result {
result[i] = alphaNumeric[rand.Intn(len(alphaNumeric))]
}
return string(result)
} | [
-1.234596610069275,
-0.029675645753741264,
0.6948260068893433,
-1.3691221475601196,
-0.9212260842323303,
0.501354992389679,
-0.2999228537082672,
-0.43190231919288635,
0.6864839196205139,
0.49581021070480347,
-0.24101020395755768,
0.6206526160240173,
-0.9560977220535278,
-0.701810359954834,... |
func panicln(format string, a ...interface{}) {
log.Panicln(fmt.Errorf(format, a...))
} | [
0.19945651292800903,
-0.5669546127319336,
0.4674120247364044,
0.7483689785003662,
-0.4961664378643036,
-0.04062943160533905,
-0.49956265091896057,
0.2529786229133606,
-0.030406005680561066,
-0.8928677439689636,
-0.2500758767127991,
0.5178854465484619,
1.3089818954467773,
0.5799947381019592... |
func (impression *Impression) Validate(version Version) error {
if len(impression.URI) == 0 {
return ValidationError{Errs: []error{ErrImpressionMissURI}}
}
return nil
} | [
-0.5915117263793945,
0.12197574228048325,
0.3822939991950989,
0.5501395463943481,
0.3270922899246216,
0.24261288344860077,
0.31782618165016174,
1.2059316635131836,
-0.08012931793928146,
0.23944434523582458,
-0.332973837852478,
-0.6322937607765198,
-1.4706085920333862,
0.9309616088867188,
... |
func Abs(number int) int {
if number > 0 {
return number
}
return -number
} | [
-1.293156385421753,
-0.03065052628517151,
0.5465952754020691,
0.16496405005455017,
-0.6625058650970459,
0.9734470248222351,
-0.43912070989608765,
-0.10899005830287933,
-0.09243910014629364,
-0.6691157221794128,
0.6843772530555725,
0.7514663934707642,
0.5927324295043945,
0.5907416939735413,... |
func Max(numbers ...int) int {
max := numbers[0]
for _, num := range numbers {
if num > max {
max = num
}
}
return max
} | [
-0.04262753203511238,
0.6994187831878662,
0.5551279783248901,
1.2107371091842651,
0.49501433968544006,
0.5460330247879028,
-0.5825875997543335,
0.08664705604314804,
-0.43661820888519287,
-0.7701493501663208,
-0.5525974035263062,
0.15165115892887115,
-0.14883750677108765,
0.7550744414329529... |
func Min(numbers ...int) int {
min := numbers[0]
for _, num := range numbers {
if num < min {
min = num
}
}
return min
} | [
0.3304804265499115,
-0.35734596848487854,
0.42751598358154297,
0.8771600723266602,
0.11540159583091736,
0.6334483623504639,
-0.6343652606010437,
-0.5053620338439941,
-0.2850435674190521,
-1.2635940313339233,
-0.36650562286376953,
0.03377797082066536,
-0.5803662538528442,
1.04293692111969,
... |
func CheckDuplicates(array []int) bool {
for i := 1; i < len(array); i++ {
if array[i-1] == array[i] {
return false
}
}
return true
} | [
-0.8052273392677307,
0.957719087600708,
0.9438923001289368,
0.6279479265213013,
0.30954304337501526,
1.0470658540725708,
0.37640872597694397,
-0.8760966062545776,
0.0034923541825264692,
0.4193210005760193,
-0.0034068624954670668,
0.5285632610321045,
-1.3772238492965698,
0.9380719065666199,... |
func CheckNumber(str string) bool {
minus := false
if len(str) == 0 {
return false
}
if str[0] == '-' && len(str) == 1 {
return false
}
i := 0
for i < len(str) && str[i] == '-' {
if minus == true && str[i] == '-' {
return false
}
if str[i] == '-' {
minus = true
}
}
for i < len(str) && str[i] ... | [
-0.6314022541046143,
-0.008978260681033134,
0.851070761680603,
0.9837459325790405,
-0.12213854491710663,
0.8397565484046936,
-0.24838601052761078,
0.40146178007125854,
0.3642483949661255,
-0.4237658977508545,
-0.37555426359176636,
0.15476097166538239,
-0.9894917607307434,
0.665733754634857... |
func SetFcConnector(fc connector.FibreChannelInterface) {
fcConnector = fc
} | [
-0.5039986968040466,
-0.831634521484375,
0.3041132688522339,
-0.9134368300437927,
-0.07232549786567688,
-1.3846070766448975,
0.14873555302619934,
0.09681236743927002,
-0.28843188285827637,
-1.3997563123703003,
-0.05320483446121216,
-0.9331693649291992,
0.052209626883268356,
1.4536373615264... |
func Convert2ConnectionProperty(wwns []string, lunID string) connector.ConnectionProperty {
var property connector.ConnectionProperty
property.TargetWwns = wwns
property.TargetLun, _ = strconv.Atoi(lunID)
property.StorageProtocol = connector.FcProtocol
return property
} | [
-0.6813051700592041,
-2.3172101974487305,
0.3674508035182953,
0.42152512073516846,
-0.4434949457645416,
-0.4040466845035553,
-0.7839088439941406,
0.12425148487091064,
0.3841168284416199,
-0.10234032571315765,
0.1415778249502182,
0.33225589990615845,
0.17077210545539856,
-0.5123157501220703... |
func HandleFCConnect(args ...string) error {
var err error
if len(args) == 1 {
// User only supply the LUN ID, so did a wildcard scan for all connected targets
err = fmt.Errorf("currently [LUN ID] is not supported")
log.WithError(err).Error("Unsupported parameters.")
} else {
targets := args[:len(args)-1]
... | [
-0.4840995967388153,
-0.8848203420639038,
0.7464457750320435,
0.7409114241600037,
0.6093566417694092,
-0.9717328548431396,
-0.7574031949043274,
-0.3272460699081421,
-1.2865256071090698,
-0.9447150230407715,
0.6932594776153564,
-0.8161220550537109,
-0.2764369249343872,
0.11191095411777496,
... |
func HandleFCExtend(args ...string) error {
return nil
} | [
0.136045902967453,
0.46340617537498474,
0.591446042060852,
0.7565664052963257,
-0.13549870252609253,
-0.5346937775611877,
-0.1297960728406906,
0.29106882214546204,
-0.5997867584228516,
-1.227258563041687,
-1.122194528579712,
-0.2421121597290039,
-1.0807379484176636,
0.9794767498970032,
0... |
func (c *Client) RemoveBucketReplication(ctx context.Context, bucketName string) error {
return c.removeBucketReplication(ctx, bucketName)
} | [
-1.1382659673690796,
0.7339959144592285,
0.04383260756731033,
0.4803958237171173,
-0.7672023177146912,
-0.5892009735107422,
0.4037844240665436,
0.7215429544448853,
-0.5605692267417908,
-0.22017520666122437,
-0.6434218287467957,
0.12548398971557617,
-0.4744604825973511,
-0.45178741216659546... |
func (c *Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return err
}
// If replication is empty then delete it.
if cfg.Empty() {
return c.removeBucketReplication(ctx, buc... | [
-0.7452858686447144,
0.5441871285438538,
0.38908928632736206,
-0.04462860897183418,
-0.14836882054805756,
-0.24437618255615234,
0.09985803067684174,
0.8420794606208801,
-0.015080412849783897,
0.37776097655296326,
-1.1578140258789062,
0.05022646486759186,
-0.21819284558296204,
-0.5724932551... |
func (c *Client) putBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error {
// Get resources properly escaped and lined up before
// using them in http request.
urlValues := make(url.Values)
urlValues.Set("replication", "")
replication, err := xml.Marshal(cfg)
if err != nil {
r... | [
-1.3012608289718628,
0.30859044194221497,
0.4781593978404999,
-0.925485372543335,
-0.0178716741502285,
-0.5103742480278015,
0.41547563672065735,
0.43145209550857544,
-0.7822778224945068,
0.7147247791290283,
-1.2506043910980225,
0.381157785654068,
-0.4848344922065735,
-0.7617802619934082,
... |
func (c *Client) removeBucketReplication(ctx context.Context, bucketName string) error {
// Get resources properly escaped and lined up before
// using them in http request.
urlValues := make(url.Values)
urlValues.Set("replication", "")
// Execute DELETE on objectName.
resp, err := c.executeMethod(ctx, http.Meth... | [
-1.2346997261047363,
0.17467865347862244,
0.382533997297287,
-0.19659337401390076,
-0.6019525527954102,
-0.9116430282592773,
0.49596405029296875,
0.6953400373458862,
-0.5154115557670593,
0.32706138491630554,
-0.5987439155578613,
0.37403568625450134,
-0.41323035955429077,
-0.779450714588165... |
func (c *Client) GetBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return cfg, err
}
bucketReplicationCfg, err := c.getBucketReplication(ctx, bucketName)
if err != nil {
errRes... | [
-1.0321506261825562,
0.7531440258026123,
0.532677948474884,
0.05617040768265724,
-0.3535156548023224,
-0.5922873020172119,
0.024316702038049698,
0.1347259283065796,
-0.09741050750017166,
0.2060748189687729,
-0.5606793165206909,
0.6573230028152466,
-0.37768101692199707,
-0.6055521368980408,... |
func (c *Client) getBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error) {
// Get resources properly escaped and lined up before
// using them in http request.
urlValues := make(url.Values)
urlValues.Set("replication", "")
// Execute GET on bucket to get replication config... | [
-1.0631927251815796,
0.4374167025089264,
0.4622649848461151,
-0.4204542338848114,
-0.4148165285587311,
-0.9024047255516052,
-0.5531867146492004,
0.1664964258670807,
-0.4815620183944702,
-0.011283806525170803,
-0.6832695007324219,
0.8197710514068604,
-0.15115918219089508,
-0.425072491168975... |
func (c *Client) GetBucketReplicationMetrics(ctx context.Context, bucketName string) (s replication.Metrics, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return s, err
}
// Get resources properly escaped and lined up before
// using them in http request.
url... | [
-0.6220515966415405,
0.6274973154067993,
0.2831760048866272,
-0.4513792097568512,
-0.3291611969470978,
-0.23945888876914978,
-0.3440602123737335,
0.05297069251537323,
-0.6126581430435181,
0.29268455505371094,
-1.0247948169708252,
1.2083327770233154,
-0.5412262678146362,
-0.3708966970443725... |
func mustGetUUID() string {
u, err := uuid.NewRandom()
if err != nil {
return ""
}
return u.String()
} | [
-0.08751475811004639,
-0.19102464616298676,
0.5472753047943115,
-0.1403121054172516,
-0.18882489204406738,
1.2603098154067993,
-1.0020731687545776,
0.8160364627838135,
0.28948044776916504,
-0.1217702180147171,
0.31997618079185486,
0.8819503784179688,
-0.44615843892097473,
-0.13471540808677... |
func (c *Client) ResetBucketReplication(ctx context.Context, bucketName string, olderThan time.Duration) (rID string, err error) {
rID = mustGetUUID()
_, err = c.resetBucketReplicationOnTarget(ctx, bucketName, olderThan, "", rID)
if err != nil {
return rID, err
}
return rID, nil
} | [
-0.9329556226730347,
0.3987712264060974,
0.4398983120918274,
-0.09164442121982574,
0.2749383747577667,
-0.4685128629207611,
0.03571849316358566,
0.44376659393310547,
-1.0020865201950073,
0.1441870778799057,
-0.609025239944458,
0.9211616516113281,
-0.908858060836792,
-1.2310175895690918,
... |
func (c *Client) ResetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn string) (replication.ResyncTargetsInfo, error) {
return c.resetBucketReplicationOnTarget(ctx, bucketName, olderThan, tgtArn, mustGetUUID())
} | [
-0.20625872910022736,
-0.1356198638677597,
0.27791059017181396,
-0.2009047567844391,
0.5640100240707397,
-1.2295891046524048,
-0.09490367025136948,
0.19760659337043762,
-0.7568760514259338,
-0.47813060879707336,
-0.9507851600646973,
1.2291041612625122,
-0.29695194959640503,
-1.130518913269... |
func (c *Client) resetBucketReplicationOnTarget(ctx context.Context, bucketName string, olderThan time.Duration, tgtArn, resetID string) (rinfo replication.ResyncTargetsInfo, err error) {
// Input validation.
if err = s3utils.CheckValidBucketName(bucketName); err != nil {
return
}
// Get resources properly escape... | [
-0.6163164973258972,
-0.16048207879066467,
0.5675162076950073,
-0.8308187127113342,
0.12106616050004959,
-1.1360828876495361,
-0.45258787274360657,
-0.14531128108501434,
-0.6462012529373169,
0.29670852422714233,
-0.8903775811195374,
1.1710132360458374,
-0.10365372896194458,
-0.890158236026... |
func (c *Client) GetBucketReplicationResyncStatus(ctx context.Context, bucketName, arn string) (rinfo replication.ResyncTargetsInfo, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return rinfo, err
}
// Get resources properly escaped and lined up before
// usin... | [
-0.32285642623901367,
-0.059889476746320724,
0.4636942744255066,
-0.7715539932250977,
0.14707697927951813,
-1.2095474004745483,
-0.6014721989631653,
0.5033205151557922,
-0.2709144353866577,
0.054892417043447495,
-1.167716383934021,
1.3045408725738525,
0.07955750823020935,
-0.97691386938095... |
func (c *Client) GetBucketReplicationMetricsV2(ctx context.Context, bucketName string) (s replication.MetricsV2, err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return s, err
}
// Get resources properly escaped and lined up before
// using them in http request.
... | [
-0.49106723070144653,
-0.45362696051597595,
0.1745138168334961,
-0.42482903599739075,
-0.6049423813819885,
-0.28841784596443176,
-0.5141730308532715,
-0.2539508640766144,
-0.8000125288963318,
0.31586191058158875,
-0.8285715579986572,
1.528742790222168,
-0.38108500838279724,
-0.105150058865... |
func (c *Client) CheckBucketReplication(ctx context.Context, bucketName string) (err error) {
// Input validation.
if err := s3utils.CheckValidBucketName(bucketName); err != nil {
return err
}
// Get resources properly escaped and lined up before
// using them in http request.
urlValues := make(url.Values)
url... | [
-1.2072092294692993,
0.3051694333553314,
0.5188324451446533,
-0.08188735693693161,
-0.06128272786736488,
-0.5418297648429871,
-0.2391563206911087,
0.09160637110471725,
-0.3718470335006714,
0.6010940074920654,
-0.2983211278915405,
0.900529146194458,
-0.2333509474992752,
-0.01993180625140667... |
func NewModelManager() *Manager {
return &Manager{}
} | [
-1.366104245185852,
-0.6733715534210205,
0.1082562655210495,
-0.14054404199123383,
-0.551845371723175,
-0.4675118029117584,
-0.8686931729316711,
-0.6286109685897827,
0.46692684292793274,
-0.8567706942558289,
-1.6637897491455078,
-0.1363159865140915,
-0.5016506314277649,
1.6996127367019653,... |
func NewModelManagerFromTransaction(tx gorp.SqlExecutor) (*Manager, error) {
m := &Manager{}
err := m.Hijack(tx)
if err != nil {
return nil, err
}
return m, nil
} | [
0.4819747805595398,
-0.4797531068325043,
0.22015561163425446,
0.4941573143005371,
0.27855390310287476,
-0.19196653366088867,
-0.8780479431152344,
-0.748220682144165,
-0.08375611901283264,
-0.2045617401599884,
-1.0657496452331543,
-0.6246861815452576,
0.3612253963947296,
0.5061588883399963,... |
func incrementCounter(w http.ResponseWriter, req *http.Request) {
reqBody, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Printf("Body read error, %v", err)
w.WriteHeader(500) // Return 500 Internal Server Error.
return
}
//Parse body into Value-struct (e.g. counter). Add +1 to given counter.
//In case... | [
-0.7846291065216064,
-0.06645738333463669,
0.9663466811180115,
0.2655782401561737,
-0.7360666990280151,
0.08212599903345108,
0.4720512330532074,
-0.0969218835234642,
0.28351932764053345,
-0.20815864205360413,
0.05045495554804802,
0.1585841327905655,
-0.05857180431485176,
0.908026397228241,... |
func decrementCounter(w http.ResponseWriter, req *http.Request) {
reqBody, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Printf("Body read error, %v", err)
w.WriteHeader(500) // Return 500 Internal Server Error.
return
}
//Parse body into Value-struct (e.g. counter). Subtract -1 to given counter.
//In ... | [
-0.5008478164672852,
-0.07389087975025177,
1.0328600406646729,
0.15812261402606964,
-0.410386860370636,
0.09370539337396622,
0.6903232336044312,
0.19396325945854187,
0.0031932739075273275,
-0.053671903908252716,
0.1105080246925354,
-0.01753285340964794,
-0.39732617139816284,
0.977531969547... |
func returnValue(w http.ResponseWriter, req *http.Request) {
reqBody, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Printf("Body read error, %v", err)
w.WriteHeader(500) // Return 500 Internal Server Error.
return
}
var counter Value
json.Unmarshal(reqBody, &counter)
//Server-sided limit of [-10000, 1... | [
0.013435820117592812,
-0.055652499198913574,
0.8893922567367554,
-0.01991904154419899,
-0.15565825998783112,
0.014824578538537025,
0.41860488057136536,
-0.05846640467643738,
-0.15490862727165222,
0.6082950830459595,
0.8511240482330322,
0.35546183586120605,
-0.16799306869506836,
0.520068109... |
func resetValue(w http.ResponseWriter, req *http.Request) {
reqBody, _ := ioutil.ReadAll(req.Body)
var counter Value
json.Unmarshal(reqBody, &counter)
counter.Value = 0
json.NewEncoder(w).Encode(counter)
} | [
-0.40407562255859375,
-0.0879153162240982,
0.6352139115333557,
-0.10190482437610626,
0.6012054681777954,
0.29926443099975586,
-0.10549109429121017,
0.1566082090139389,
-0.7205049395561218,
0.5168596506118774,
0.07669487595558167,
0.8041375875473022,
-0.11705997586250305,
0.0817363858222961... |
func (r *RVAD) DisplayContent() string {
str := "Relative Volume Adjustment\n"
str = fmt.Sprintf("%sRight\n\tIncrement: %t\n\tRelative Volume: %fdb\n\tPeak: %fdb\n",
str, r.IncrementRight, r.RelativeRight, r.PeakRight)
str = fmt.Sprintf("%sLeft\n\tIncrement: %t\n\tRelative Volume: %fdb\n\tPeak: %fdb\n",
str, r.... | [
0.5528252720832825,
-1.2225382328033447,
1.0798745155334473,
-1.0646717548370361,
-0.5916620492935181,
0.6805465221405029,
0.24993905425071716,
-1.2534302473068237,
-0.46143218874931335,
0.6654521226882935,
1.1183139085769653,
-0.12258120626211166,
-0.6932889223098755,
-0.49619507789611816... |
func (r *RVAD) GetName() string {
if r.Version == Version4 {
return fmt.Sprintf("%s (deprecated)", r.Name)
}
return r.Name
} | [
-0.013518976978957653,
-0.3827771246433258,
0.607524037361145,
-0.07169812172651291,
-0.34094107151031494,
-0.4750575125217438,
-1.1519203186035156,
-0.11440400779247284,
-0.1626487821340561,
1.367063283920288,
0.10395728796720505,
0.1680566817522049,
-0.7563610672950745,
0.018392005935311... |
func (r *RVAD) ProcessData(s int, d []byte) IFrame {
r.Size = s
r.Data = d
if len(d) < 3 {
return r
}
// let's not just blindly check all these lengths...
defer func() IFrame {
if x := recover(); x != nil {
// a panic happened!
}
return r
}()
r.IncrementRight = GetBoolBit(d[0], 7)
r.IncrementLeft... | [
0.0015323986299335957,
0.4582757353782654,
0.9056684970855713,
-0.5241493582725525,
-0.3517380654811859,
-0.30685073137283325,
0.23951642215251923,
-0.1998940408229828,
0.7975939512252808,
0.4498065114021301,
0.1928345113992691,
0.42563462257385254,
-0.5816476941108704,
0.1726473569869995,... |
func (handler *LikesHandler) GetLikes(response http.ResponseWriter, request *http.Request) {
user := request.Context().Value(general.Credentials{}).(general.Credentials)
offsetMax := request.Context().Value(general.OffsetMax{}).(general.OffsetMax)
offset, max := offsetMax.Offset, offsetMax.Max
handler.Logger.Printf... | [
-0.948265016078949,
0.3593020737171173,
0.9981306791305542,
-0.3938347101211548,
-0.3983166515827179,
0.5732916593551636,
-0.314214825630188,
-0.7553674578666687,
-0.3993452787399292,
-0.6662126779556274,
-0.034659840166568756,
1.087706446647644,
-0.41609179973602295,
0.5132846236228943,
... |
func (handler *LikesHandler) GetDislikes(response http.ResponseWriter, request *http.Request) {
user := request.Context().Value(general.Credentials{}).(general.Credentials)
offsetMax := request.Context().Value(general.OffsetMax{}).(general.OffsetMax)
offset, max := offsetMax.Offset, offsetMax.Max
handler.Logger.Pri... | [
-0.9849913716316223,
0.16700707376003265,
0.9399033784866333,
-0.1586988866329193,
-0.06017955392599106,
0.486533522605896,
-0.13936881721019745,
-0.8429781198501587,
-0.5000750422477722,
-1.0710346698760986,
0.1242763102054596,
1.1982847452163696,
-0.12864823639392853,
0.6281811594963074,... |
func CombineSources(s ...Source) Source {
return &compositeSource{
sources: s,
}
} | [
0.2486419677734375,
0.3364312946796417,
0.1427372694015503,
-0.04763633757829666,
0.2890135943889618,
-0.8640071749687195,
-0.7449569702148438,
0.2003086656332016,
0.6716513633728027,
-0.7781689763069153,
-0.3548244535923004,
-0.9100291132926941,
-0.5256580710411072,
-0.18471470475196838,
... |
func (node *AkhNode) timeValid(s Signable) bool {
currentTimeStamp := GetTimeStamp()
currentSlotStart := node.poll.GetCurrentSlotStart(currentTimeStamp)
return s.GetTimestamp() > currentSlotStart && s.GetTimestamp() < currentTimeStamp
} | [
-0.26154541969299316,
-1.0939642190933228,
0.6730579733848572,
0.14818936586380005,
-1.3202283382415771,
0.5829449892044067,
-0.6983809471130371,
-0.5044852495193481,
-0.10600098967552185,
0.7665466666221619,
-0.2161119133234024,
0.27906033396720886,
-0.27435097098350525,
0.677394270896911... |
func (node *AkhNode) Receive(bd BlockData, peerId peer.ID) {
node.Lock()
defer node.Unlock()
if bd.Hash == node.Head.Hash {
return
}
//in case we've just joined network we have no option but to trust first block we received is valid
//and download whole chain from peer sent it.
//Known attack here is fraud p... | [
0.20544826984405518,
-0.5543327927589417,
0.8629440069198608,
0.26407715678215027,
0.2700638771057129,
0.13932092487812042,
-0.4915403127670288,
-0.24459567666053772,
0.031197618693113327,
-0.09154938906431198,
0.27132707834243774,
0.806136429309845,
-0.6094531416893005,
0.5559259057044983... |
func (node *AkhNode) switchToLongest(forkTip BlockData, peerId peer.ID) {
myForkLen := 0
hisForkLen := 0
myBlock := node.Head
hisBlock := &Block{BlockData: forkTip}
for {
for hisBlock.GetTimestamp() > myBlock.GetTimestamp() {
var err error
hisBlock, err = node.getParent(hisBlock, peerId)
if err != ni... | [
0.11642353236675262,
-0.6343427896499634,
0.8076595067977905,
0.22664093971252441,
0.29091331362724304,
-0.7558885216712952,
-0.0314720943570137,
-0.2983495593070984,
0.024899479001760483,
0.18536312878131866,
-0.18634507060050964,
0.8646913170814514,
-0.25046733021736145,
0.44872003793716... |
func DefaultConfig() *Config {
return &Config{
Port: defaultPort,
AutoConnect: false,
AllowReconnect: false,
ReconnectSeconds: 5,
}
} | [
0.593299150466919,
0.3380577862262726,
0.2384341061115265,
0.32166168093681335,
0.3312165439128876,
0.21785224974155426,
0.38430288434028625,
0.12974774837493896,
-0.27902624011039734,
-0.05800908803939819,
-0.602395236492157,
-0.18518981337547302,
-0.9600643515586853,
0.15946689248085022,... |
func ReadConfig(source interface{}) (*Config, error) {
iniValues, err := ini.Load(source)
if err != nil {
return nil, err
}
cfg := DefaultConfig()
err = iniValues.MapTo(cfg)
if err != nil {
return nil, err
}
if cfg.CommandFile != "" {
cmd, err := ReadCommands(cfg.CommandFile)
if err != nil {
return... | [
-0.17102238535881042,
0.21684110164642334,
0.48949453234672546,
0.3146001398563385,
-0.2654626667499542,
0.06929280608892441,
0.02168489806354046,
0.6627489328384399,
-0.5350825786590576,
-0.22577035427093506,
-0.21510204672813416,
-0.3400261700153351,
-0.30339404940605164,
0.7202079892158... |
func ReadCommands(path string) (CommandSet, error) {
d, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("failed to read commands: %v", err)
}
c := make([]Command, 0)
err = yaml.Unmarshal(d, &c)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal commands YAML: %v", err)
}
return Ne... | [
0.05045471712946892,
-0.24873991310596466,
0.6685178279876709,
-0.5344712734222412,
-0.22643989324569702,
-0.6001003980636597,
-0.15279388427734375,
-0.6758005619049072,
-0.5562250018119812,
-0.6440544724464417,
0.7222363948822021,
0.1835891753435135,
-0.2522154450416565,
-0.26861074566841... |
func newEndpointCache(factory Factory, logger log.Logger, options endpointerOptions) *endpointCache {
return &endpointCache{
options: options,
factory: factory,
cache: map[string]endpointCloser{},
logger: logger,
timeNow: time.Now,
}
} | [
-0.5666117072105408,
-0.5698586702346802,
0.5517116189002991,
0.7615570425987244,
-0.710500955581665,
-0.006422745529562235,
-0.6733788251876831,
0.5567828416824341,
0.2600051760673523,
0.917154848575592,
0.3992019295692444,
-0.4312874376773834,
-0.6115109920501709,
0.18222583830356598,
... |
func (c *endpointCache) Update(event Event) {
c.mtx.Lock()
defer c.mtx.Unlock()
// Happy path.
if event.Err == nil {
c.updateCache(event.Instances)
c.err = nil
return
}
// Sad path. Something's gone wrong in sd.
c.logger.Log("err", event.Err)
if !c.options.invalidateOnError {
return // keep returning ... | [
-0.7809186577796936,
-0.24782361090183258,
0.39778581261634827,
0.6011020541191101,
-0.7052214741706848,
0.11698079854249954,
-0.5191403031349182,
0.08380156755447388,
0.35912421345710754,
0.6053832769393921,
0.4929971396923065,
-0.21634146571159363,
-0.16818250715732574,
-0.61462241411209... |
func (c *endpointCache) Endpoints() ([]endpoint.Endpoint, error) {
// in the steady state we're going to have many goroutines calling Endpoints()
// concurrently, so to minimize contention we use a shared R-lock.
c.mtx.RLock()
if c.err == nil || c.timeNow().Before(c.invalidateDeadline) {
defer c.mtx.RUnlock()
... | [
-0.7995713353157043,
-0.05085083842277527,
0.3573283851146698,
0.7518107891082764,
0.06352401524782181,
-0.4389660656452179,
-0.21149036288261414,
-0.2798752784729004,
0.35774049162864685,
-0.03045744076371193,
0.821992039680481,
-0.21321024000644684,
-0.8032684326171875,
-0.53325039148330... |
func ParseTodayHHMMSS(layout, value string) (time.Time, error) {
t, err := time.ParseInLocation(layout, value, time.Local)
if err != nil {
return t, err
}
year, month, day := time.Now().Date()
t = time.Date(year, month, day,
t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local)
return t, nil
} | [
-0.20401506125926971,
0.07149787247180939,
0.4060937464237213,
-0.34163084626197815,
-0.22781513631343842,
-0.3199729323387146,
-0.36044415831565857,
-1.2467817068099976,
0.39552268385887146,
0.052357159554958344,
-0.9298982620239258,
-0.7141090631484985,
0.3731127977371216,
0.177466779947... |
func DefaultParseTodayHHMMSS(value string) (time.Time, error) {
return ParseTodayHHMMSS("15:04:05", value)
} | [
-0.44519129395484924,
0.3752642571926117,
0.18131713569164276,
-0.04389603063464165,
0.6795220971107483,
-0.21364076435565948,
-0.4813655614852905,
-1.5454434156417847,
-0.1455700397491455,
0.11477283388376236,
-1.1871024370193481,
-1.393002986907959,
-0.5436773896217346,
0.594024121761322... |
func ParseHHMMSS(layout, value string) (time.Time, error) {
t, err := ParseTodayHHMMSS(layout, value)
if err != nil {
return t, err
} else if t.After(time.Now()) {
t = t.AddDate(0, 0, -1)
}
return t, nil
} | [
-0.5240921378135681,
0.45598602294921875,
0.43666112422943115,
-0.1255788505077362,
-0.6265943050384521,
-0.45246344804763794,
-0.24077637493610382,
-0.9385790824890137,
0.626288652420044,
-0.17636314034461975,
-0.3331283926963806,
-0.998512327671051,
-0.15863242745399475,
0.70413875579833... |
func DefaultParseHHMMSS(value string) (time.Time, error) {
return ParseHHMMSS("15:04:05", value)
} | [
0.0013282550498843193,
0.0996684804558754,
0.09913346916437149,
-0.058698706328868866,
0.4231421947479248,
-0.32637348771095276,
-0.8784316182136536,
-1.2762359380722046,
0.1681714504957199,
-0.15808705985546112,
-1.4098018407821655,
-1.3516767024993896,
-0.8621786832809448,
0.609728336334... |
func (resource *Coverage) MarshalJSON() ([]byte, error) {
resource.ResourceType = "Coverage"
// Dereferencing the pointer to avoid infinite recursion.
// Passing in plain old x (a pointer to Coverage), would cause this same
// MarshallJSON function to be called again
return json.Marshal(*resource)
} | [
0.11552251130342484,
-0.5450937151908875,
0.25409406423568726,
-0.24659550189971924,
-0.7020507454872131,
-0.390516459941864,
0.38483357429504395,
0.15406890213489532,
1.5385686159133911,
-0.2436642199754715,
0.03809775784611702,
0.3156302273273468,
0.11403685808181763,
1.0884373188018799,... |
func (this *domainController) Page(ctx *context.Context) {
defer hret.HttpPanic()
if !hrpc.BasicAuth(ctx.Request) {
hret.Error(ctx.ResponseWriter, 403, i18n.NoAuth(ctx.Request))
return
}
rst, err := groupcache.GetStaticFile("DomainPage")
if err != nil {
hret.Error(ctx.ResponseWriter, 404, i18n.Get(ctx.Requ... | [
-0.7744898200035095,
0.821656346321106,
0.7665936946868896,
0.3154124915599823,
0.5688208937644958,
0.41355201601982117,
0.562978208065033,
-0.5147784948348999,
-0.5174672603607178,
0.3133697211742401,
1.706358551979065,
-0.4269782304763794,
-0.08214258402585983,
0.5470814108848572,
0.47... |
func (this *domainController) Get(ctx *context.Context) {
ctx.Request.ParseForm()
// 权限控制
if !hrpc.BasicAuth(ctx.Request) {
hret.Error(ctx.ResponseWriter, 403, i18n.NoAuth(ctx.Request))
return
}
rst, err := this.models.Get()
if err != nil {
logs.Error(err)
hret.Error(ctx.ResponseWriter, 421, i18n.Get(ct... | [
-1.296061635017395,
0.17446476221084595,
0.8565702438354492,
0.14614111185073853,
0.4294807016849518,
0.11694938689470291,
-0.23297451436519623,
-1.4659690856933594,
-0.6257264614105225,
-0.02655622735619545,
0.624410092830658,
0.4863433241844177,
0.3349216878414154,
0.5056432485580444,
... |
func (this *domainController) Post(ctx *context.Context) {
ctx.Request.ParseForm()
// Check user permissions
if !hrpc.BasicAuth(ctx.Request) {
hret.Error(ctx.ResponseWriter, 403, i18n.NoAuth(ctx.Request))
return
}
form := ctx.Request.Form
// get user connection information from cookie
cookie, _ := ctx.Requ... | [
-0.2917497456073761,
0.04643187299370766,
0.9187854528427124,
0.5498605966567993,
-0.46796393394470215,
0.9064737558364868,
-0.1906251162290573,
-1.132506251335144,
-0.40015891194343567,
-0.8497593402862549,
-0.13959990441799164,
0.18734923005104065,
-0.07129091769456863,
0.610697269439697... |
func (this *domainController) Put(ctx *context.Context) {
ctx.Request.ParseForm()
if !hrpc.BasicAuth(ctx.Request) {
hret.Error(ctx.ResponseWriter, 403, i18n.NoAuth(ctx.Request))
return
}
form := ctx.Request.Form
cookie, _ := ctx.Request.Cookie("Authorization")
jclaim, err := jwt.ParseJwt(cookie.Value)
if ... | [
-0.6822613477706909,
0.1787617951631546,
0.7036911249160767,
-0.08386427164077759,
-0.6711775064468384,
0.8247745037078857,
0.5380365252494812,
-0.5334039926528931,
0.08524437248706818,
0.07641191780567169,
0.1537531316280365,
0.6545640230178833,
-0.259010374546051,
0.5165063738822937,
0... |
func NewAccessPackageAssignment()(*AccessPackageAssignment) {
m := &AccessPackageAssignment{
Entity: *NewEntity(),
}
return m
} | [
-0.6559849977493286,
-0.9409039616584778,
0.2511531412601471,
0.35609257221221924,
-1.1473184823989868,
-0.47368520498275757,
0.1348247528076172,
0.8498191833496094,
0.06449993699789047,
0.3182823657989502,
1.0673182010650635,
-0.43188339471817017,
0.03616960719227791,
0.22251364588737488,... |
func CreateAccessPackageAssignmentFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewAccessPackageAssignment(), nil
} | [
0.27442771196365356,
-0.6097331047058105,
0.4208325743675232,
0.05213740095496178,
-1.2829691171646118,
0.04894273355603218,
0.6417543888092041,
0.4923454225063324,
0.3821767568588257,
-0.10988851636648178,
0.656775712966919,
0.009453125298023224,
0.3803982138633728,
0.6291499137878418,
... |
func (m *AccessPackageAssignment) GetAccessPackage()(AccessPackageable) {
return m.accessPackage
} | [
0.08274610340595245,
-0.5377981066703796,
0.5074567794799805,
0.6746581196784973,
-0.6538739204406738,
0.4128938913345337,
0.6241918206214905,
-0.0584227554500103,
0.6886891722679138,
0.09416904300451279,
1.9873454570770264,
0.33742815256118774,
0.08110477775335312,
0.009334452450275421,
... |
func (m *AccessPackageAssignment) GetAssignmentPolicy()(AccessPackageAssignmentPolicyable) {
return m.assignmentPolicy
} | [
-0.12866787612438202,
-0.01564960740506649,
0.15583553910255432,
0.3773180842399597,
-0.15904228389263153,
1.3435622453689575,
0.26057448983192444,
0.6926391124725342,
-0.13587482273578644,
0.6133553981781006,
1.3566430807113647,
0.23124255239963531,
0.8288589715957642,
0.3734447658061981,... |
func (m *AccessPackageAssignment) GetExpiredDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
return m.expiredDateTime
} | [
-0.2094990760087967,
0.13830679655075073,
0.6962980628013611,
-0.1770355999469757,
-0.5692830085754395,
-0.002422590972855687,
-0.7090051770210266,
1.3764147758483887,
0.042717304080724716,
0.2047143280506134,
0.5415456295013428,
0.31422969698905945,
-0.8810316920280457,
1.4693795442581177... |
func (m *AccessPackageAssignment) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.Entity.GetFieldDeserializers()
res["accessPackage"] = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.SetObjectValue(CreateA... | [
-0.16994637250900269,
0.1579357236623764,
0.7014608979225159,
-0.9231079816818237,
-0.5378286838531494,
0.033954549580812454,
-0.08469115942716599,
0.6617202162742615,
-0.4643069803714752,
-0.1382240504026413,
-0.10376989841461182,
-0.055802226066589355,
-0.1959327608346939,
0.142330661416... |
func (m *AccessPackageAssignment) GetSchedule()(EntitlementManagementScheduleable) {
return m.schedule
} | [
0.01252562552690506,
-0.31536760926246643,
0.33013907074928284,
0.3862166404724121,
-0.07059435546398163,
0.25112783908843994,
-0.08194706588983536,
0.49603503942489624,
0.8368659019470215,
-0.310927152633667,
1.6287028789520264,
-0.0369500033557415,
-0.06884628534317017,
-0.02572266384959... |
func (m *AccessPackageAssignment) GetState()(*AccessPackageAssignmentState) {
return m.state
} | [
-0.3650538921356201,
-0.25464165210723877,
0.3982672691345215,
0.7983953356742859,
-0.4787754416465759,
0.2968854010105133,
0.4016438126564026,
0.6594662666320801,
0.4784085154533386,
0.028558891266584396,
1.1929173469543457,
0.3854873776435852,
0.03961282595992088,
0.41552141308784485,
... |
func (m *AccessPackageAssignment) GetStatus()(*string) {
return m.status
} | [
0.060955729335546494,
-0.42807871103286743,
0.339165598154068,
0.7570688724517822,
-0.16934216022491455,
1.313169240951538,
0.35500097274780273,
1.2493677139282227,
0.8052641153335571,
0.5060222744941711,
0.7578088641166687,
0.5082868337631226,
0.4760758578777313,
0.4702308475971222,
0.7... |
func (m *AccessPackageAssignment) GetTarget()(AccessPackageSubjectable) {
return m.target
} | [
-0.010453942231833935,
-0.028590410947799683,
0.28056788444519043,
0.3196589946746826,
0.301656037569046,
0.6010549664497375,
0.2840096652507782,
0.19654621183872223,
0.4174676239490509,
-0.26936864852905273,
1.941007375717163,
0.47720423340797424,
0.156488299369812,
-0.46176284551620483,
... |
func (m *AccessPackageAssignment) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Entity.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteObjectValue("accessPackage", m.GetAccessPackage())
... | [
-0.8204444050788879,
-0.09904011338949203,
0.5223073959350586,
-0.2889355719089508,
-0.23536255955696106,
-0.4031778872013092,
0.2952519953250885,
0.17928984761238098,
-0.16445864737033844,
0.9317800402641296,
0.42885589599609375,
0.09783680737018585,
0.21700935065746307,
0.605373799800872... |
func (m *AccessPackageAssignment) SetAccessPackage(value AccessPackageable)() {
m.accessPackage = value
} | [
-0.06914869695901871,
-0.13417494297027588,
0.2516023516654968,
0.3963223099708557,
-0.7203301787376404,
0.5178977847099304,
0.5852834582328796,
0.0822170227766037,
0.327989786863327,
0.2754169702529907,
1.2645703554153442,
-0.5689737796783447,
0.2679230272769928,
0.38299673795700073,
0.... |
func (m *AccessPackageAssignment) SetAssignmentPolicy(value AccessPackageAssignmentPolicyable)() {
m.assignmentPolicy = value
} | [
-0.11449816823005676,
0.39142900705337524,
-0.047509707510471344,
0.31637343764305115,
-0.19947116076946259,
1.5701920986175537,
0.369774729013443,
0.6484928131103516,
-0.8090069890022278,
0.9455205202102661,
0.812258780002594,
-0.5233843326568604,
1.1678211688995361,
0.8468756079673767,
... |
func (m *AccessPackageAssignment) SetExpiredDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
m.expiredDateTime = value
} | [
-0.95535808801651,
0.3607415556907654,
0.44071000814437866,
-0.004843814764171839,
-0.6745303869247437,
0.266273558139801,
-0.38677942752838135,
0.8501877188682556,
-0.45886439085006714,
0.38731610774993896,
-0.4737092852592468,
-0.6839460134506226,
-0.3700005114078522,
1.6020163297653198,... |
func (m *AccessPackageAssignment) SetSchedule(value EntitlementManagementScheduleable)() {
m.schedule = value
} | [
-0.45750105381011963,
0.5364022254943848,
0.07517772912979126,
0.5426504015922546,
-0.343641072511673,
0.416795015335083,
-0.06491876393556595,
0.7230017781257629,
0.1119760274887085,
-0.049714915454387665,
0.9717923998832703,
-0.6193063855171204,
-0.011394856497645378,
0.37784501910209656... |
func (m *AccessPackageAssignment) SetState(value *AccessPackageAssignmentState)() {
m.state = value
} | [
-0.9864667654037476,
0.5124108195304871,
0.27287063002586365,
0.7497159838676453,
-0.9735179543495178,
0.5480254292488098,
0.33403363823890686,
0.835690975189209,
0.06643641740083694,
0.21721674501895905,
0.826961100101471,
-0.09543220698833466,
0.2974148988723755,
0.8831219673156738,
-0... |
func (m *AccessPackageAssignment) SetStatus(value *string)() {
m.status = value
} | [
-0.5032256245613098,
0.11725356429815292,
0.13467031717300415,
1.002958059310913,
-0.8308823704719543,
1.7261234521865845,
0.3881462812423706,
1.3954777717590332,
0.08328614383935928,
0.37035712599754333,
0.30728229880332947,
-0.18612362444400787,
0.9614965319633484,
1.0906609296798706,
... |
func (m *AccessPackageAssignment) SetTarget(value AccessPackageSubjectable)() {
m.target = value
} | [
-0.5901898145675659,
0.7117050290107727,
0.14685237407684326,
0.41463810205459595,
-0.01389475166797638,
0.8437547087669373,
0.20457151532173157,
0.3447898328304291,
-0.09796040505170822,
0.10302688926458359,
1.257066249847412,
-0.28626173734664917,
0.4887124300003052,
-0.04009526968002319... |
func Perm(a []int, f func([]int)) {
perm(a, f, 0)
} | [
0.3846266567707062,
0.806768000125885,
0.26213064789772034,
0.8254505395889282,
-0.3022734522819519,
-0.29363590478897095,
0.8742026686668396,
0.8132275938987732,
0.0030965807382017374,
0.15567204356193542,
0.5916332602500916,
0.1793050318956375,
0.3240703046321869,
-0.09048173576593399,
... |
func perm(a []int, f func([]int), i int) {
if i > len(a) {
f(a)
return
}
perm(a, f, i+1)
for j := i + 1; j < len(a); j++ {
a[i], a[j] = a[j], a[i]
perm(a, f, i+1)
a[i], a[j] = a[j], a[i]
}
} | [
0.3462931215763092,
1.3442952632904053,
0.4918411672115326,
0.15549200773239136,
-0.6464293599128723,
-0.30401915311813354,
1.505351185798645,
0.6483693718910217,
0.34687551856040955,
0.32916244864463806,
0.15106892585754395,
-0.24837639927864075,
0.12936174869537354,
-0.1535426676273346,
... |
func getFlag(query bool, authority bool) uint16 {
var out uint16
if !query {
out |= 1
}
if authority {
out |= 1 << 5
}
return out
} | [
0.1425873190164566,
1.6674277782440186,
0.31771913170814514,
0.7258470058441162,
0.4795297682285309,
0.6296519637107849,
-0.13247591257095337,
0.1759374737739563,
-0.18901298940181732,
-1.2463496923446655,
-0.027717942371964455,
0.5525160431861877,
-0.6106435060501099,
0.6143984794616699,
... |
func IpToDnsRecordType(ip net.IP) uint16 {
if ip4 := ip.To4(); ip4 != nil {
return A
} else {
return AAAA
}
} | [
-0.35813623666763306,
1.6967300176620483,
0.3996213674545288,
-0.15409107506275177,
0.9247312545776367,
-0.670423686504364,
-0.6030302047729492,
-0.18837779760360718,
1.1146953105926514,
0.374246746301651,
-0.255033016204834,
-0.1835523098707199,
-0.20036689937114716,
-0.09127980470657349,... |
func NewMDNS() *mDNS {
m := mDNS{}
m.conn4 = nil
m.conn6 = nil
return &m
} | [
-0.6271382570266724,
-0.36760997772216797,
0.0319029726088047,
0.29751676321029663,
-0.11843667924404144,
-1.3671302795410156,
-0.10352721065282822,
-1.1676850318908691,
1.5196738243103027,
-0.7196431159973145,
-0.8812513947486877,
0.13160789012908936,
-0.7389549612998962,
-0.0126980114728... |
func (m *mDNS) AddHandler(f func(net.Addr, Packet)) {
m.pHandlers = append(m.pHandlers, f)
} | [
-0.9056183695793152,
1.1346409320831299,
0.22999204695224762,
-0.37914469838142395,
-0.15318238735198975,
0.9940074682235718,
-0.7698952555656433,
0.6629547476768494,
0.8693838715553284,
-1.8934435844421387,
0.0033810720779001713,
-0.21921640634536743,
0.6447688341140747,
0.303862988948822... |
func (m *mDNS) AddWarningHandler(f func(net.Addr, error)) {
m.wHandlers = append(m.wHandlers, f)
} | [
-0.2858332097530365,
1.0267627239227295,
0.19946037232875824,
0.06434141099452972,
-1.103843331336975,
0.889586329460144,
-0.1791602224111557,
-0.3222120702266693,
0.6540960669517517,
-0.14575451612472534,
-0.17880824208259583,
-0.13168571889400482,
0.2011018544435501,
-0.15233193337917328... |
func (m *mDNS) SendTo(ctx context.Context, packet Packet, dst *net.UDPAddr) error {
var buf bytes.Buffer
// TODO(jakehehrlich): Add checking that the packet is well formed.
if err := packet.serialize(&buf); err != nil {
return err
}
if dst.IP.To4() != nil {
if m.conn4 != nil {
return m.conn4.SendTo(ctx, buf... | [
-1.2229830026626587,
1.3176651000976562,
0.5819782614707947,
-0.5301183462142944,
-0.013700109906494617,
-0.7022247910499573,
-0.46820005774497986,
-0.05844537541270256,
0.21504420042037964,
-0.004137785639613867,
-0.42416054010391235,
0.40572115778923035,
0.583742082118988,
-0.26674824953... |
func (m *mDNS) Send(ctx context.Context, packet Packet) error {
var buf bytes.Buffer
// TODO(jakehehrlich): Add checking that the packet is well formed.
if err := packet.serialize(&buf); err != nil {
return err
}
var err4 error
if m.conn4 != nil {
err4 = m.conn4.Send(ctx, buf)
}
var err6 error
if m.conn6 !... | [
-0.6843162178993225,
0.6404852271080017,
0.4262593686580658,
-0.07704862952232361,
0.6493338942527771,
-0.7372716665267944,
-0.4840812385082245,
-0.5520355105400085,
0.4471322000026703,
-0.17578266561031342,
-0.5853918790817261,
0.17244745790958405,
0.12636691331863403,
0.3084859549999237,... |
func (m *mDNS) Start(ctx context.Context, port int) error {
if err := m.initMDNSConns(ctx, port); err != nil {
m.Close()
return err
}
go func() {
// NOTE: This defer statement will close connections, which will force
// the goroutines started by Listen() to exit.
defer m.Close()
var chan4 <-chan receive... | [
0.15043871104717255,
-0.2152165323495865,
0.6058144569396973,
-0.7946134805679321,
-0.09676099568605423,
-0.5911506414413452,
-0.18490009009838104,
-0.4358160197734833,
0.13097824156284332,
-0.5887091159820557,
-0.6749787330627441,
0.8218269944190979,
0.3432939350605011,
0.0047930376604199... |
func QuestionPacket(domain string) Packet {
return Packet{
Header: Header{QDCount: 2},
Questions: []Question{
{
Domain: domain,
Type: AAAA,
Class: IN,
Unicast: false,
},
{
Domain: domain,
Type: A,
Class: IN,
Unicast: false,
},
},
}
} | [
-0.14265522360801697,
-0.4406380355358124,
0.48042136430740356,
0.024164246395230293,
-0.8061946630477905,
0.3099074363708496,
0.5862946510314941,
-0.46227148175239563,
1.4196721315383911,
-1.2082550525665283,
0.05510507524013519,
0.6911017894744873,
-0.11107917129993439,
-0.09003397077322... |
func AnswerPacket(domain string, ip net.IP) Packet {
return Packet{
Header: Header{ANCount: 1},
Answers: []Record{
{
Domain: domain,
Type: IpToDnsRecordType(ip),
Class: IN,
Flush: false,
Data: []byte(ip),
},
},
}
} | [
-0.5349456071853638,
0.7308640480041504,
0.5952640771865845,
-0.4910217821598053,
-0.8513250350952148,
-0.0157849732786417,
0.22855743765830994,
-0.26943814754486084,
0.5579232573509216,
-0.8881178498268127,
0.20242273807525635,
0.5920710563659668,
-0.2507820427417755,
-0.40773889422416687... |
func RegisterPlansService(s grpc.ServiceRegistrar, srv *PlansService) {
srvCopy := *srv
if srvCopy.GetPlan == nil {
srvCopy.GetPlan = func(context.Context, *GetPlanRequest) (*GetPlansResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPlan not implemented")
}
}
if srvCopy.SavePlan ==... | [
-0.2381790280342102,
0.7221057415008545,
0.4028986990451813,
-0.18363827466964722,
0.8008949160575867,
0.41753703355789185,
0.13635265827178955,
-1.2609782218933105,
0.6941561698913574,
0.2606532871723175,
-0.5703718662261963,
1.223629355430603,
-0.252316415309906,
0.5441365242004395,
0.... |
func DeleteCronJob(namespace string, name string) (*batchv1beta1.CronJob, error) {
job, err := GetCronJob(namespace, name)
if err != nil {
return nil, err
}
err = client.BatchV1beta1().CronJobs(namespace).Delete(name, &metav1.DeleteOptions{})
if err != nil {
return job, err
}
return job, nil
} | [
1.2653921842575073,
-0.6352964043617249,
0.08092151582241058,
1.1645978689193726,
-0.03192887082695961,
0.13806846737861633,
-0.23307424783706665,
-0.2442019283771515,
0.08031056076288223,
0.20739541947841644,
-0.47719308733940125,
0.7389242053031921,
-1.369524598121643,
0.3184827566146850... |
func GetCronJobs(namespace string) ([]batchv1beta1.CronJob, error) {
jobs, err := client.BatchV1beta1().CronJobs(namespace).List(metav1.ListOptions{})
if err != nil {
return nil, fmt.Errorf("could not list CronJobs: %s", err)
}
return jobs.Items, nil
} | [
-0.31962820887565613,
0.12531082332134247,
0.11143771559000015,
1.0411756038665771,
0.09867963194847107,
0.008091390132904053,
-0.8354216814041138,
-0.6275150179862976,
-0.05280575901269913,
0.17665305733680725,
-0.9215192198753357,
0.7320572137832642,
-2.0601725578308105,
0.16569203138351... |
func GetPods(namespace string, ownerKind string) ([]corev1.Pod, error) {
pods, err := client.CoreV1().Pods(namespace).List(metav1.ListOptions{})
if err != nil {
return nil, fmt.Errorf("could not get pods from job: %s", err)
}
result := []corev1.Pod{}
for _, pod := range pods.Items {
for _, ownerReference := ra... | [
-0.4229770302772522,
0.4245423674583435,
0.6270126104354858,
0.7097192406654358,
0.7015637159347534,
-0.3147156834602356,
-0.7078046202659607,
-0.9296140074729919,
0.28437158465385437,
0.4652383029460907,
0.7917685508728027,
1.3697123527526855,
-0.7307412028312683,
0.41486918926239014,
0... |
func CreateJobFromCronjob(cronJob *batchv1beta1.CronJob) (*batchv1.Job, error) {
// This duplicates the logic used by kubectl to create a Job from a CronJob
annotations := make(map[string]string)
annotations["cronjob.kubernetes.io/instantiate"] = "manual"
for k, v := range cronJob.Spec.JobTemplate.Annotations {
a... | [
1.3508012294769287,
-0.8445543646812439,
0.2632315456867218,
0.5615934133529663,
-0.08319022506475449,
0.6980385780334473,
-0.8458971381187439,
-0.1692172884941101,
-0.15557736158370972,
0.03452715650200844,
-0.15412211418151855,
0.2363225519657135,
-0.6587643623352051,
-0.2683269679546356... |
func (us *UploadSession) PreSave() {
if us.Id == "" {
us.Id = NewId()
}
if us.CreateAt == 0 {
us.CreateAt = GetMillis()
}
} | [
-0.38016363978385925,
0.2910897731781006,
0.4644449055194855,
0.08385788649320602,
0.7425780296325684,
-0.5594969987869263,
0.09599056839942932,
-0.9370606541633606,
0.310635507106781,
0.2544723451137543,
-0.8882735967636108,
-0.3382734954357147,
-0.31213846802711487,
0.7658058404922485,
... |
func (t UploadType) IsValid() error {
switch t {
case UploadTypeAttachment:
return nil
case UploadTypeImport:
return nil
default:
}
return fmt.Errorf("invalid UploadType %s", t)
} | [
0.6288476586341858,
-0.6930930614471436,
0.6299381852149963,
0.4237646460533142,
0.1372905969619751,
0.5059897303581238,
-0.1600813865661621,
-0.8801576495170593,
0.9833984971046448,
0.04043203964829445,
0.20642472803592682,
0.44463470578193665,
-0.15890420973300934,
0.5601811408996582,
... |
func (us *UploadSession) IsValid() *AppError {
if !IsValidId(us.Id) {
return NewAppError("UploadSession.IsValid", "model.upload_session.is_valid.id.app_error", nil, "", http.StatusBadRequest)
}
if err := us.Type.IsValid(); err != nil {
return NewAppError("UploadSession.IsValid", "model.upload_session.is_valid.t... | [
-0.1496206670999527,
-1.501878023147583,
0.9859670400619507,
0.6910780668258667,
0.33665382862091064,
0.2557641565799713,
-0.14818593859672546,
-1.2039767503738403,
1.017903208732605,
-0.13280253112316132,
0.17457184195518494,
0.5303301811218262,
0.3107442855834961,
0.48693421483039856,
... |
func NewHostAddress(host string, port uint16) *HostAddress {
return &HostAddress{host: host, port: port}
} | [
0.8889230489730835,
-1.3058279752731323,
0.4657953679561615,
-0.16289465129375458,
0.12513819336891174,
-0.14017747342586517,
-0.9313860535621643,
0.3400024175643921,
-0.48722147941589355,
-0.47151243686676025,
-0.4496828317642212,
1.1432675123214722,
-0.49033480882644653,
-0.5259412527084... |
func (this *HostAddress) SetHost(host string) {
this.host = host
} | [
0.6205974221229553,
-0.42593109607696533,
0.30002811551094055,
0.2956894338130951,
-0.49370118975639343,
0.45588424801826477,
-0.597245454788208,
1.0684988498687744,
0.22259224951267242,
-0.4414444863796234,
-0.96083664894104,
0.49987173080444336,
-0.11885012686252594,
-0.355703204870224,
... |
func (this *HostAddress) SetPort(port uint16) {
this.port = port
} | [
1.5529688596725464,
0.22473369538784027,
0.2585861086845398,
0.04293431341648102,
0.7374607920646667,
0.5003254413604736,
0.6131753921508789,
0.532024621963501,
0.5747818350791931,
-0.8257689476013184,
-0.8965293765068054,
0.10827862471342087,
-0.4480818808078766,
-0.2413494884967804,
0.... |
func (this *HostAddress) GetHost() string {
return this.host
} | [
0.7822614312171936,
-0.5585353970527649,
0.46723973751068115,
0.48505809903144836,
-0.017153427004814148,
0.5932461023330688,
-0.16548696160316467,
0.5133681893348694,
0.4136478304862976,
-0.604831337928772,
0.12456068396568298,
0.395804762840271,
-0.3864535391330719,
-1.2358633279800415,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.