text stringlengths 3.08k 10.4k |
|---|
package mpphpfpm
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"time"
mp "github.com/mackerelio/go-mackerel-plugin-helper"
)
// PhpFpmPlugin mackerel plugin
type PhpFpmPlugin struct {
URL string
Prefix string
LabelPrefix string
Timeout uint
}
// PhpFpmStatus struct for Php... |
package mollie
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
)
// Mollie constants holding values to initialize the client and create requests.
const (
BaseURL string = "https://api.mollie.com/"
AuthHeader string = "Authorization"
... |
// Package telegrambot / Telegram Bot API helper
//
// https://core.telegram.org/bots/api
//
// Created on : 2015.10.06, <EMAIL>
//
package telegrambot
import (
"crypto/md5"
"fmt"
"log"
"net"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
const (
apiBaseURL = "https://api.telegram.org/bot"
fileBa... |
/*
Copyright © 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by appli... |
package clusterhandler
import (
"bytes"
"net/http"
"net/http/httputil"
"path"
"strings"
"github.com/emicklei/go-restful/v3"
"github.com/gorilla/websocket"
"kubegems.io/kubegems/pkg/log"
"kubegems.io/kubegems/pkg/utils/agents"
"kubegems.io/kubegems/pkg/v2/services/handlers"
)
const (
AgentModeApiServer = "... |
// Copyright 2017 ETH Zurich
// Copyright 2018 ETH Zurich, Anapaya Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
/*
Package app implements an application "ExampleApp"
Applications
Applications in go-daemon implements any functionality provided by go-language
in home control software compatible with Home Assistant websocket API. All
applications need to be pre-added in the "apps.go" file since go is a compiled
language and does ... |
/*
Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... |
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iam
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type CreateUserInput struct {
_ struct{} `type:"structure"`
// The path for the user name. For more information about ... |
package toil
import (
"sync"
)
type internalGroupDaemon struct {
waitGroup sync.WaitGroup
panicCh chan<- interface{}
lengthCh chan struct{returnCh chan int}
pingCh chan struct{doneCh chan struct{}}
registerCh chan struct{doneCh chan struct{}; toiler Toiler}
toilCh chan struct{doneCh ... |
/*
Copyright (c) 2021 Murex
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicens... |
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package yaml
import (
"github.com/go-vela/types/constants"
"github.com/go-vela/types/pipeline"
"github.com/go-vela/types/raw"
)
type (
// Ruleset is the yaml representa... |
package commands
import (
"fmt"
"github.com/pivotal-cf-experimental/bosh-bootloader/aws/cloudformation"
"github.com/pivotal-cf-experimental/bosh-bootloader/aws/iam"
"github.com/pivotal-cf-experimental/bosh-bootloader/bosh"
"github.com/pivotal-cf-experimental/bosh-bootloader/flags"
"github.com/pivotal-cf-experim... |
package jsonrpc
import (
"context"
"fmt"
"strings"
"time"
"github.com/go-numb/go-bitflyer/auth"
"github.com/go-numb/go-bitflyer/v1/types"
"github.com/sirupsen/logrus"
"github.com/buger/jsonparser"
"github.com/gorilla/websocket"
"golang.org/x/sync/errgroup"
)
func requestsForPrivate(conn *websocket.Conn, k... |
package api
import (
"crypto/rand"
"encoding/json"
"errors"
"fmt"
"math/big"
"net/http"
"github.com/madappgang/identifo/v2/model"
"github.com/madappgang/identifo/v2/web/authorization"
"github.com/madappgang/identifo/v2/web/middleware"
)
const (
phoneVerificationCodeLength = 6
smsVerificationCode =... |
package v2
import (
"context"
"encoding/json"
"go-common/library/net/metadata"
"sort"
"strconv"
)
// Pair ...
// 自定义map排序结构
type Pair struct {
Key int64
Value int64
}
// Gray ...
// 自定义灰度策略结构
type Gray struct {
Key string
Value int
}
// GrayRule ...
// 自定义灰度策略
type GrayRule struct {
Name string `json... |
package orbiter
import (
"errors"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"gopkg.in/yaml.v3"
"github.com/caos/orbos/internal/operator/common"
"github.com/caos/orbos/mntr"
"github.com/caos/orbos/pkg/git"
"github.com/caos/or... |
// Package watch implements better watch semantics on top of etcd.
// See this issue for the reasoning behind the package:
// https://github.com/coreos/etcd/issues/7362
package watch
import (
"bytes"
"context"
"fmt"
"reflect"
etcd "github.com/coreos/etcd/clientv3"
"github.com/gogo/protobuf/proto"
)
// EventTyp... |
package mqs
import (
"context"
"errors"
"math/rand"
"sync"
"time"
"github.com/fnproject/fn/api/common"
"github.com/fnproject/fn/api/models"
"github.com/google/btree"
"github.com/sirupsen/logrus"
)
type MemoryMQ struct {
// WorkQueue A buffered channel that we can send work requests on.
PriorityQueues []ch... |
package main
import (
"fmt"
"io"
"strings"
"text/template"
"go/token"
"github.com/0xfaded/go-testgen"
)
type Test struct{}
var comment = template.Must(template.New("Comment").Parse(
`// Test {{ .Lhs.Name }} {{ .Op.Value }} {{ .Rhs.Name }}
`))
var body = template.Must(template.New("Body").Parse(
` env :... |
package graphqlbackend
import (
"context"
"sort"
"strings"
"time"
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
"github.com/sourcegraph/sourcegraph/internal/vcs/gi... |
package rbt
type BinaryTree struct {
Root *BinaryTreeNode
}
func NewBinaryTree() *BinaryTree {
return &BinaryTree{}
}
func (t *BinaryTree) Insert(key Comparable, v interface{}) (ret bool) {
ret = true
node := NewBinaryTreeNode(key, v)
cur := t.Root
if cur == nil {
t.Root = node
return
}
var parent *Bina... |
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
package gpbrpc
import (
"badoo/_packages/log"
"badoo/_packages/pinba"
"encoding/json"
"net"
"os"
"sync/atomic"
"syscall"
"time"
"github.com/gogo/protobuf/proto"
)
const (
MaxMsgID = 64 // should be enough for everybody, FIXME: this needs to be dynamic, obviously
SleepAfterAcceptError = 500 *... |
package main
import (
"fmt"
"log"
"net/http"
"os"
"os/exec"
"strings"
"time"
"github.com/leekchan/timeutil"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
serversArg = kingpin.Flag("server", "server to use for synchronization, multiple values possible").Short('s').Default("pool.ntp.org", "ntp.org").URLList... |
package client
import (
"encoding/json"
"fmt"
"net/http"
"os"
"path/filepath"
"time"
"github.com/henrytk/calendar-resource/errors"
"github.com/henrytk/calendar-resource/models"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
googleCalendarAPI "google.golang.org/api/calendar/v3"
)
type GoogleCalend... |
package clients
import (
"context"
"fmt"
"os/user"
"path/filepath"
"strings"
log "github.com/sirupsen/logrus"
authenticationapi "k8s.io/api/authentication/v1"
authorizationapi "k8s.io/api/authorization/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
... |
package hamlet_test
import (
"fmt"
"os"
"path"
"strings"
"testing"
"github.com/robocorp/rcc/hamlet"
)
type Nothing struct{}
type Example struct{ Value int }
func TestCanUseTheTestingFramework(t *testing.T) {
to_be, not_to_be := hamlet.Specifications(t)
c := t
c = nil
a, b := 1, 2
d, e := 3.14159, "hupsis... |
// Copyright 2018 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
// Copyright 2019 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
package spoukfw
import (
"time"
"errors"
"fmt"
"strings"
"reflect"
"os"
"io/ioutil"
"encoding/json"
)
const (
def = "[spoukconfig] `%v`"
prefixLogConfig = "[spoukconfig]"
)
var (
ErrorDBSNotReleased = errors.New("[configproxy][error] DBSInterface not released this instanse")
)
var (
cFG_HTTPREADTIMEOUT ... |
//
// Copyright 2019 Insolar Technologies GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law... |
package plan
import (
"fmt"
"math"
"github.com/pkg/errors"
)
// PhysicalPlanner performs transforms a logical plan to a physical plan,
// by applying any registered physical rules.
type PhysicalPlanner interface {
Plan(lplan *PlanSpec) (*PlanSpec, error)
}
// NewPhysicalPlanner creates a new physical plan with ... |
package main
import (
"context"
"errors"
"fmt"
sysplugin "plugin"
"sync"
"github.com/sirupsen/logrus"
"github.com/sportfun/gakisitor/event/bus"
. "github.com/sportfun/gakisitor/plugin"
"github.com/sportfun/gakisitor/profile"
. "github.com/sportfun/gakisitor/protocol/v1.0"
)
func init() {
Gakisitor.Registe... |
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package harness manages the setup and teardown of various Swarming
// bot resources for running lab tasks, like results directories and
// host info... |
package send
import (
"brainbaking.com/go-jamming/app/mf"
"brainbaking.com/go-jamming/common"
"brainbaking.com/go-jamming/db"
"brainbaking.com/go-jamming/mocks"
"brainbaking.com/go-jamming/rest"
"fmt"
"github.com/stretchr/testify/assert"
"net/http"
"net/url"
"sync"
"testing"
)
var conf = &common.Config{
C... |
package metrics
import (
"fmt"
"io"
"math"
"sync"
"time"
)
const (
e10Min = -9
e10Max = 18
bucketsPerDecimal = 18
decimalBucketsCount = e10Max - e10Min
bucketsCount = decimalBucketsCount * bucketsPerDecimal
)
var bucketMultiplier = math.Pow(10, 1.0/bucketsPerDecimal)
// ... |
package gopubsub
import (
"hash/fnv"
"sync"
"unsafe"
)
const (
defaultPubSubTopicCapacity = 100000
notificationCapacity = 10000
initialSubscriberCapacity = 100
)
// PubSub is pubsub messasing object
type PubSub struct {
mu *sync.Mutex
downScaleTgt chan int // Index of the registry to be scal... |
package api
import (
"github.com/MinterTeam/minter-go-node/core/types"
"github.com/MinterTeam/minter-go-node/formula"
"github.com/MinterTeam/minter-go-node/core/state"
"github.com/MinterTeam/minter-go-node/core/state/candidates"
"math/big"
"fmt"
)
type CoinBalance struct {
Coin string `json:"coin"`
Value... |
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "Li... |
package async
import (
"context"
"crypto/rand"
"errors"
"fmt"
"math/big"
"sync"
"time"
"github.com/fleetdm/fleet/v4/server/datastore/redis"
"github.com/fleetdm/fleet/v4/server/fleet"
redigo "github.com/gomodule/redigo/redis"
)
type collector struct {
// immutable after creation
name string
pool ... |
package main
import (
"bufio"
"flag"
"fmt"
"os"
"os/user"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/go-ini/ini"
)
var (
iniConfig = flag.String("config", ".ueversionator", "ueversionator config file")
userIniConfig = flag.String("user-config", ".uev-user", "ueversionator user config f... |
package clusterrole
import (
"context"
clusterv1 "github.com/open-cluster-management/api/cluster/v1"
"github.com/open-cluster-management/multicloud-operators-foundation/pkg/utils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/klog"
ctrl "... |
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.1.0
// - protoc v3.19.1
// source: datasource.proto
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "go... |
package buffer
import (
"net"
"io"
)
// TODO: Add Read/Write VarLong functions
// A Minecraft regulated Buffer.
// Don't recommend directly initializing.
type MiniBuffer struct {
io.Writer
Bytes []byte
ReaderIndex int
WriterIndex int
}
// Returns a new MiniBuffer with a provided Array.
func NewMiniBuffer(b... |
package cmd
import (
"fmt"
"io"
"os"
"strings"
"github.com/linkerd/linkerd2/pkg/k8s"
"github.com/spf13/cobra"
"k8s.io/api/core/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)
type resourceTransformerUninject struct{}
type resourceTransformerUninjectSilent struct{}
// UninjectYAML pr... |
// Copyright (c) 2017 - The Event Horizon authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
/*
Copyright 2018 Iguazio Systems Ltd.
Licensed under the Apache License, Version 2.0 (the "License") with
an addition restriction as set forth herein. You may not use this
file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required b... |
package cmds
import (
"github.com/Qitmeer/qitmeer/core/json"
)
type CreateRawTransactionCmd struct {
Inputs []json.TransactionInput
Amounts json.Amounts
LockTime int64
}
func NewCreateRawTransactionCmd(inputs []json.TransactionInput, amounts json.Amounts, lockTime int64) *CreateRawTransactionCmd {
return &Cr... |
package logtic
import (
"fmt"
"reflect"
"sort"
"time"
)
// StringFromParameters return a key=value string for the given parameters. Depending on the type of the parameter
// value, it may be wrapped in single quotes. Byte slices are represented as hexadecimal strings. Parameters are always
// alphabetically sorte... |
package plugin_loader_filesystem
import (
"context"
"io/ioutil"
"path"
"strings"
"sync"
"time"
"github.com/aperturerobotics/controllerbus/bus"
shared "github.com/aperturerobotics/controllerbus/plugin/loader/shared-library"
debounce_fswatcher "github.com/aperturerobotics/controllerbus/util/debounce-fswatcher"... |
package main
import (
"bufio"
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"strings"
)
type JobSpecProperty struct {
Default string `yaml:"default,omitempty"`
Desc string `yaml:"description"`
}
type JobSpec struct {
Name string
Properties map[string]*JobSpecProperty
}
type Job struct {
Name stri... |
package database
import (
"context"
"fmt"
"math"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/sqlstore"
)
const (
dsAc... |
package cmd
import (
"context"
"fmt"
"io"
"os"
"github.com/linkerd/linkerd2/cli/table"
"github.com/linkerd/linkerd2/pkg/k8s"
vizCmd "github.com/linkerd/linkerd2/viz/cmd"
"github.com/linkerd/linkerd2/viz/metrics-api/client"
pb "github.com/linkerd/linkerd2/viz/metrics-api/gen/viz"
"github.com/spf13/cobra"
co... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
// Copyright 2020 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// It may or may not work on other OSes.
// If you test on another OS and it works, enable it.
// +build linux
package cover
import (
"bytes"
"os"
"pa... |
// Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)
const ansibleGroupPrefix string = "do_"
const doApi string = "https://api.digitalocean.com/v2"
var ai = ansibleInventory{}
var environVars = map[string]string{
"DO_TOKEN": "The Digital Ocean token API access key",
}
type doClient struct... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
/*
Copyright 2022 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... |
// Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
/*
Copyright 2019 The Jetstack cert-manager contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
package cli
import (
"bufio"
"context"
"fmt"
"io"
"log"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/DataDrake/cli-ng/v2/cmd"
"github.com/hyprspace/hyprspace/config"
"github.com/hyprspace/hyprspace/p2p"
"github.com/hyprspace/hyprspace/tun"
"github.com/libp2p/go-libp2p-core/host"
"github.com... |
package core
import (
"encoding/json"
"fmt"
"net/http"
"reflect"
"regexp"
"strconv"
"strings"
"time"
)
// Manejador de peticiones al api. Realiza la lógica necesaria
// para invocar el controladore correspondiente según la petición
func RequestControllerHandler(w http.ResponseWriter, r *http.Request) {
//Obt... |
// Copyright 2020 <NAME>.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
package http
import (
"go-common/app/job/main/vip/conf"
"go-common/app/job/main/vip/model"
"go-common/app/job/main/vip/service"
"go-common/library/log"
bm "go-common/library/net/http/blademaster"
)
var (
s *service.Service
)
// Init init http sever instance.
func Init(c *conf.Config, ss *service.Service) {
//... |
package widget
import (
"image"
"github.com/blizzy78/ebitenui/event"
"github.com/blizzy78/ebitenui/input"
"github.com/hajimehoshi/ebiten/v2"
"golang.org/x/image/font"
)
type TabBook struct {
TabSelectedEvent *event.Event
tabs []*TabBookTab
containerOpts []ContainerOpt
buttonOpts []StateButtonOp... |
/*
Copyright 2021 The DnsJia Authors.
WebSite: https://github.com/dnsjia/luban
Email: <EMAIL>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unles... |
package dashboard
import (
"fmt"
"html/template"
"net/http"
"strings"
"github.com/rs/zerolog/log"
"github.com/authzed/spicedb/internal/datastore"
"github.com/authzed/spicedb/pkg/schemadsl/generator"
)
const rootTemplate = `
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bo... |
//==============================================================================
// This file is part of FQgolibs
// Copyright (c) 2017-2019, FutureQuest, Inc.
// https://www.FutureQuest.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with th... |
// The MIT License (MIT)
//
// Copyright (c) 2016 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, mo... |
package main
import (
"net"
"log"
"bufio"
"errors"
"io"
"encoding/binary"
"fmt"
"sync"
"crypto/rc4"
"crypto/md5"
)
/*
面向接口编程
最小接口原则
*/
type CryptoWriter struct{
w io.Writer
cipher *rc4.Cipher
}
func NewCryptoWriter(w io.Writer, key string) io.Writer{
md5sum := md5.Sum([]byte(key))
cipher, err := rc4.N... |
/*
* Copyright 2018-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
//
// Copyright (C) 2020-2021 IOTech Ltd
//
// SPDX-License-Identifier: Apache-2.0
package dtos
import (
"github.com/edgexfoundry/go-mod-core-contracts/v2/v2/dtos/common"
"github.com/edgexfoundry/go-mod-core-contracts/v2/v2/models"
)
// Subscription and its properties are defined in the APIv2 specification:
// htt... |
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed unde... |
package packet
import (
"github.com/go-gl/mathgl/mgl32"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
const (
EventSoundClick = 1000
EventSoundClickFail = 1001
EventSoundShoot = 1002
EventSoundDoor = 1003
EventSoundFizz = 1004
EventSoundIgnite = 1005
Eve... |
/* pingo is a discord bot written in Go. It follows specific text by user, to notify them via direct message.
*
* To installing dependencies, run:
* $ go mod init amino19/pingo-bot
* $ go get github.com/bwmarrin/discordgo
*
* We have 2 types of code here specifically defines:-
* 1. 1st code: If user want to put ... |
package chron
import (
"time"
"github.com/dustinevan/chron/dura"
"fmt"
"reflect"
"database/sql/driver"
"strings"
)
// Time implementations are instants in time that are transferable to
// other instants with a different precision--year, month, day, hour,
// minute, second, milli, micro, chron--which has nanose... |
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/url"
"os"
"os/user"
"time"
"github.com/gorilla/websocket"
"github.com/stts-se/tillstudpub/rispik/protocol"
)
func sendFile(c *websocket.Conn, audioFile string) {
f, err := os.Open(audioFile)
if err != nil {
log.Fatalf("Couldn... |
package network
import (
"encoding/binary"
"errors"
"github.com/Cyinx/einx/slog"
"io"
"net"
)
const (
MSG_KEY_LENGTH = 32
MSG_HEADER_LENGTH = 4
MSG_ID_LENGTH = 4
MSG_MAX_BODY_LENGTH = 8096
MSG_DEFAULT_BUF_LENGTH = 1024
MSG_DEFAULT_COUNT = 100
)
var bigEndian = binary.BigEndia... |
// Package ping provides primitives to ping network endpoints.
package ping
import (
"bytes"
"encoding/binary"
"errors"
"math"
"net"
"sync"
"time"
"golang.org/x/net/icmp"
"golang.org/x/net/ipv4"
)
// Summary holds statistics from a single ping run
type Summary struct {
Sent, Lost int
MinRTT time.Durat... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package state_test
import (
"context"
"encoding/json"
"testing"
"magma/orc8r/cloud/go/errors"
... |
package common
import (
"encoding/json"
"fmt"
"github.com/WebGameLinux/cms/dto/enums"
"github.com/WebGameLinux/cms/dto/response"
utils "github.com/WebGameLinux/cms/utils/beego"
"github.com/WebGameLinux/cms/utils/getter"
"github.com/WebGameLinux/cms/utils/reflects"
"github.com/WebGameLinux/cms/utils/set... |
package types
import (
"encoding/hex"
"encoding/json"
"fmt"
"math/big"
atlas "gx/ipfs/QmSaDQWMxJBMtzQWnGoDppbwSEbHv4aJcD86CMSdszPU4L/refmt/obj/atlas"
cbor "gx/ipfs/QmZpue627xQuNGXn7xHieSjSZ8N4jot6oBHwe9XTn3e4NU/go-ipld-cbor"
mh "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash"
"gx/ipfs/Qmc... |
// Copyright 2018 ETH Zurich, Anapaya Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
// Copyright (c) 2018, <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gi
import (
"github.com/rcoreilly/goki/gi/units"
"github.com/rcoreilly/goki/ki"
"github.com/rcoreilly/goki/ki/kit"
)
/////////////////////////////////... |
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package logutil
import (
"encoding/hex"
"fmt"
"strings"
"github.com/google/uuid"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/backup"
"github.com/pingcap/kvproto/pkg/import_sstpb"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pi... |
package net
import (
"fmt"
"net"
"strings"
"sync"
"time"
"github.com/go-redis/redis"
"github.com/Kasita-Inc/gadget/errors"
"github.com/Kasita-Inc/gadget/stringutil"
)
const prodSlug = "cache.amazonaws.com"
// InvalidRedisAddressError is returned in an invalid address is passed to the Redis Client initializ... |
// Copyright 2021 The s3iot authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
package main
import (
"crypto/tls"
"flag"
"fmt"
log "github.com/Sirupsen/logrus"
"math"
"net"
"os"
"runtime/debug"
"syscall"
"time"
)
// check exit codes
const (
OK = iota
Warning = iota
Critical = iota
Unknown = iota
)
var exitCode = OK
var lookupTimeout, connectionTimeout, warningValidity, cr... |
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
package main
import (
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
)
var originalSite = `
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
... |
/*
Copyright © 2014–5 <NAME>.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... |
/****************************************************************************
* Copyright 2019, Optimizely, Inc. and contributors *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you m... |
package auth
import (
"crypto/ecdsa"
"encoding/hex"
"fmt"
log "github.com/golang/glog"
didlib "github.com/ockam-network/did"
"github.com/ethereum/go-ethereum/crypto"
"github.com/pkg/errors"
ceth "github.com/joincivil/go-common/pkg/eth"
ctime "github.com/joincivil/go-common/pkg/time"
"github.com/joincivi... |
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file ... |
package envoyplugin
import (
"context"
mircroservice "slime.io/slime/pkg/apis/microservice/v1alpha1"
"slime.io/slime/pkg/apis/microservice/v1alpha1/wrapper"
"slime.io/slime/pkg/apis/networking/v1alpha3"
"slime.io/slime/pkg/bootstrap"
"slime.io/slime/pkg/util"
istio "istio.io/api/networking/v1alpha3"
"k8s.io/... |
package errpref
import (
"fmt"
"strings"
"sync"
)
type errPrefNeutron struct {
lock *sync.Mutex
}
// createNewEPrefInfo - Creates a single ErrorPrefixInfo object
// from an error prefix and an error context string. This method is
// only designed to operate on a single pair of pair of strings
// containing one e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.