repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
gfpcom/free-proxy-list
https://github.com/gfpcom/free-proxy-list/blob/4abcb4646e9dcaa5fc449ec745efa3549450d55b/internal/transformer.go
internal/transformer.go
package internal import "encoding/base64" var ( Transformers = map[string]Transformer{} ) func init() { Transformers["base64"] = FromBase64 } type Transformer func([]byte) []byte func RegisterTransformer(name string, t Transformer) { Transformers[name] = t } func GetTransformer(name string) Transformer { if t...
go
MIT
4abcb4646e9dcaa5fc449ec745efa3549450d55b
2026-01-07T09:45:37.798273Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/main.go
src/main.go
package main import ( "flag" "fmt" "net/http" "os" "github.com/bench-routes/bench-routes/src/lib/api" brConfig "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/log" "github.com/bench-routes/bench-routes/src/lib/modules/module" file "github.com/bench-routes/b...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/metrics/system/system.go
src/metrics/system/system.go
package system import ( "fmt" "os/exec" "strconv" "strings" "time" disk "github.com/mackerelio/go-osstat/memory" gostats "github.com/shirou/gopsutil/cpu" gomem "github.com/shirou/gopsutil/mem" ) const ( tcpSegmentSizeInBytes = 1200 ) // CPU interface for CPU related details. type CPU interface { GetTotalC...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/metrics/process/process.go
src/metrics/process/process.go
package process import ( "fmt" "os/exec" "strconv" "strings" ) // PDetails contains the details of all the processes type PDetails struct { User string Pid int CPUUtilization float32 MemoryUtilization float32 // Virtual Memory Size VMS float32 // Resident Set Size RSS float32...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/metrics/journal/journal.go
src/metrics/journal/journal.go
package journal import ( "fmt" "os/exec" "strconv" "strings" ) const ( indentifier = `"SYSLOG_IDENTIFIER":"kernel"` logsIdentifier = "localhost.localdomain" kernelIndetifier = "kernel: " ) // Journal implements for collecting journal/systemd information. type Journal struct { cmd Points warn, err st...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/utils/decode/blocks-decoding.go
src/lib/utils/decode/blocks-decoding.go
package decode import ( tsdb "github.com/bench-routes/bench-routes/tsdb" ) // BlockDecodingBR implements the decoding of tsdb blocks into the respective types. type BlockDecodingBR struct { Type string } // NewBlockDecoding returns the new BlockDecodingBR type. func NewBlockDecoding(Type string) *BlockDecodingBR {...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/utils/decode/module-decoding.go
src/lib/utils/decode/module-decoding.go
package decode import ( "fmt" "strconv" "strings" "time" "github.com/bench-routes/bench-routes/src/lib/modules/evaluate" ) func pingDecode(block string) evaluate.Ping { if block == "" { return evaluate.Ping{} } arr := strings.Split(block, "|") if len(arr) != 3 { panic(fmt.Errorf("invalid block segments ...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/api/api.go
src/lib/api/api.go
package api import ( "encoding/json" "fmt" "math" "net/http" "strconv" "sync" "time" "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/log" "github.com/bench-routes/bench-routes/src/lib/modules/evaluate" tsdb "github.com/bench-routes/bench-routes/tsdb" "gi...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/scheduler/scheduler_test.go
src/lib/modules/scheduler/scheduler_test.go
package scheduler import ( "context" "fmt" "os" "testing" "time" config "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/modules/job" file "github.com/bench-routes/bench-routes/tsdb" "github.com/stretchr/testify/require" ) func TestScheduler(t *testing.T) {...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/scheduler/scheduler.go
src/lib/modules/scheduler/scheduler.go
package scheduler import ( "context" "log" "time" "github.com/bench-routes/bench-routes/src/lib/modules/job" ) type scheduler struct { scanFrequency time.Duration timeline map[*job.JobInfo]chan<- struct{} } // New returns a scheduler with new timeline. func New(jobs map[*job.JobInfo]chan<- struct{}) *sch...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/module/module_test.go
src/lib/modules/module/module_test.go
package module import ( "fmt" "os" "testing" "time" config "github.com/bench-routes/bench-routes/src/lib/config" file "github.com/bench-routes/bench-routes/tsdb" "github.com/stretchr/testify/require" ) func TestMachineModule(t *testing.T) { set := file.NewChainSet(0, time.Second*2) set.Run() errCh := make(...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/module/module.go
src/lib/modules/module/module.go
package module import ( "fmt" config "github.com/bench-routes/bench-routes/src/lib/config" file "github.com/bench-routes/bench-routes/tsdb" ) // Runnable is an interface that is implmented by Machine and Monitor. type Runnable interface { Run() Reload(*config.Config) error Stop() } type Type uint8 const ( M...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/module/machine.go
src/lib/modules/module/machine.go
package module import ( "context" "fmt" "sync" config "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/log" "github.com/bench-routes/bench-routes/src/lib/modules/job" "github.com/bench-routes/bench-routes/src/lib/modules/scheduler" file "github.com/bench-rout...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/module/monitor.go
src/lib/modules/module/monitor.go
package module import ( "context" "fmt" "sync" config "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/log" "github.com/bench-routes/bench-routes/src/lib/modules/job" "github.com/bench-routes/bench-routes/src/lib/modules/scheduler" file "github.com/bench-rout...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/evaluate/machine.go
src/lib/modules/evaluate/machine.go
package evaluate import ( "fmt" "runtime" "time" "github.com/go-ping/ping" ) // Ping icmp requests to target. type Ping struct { Min time.Duration `json:"min"` Mean time.Duration `json:"mean"` Max time.Duration `json:"max"` } // Jitter is the mean variation between consecutive ping operations. type Jitter ...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/evaluate/monitor.go
src/lib/modules/evaluate/monitor.go
package evaluate import ( "fmt" "io/ioutil" "net/http" "time" "unicode/utf8" ) // Response contains evaluations of response delay and length, calculated during monitoring of an API. type Response struct { Delay time.Duration `json:"delay"` Length int `json:"length"` Size int `json:"size...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/job/job_test.go
src/lib/modules/job/job_test.go
package job import ( "fmt" "os" "testing" "time" config "github.com/bench-routes/bench-routes/src/lib/config" file "github.com/bench-routes/bench-routes/tsdb" "github.com/stretchr/testify/require" ) var testapis []config.API = []config.API{ { Name: "API_1", Every: time.Second * 2, Protocol: "htt...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/job/job.go
src/lib/modules/job/job.go
package job import ( "fmt" "sync" "time" config "github.com/bench-routes/bench-routes/src/lib/config" file "github.com/bench-routes/bench-routes/tsdb" ) // Executable is an interface that is implemented by machineJob and monitoringJob. type Executable interface { Execute(chan<- error) Abort() Info() *JobInfo...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/job/machine.go
src/lib/modules/job/machine.go
package job import ( "fmt" "net/url" "time" config "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/modules/evaluate" file "github.com/bench-routes/bench-routes/tsdb" ) type machineJob struct { JobInfo appPing file.Appendable appJitter file.Appendable si...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/modules/job/monitor.go
src/lib/modules/job/monitor.go
package job import ( "bytes" "encoding/json" "fmt" "net/http" "net/url" "strconv" "strings" "time" config "github.com/bench-routes/bench-routes/src/lib/config" "github.com/bench-routes/bench-routes/src/lib/modules/evaluate" file "github.com/bench-routes/bench-routes/tsdb" ) type monitoringJob struct { Jo...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/config/config.go
src/lib/config/config.go
package config import ( "fmt" "io/ioutil" "sync" "time" "gopkg.in/yaml.v3" ) // Config contains configuration in runtime. type Config struct { path string mux sync.RWMutex APIs []API `yaml:"apis"` } // API stores the information of the endpoints. type API struct { Name string `yaml:"name,om...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/config/config_test.go
src/lib/config/config_test.go
package config import ( "fmt" "testing" "time" ) type test struct { name string file string err string api API shouldErr bool } var validateTests = []test{ { name: "`Name` field is MISSING", file: "./testdata/config_name_missing.bad.yml", shouldErr: true, err: "...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/config/config_validator.go
src/lib/config/config_validator.go
package config import ( "fmt" "regexp" "strings" ) // https://regexr.com/3au3g const validDomainRegex = `^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$` func validateAPI(index int, api API) error { if api.Name == "" { return fmt.Errorf("`Name` field of # %d API cannot be empty", i...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/src/lib/log/log.go
src/lib/log/log.go
package log import ( "flag" "fmt" "os" "time" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" ) var ( // Application wide logger. logger = log.NewNopLogger() // logger timestamp format timestampFormat = log.TimestampFormat( func() time.Time { return time.Now().UTC() }, "2006-01-02T15:04:...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/block.go
tsdb/block.go
package file import "encoding/json" // Block use case block for the TSDB chain type Block struct { Datapoint string `json:"datapoint"` // complex data would be decoded by using a blockSeparator NormalizedTime int64 `json:"normalized-time"` // based on time.UnixNano() Type string `json:"type"`...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/chain.go
tsdb/chain.go
package file import ( "encoding/json" "fmt" "io/ioutil" "os" "sync" "github.com/bench-routes/bench-routes/src/lib/log" ) type Appendable interface { // Append allows to append a block into the chain. Append(b Block) } type ChainUtils interface { // Path returns the path of the chain. Path() string // For...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/db_test.go
tsdb/db_test.go
package file import ( "fmt" "os" "testing" "time" "github.com/stretchr/testify/require" ) func TestChainCreation(t *testing.T) { set := NewChainSet(FlushAsTime, time.Second) set.Run() // Create new chain. app, utils := set.NewChain("google", "https://google.co.in", false) // Add new blocks into the chain...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/db.go
tsdb/db.go
package file import ( "encoding/json" "fmt" "os" "runtime" "strings" "sync" "time" ) var Chains *ChainSet func init() { Chains = NewChainSet(FlushAsTime, time.Second*10) Chains.Run() } const ( // BlockDataSeparator sets a separator for block data value. BlockDataSeparator = "|" // FileExtension file ext...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/querier/querier_test.go
tsdb/querier/querier_test.go
package querier import ( "testing" tsdb "github.com/bench-routes/bench-routes/tsdb" ) var tests []string = []string{ "./testdata/test_ping.json", "./testdata/test_jitter.json", "./testdata/test_monitor.json", } func TestQurier(t *testing.T) { for _, path := range tests { bstream, err := tsdb.FetchChainStrea...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
bench-routes/bench-routes
https://github.com/bench-routes/bench-routes/blob/41a8a6185da6d8b085b8231c465f25f5411301a9/tsdb/querier/querier.go
tsdb/querier/querier.go
package querier import ( "fmt" "sort" "time" "github.com/bench-routes/bench-routes/src/lib/utils/decode" tsdb "github.com/bench-routes/bench-routes/tsdb" ) type Query struct { dbPath string typ uint8 rang queryRange timestamp time.Time } // queryRange is the range of time within which the set...
go
BSD-3-Clause
41a8a6185da6d8b085b8231c465f25f5411301a9
2026-01-07T09:45:43.369869Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/cmd/gtrace/writer.go
cmd/gtrace/writer.go
package main import ( "bufio" "container/list" "crypto/md5" "encoding/hex" "fmt" "go/build" "go/token" "go/types" "io" "io/ioutil" "path/filepath" "runtime" "sort" "strconv" "strings" "sync" "unicode" "unicode/utf8" ) type Writer struct { Output io.Writer BuildTag string Stub bool Context ...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/cmd/gtrace/main.go
cmd/gtrace/main.go
package main import ( "bufio" "bytes" "flag" "fmt" "go/ast" "go/build" "go/importer" "go/parser" "go/token" "go/types" "io" "log" "os" "path/filepath" "reflect" "strings" "text/tabwriter" _ "unsafe" // For go:linkname. ) //go:linkname build_goodOSArchFile go/build.(*Context).goodOSArchFile func bui...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_linux.go
test/test_linux.go
// +build linux package test //go:generate gtrace -v //gtrace:gen type ConditionalBuildTrace struct { OnSomething func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_windows.go
test/test_windows.go
// +build windows package test //go:generate gtrace -v //gtrace:gen type ConditionalBuildTrace struct { OnSomething func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags_dup.go
test/test_tags_dup.go
package test //go:generate gtrace -v -tag gtrace //gtrace:gen //gtrace:set context //gtrace:set shortcut type AnotherBuildTagTrace struct { OnSomethingA func() func() OnSomethingB func(int8, int16) func(int32, int64) OnSomethingC func(Type) func(Type) }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags.go
test/test_tags.go
package test //go:generate gtrace -v -tag gtrace //gtrace:gen //gtrace:set context //gtrace:set shortcut type BuildTagTrace struct { OnSomethingA func() func() OnSomethingB func(int8, int16) func(int32, int64) OnSomethingC func(Type) func(Type) }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags_dup_gtrace.go
test/test_tags_dup_gtrace.go
// Code generated by gtrace. DO NOT EDIT. // +build gtrace package test import ( "bytes" "context" ) // Compose returns a new AnotherBuildTagTrace which has functional fields composed // both from t and x. func (t AnotherBuildTagTrace) Compose(x AnotherBuildTagTrace) (ret AnotherBuildTagTrace) { switch { case t...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_shortcut_gtrace.go
test/test_shortcut_gtrace.go
// Code generated by gtrace. DO NOT EDIT. package test // Compose returns a new ShortcutPerFieldTrace which has functional fields composed // both from t and x. func (t ShortcutPerFieldTrace) Compose(x ShortcutPerFieldTrace) (ret ShortcutPerFieldTrace) { switch { case t.OnFoo == nil: ret.OnFoo = x.OnFoo case x.O...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/types.go
test/types.go
package test import "bytes" type Embeded struct { } type Type struct { Embeded String string Integer int Boolean bool Error error Reader bytes.Reader }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_imports_gtrace.go
test/test_imports_gtrace.go
// Code generated by gtrace. DO NOT EDIT. package test import ( "context" "github.com/gobwas/gtrace/test/internal" ) // Compose returns a new TraceNoShortcut which has functional fields composed // both from t and x. func (t TraceNoShortcut) Compose(x TraceNoShortcut) (ret TraceNoShortcut) { switch { case t.OnS...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags_gtrace_stub.go
test/test_tags_gtrace_stub.go
// Code generated by gtrace. DO NOT EDIT. // +build !gtrace package test import ( "bytes" "context" ) // Compose returns a new BuildTagTrace which has functional fields composed // both from t and x. func (t BuildTagTrace) Compose(x BuildTagTrace) (ret BuildTagTrace) { switch { case t.OnSomethingA == nil: ret...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_gtrace_darwin_amd64.go
test/test_gtrace_darwin_amd64.go
// Code generated by gtrace. DO NOT EDIT. // +build darwin,amd64 package test // Compose returns a new ConditionalBuildTrace which has functional fields composed // both from t and x. func (t ConditionalBuildTrace) Compose(x ConditionalBuildTrace) (ret ConditionalBuildTrace) { switch { case t.OnSomething == nil: ...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_darwin_amd64.go
test/test_darwin_amd64.go
// +build darwin,amd64 package test //go:generate gtrace -v //gtrace:gen type ConditionalBuildTrace struct { OnSomething func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_returned_gtrace.go
test/test_returned_gtrace.go
// Code generated by gtrace. DO NOT EDIT. package test // Compose returns a new TraceReturningTrace which has functional fields composed // both from t and x. func (t TraceReturningTrace) Compose(x TraceReturningTrace) (ret TraceReturningTrace) { switch { case t.OnReturnedTrace == nil: ret.OnReturnedTrace = x.OnR...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_returned_tags_gtrace_stub.go
test/test_returned_tags_gtrace_stub.go
// Code generated by gtrace. DO NOT EDIT. // +build !gtrace package test // Compose returns a new TraceReturningTraceTags which has functional fields composed // both from t and x. func (t TraceReturningTraceTags) Compose(x TraceReturningTraceTags) (ret TraceReturningTraceTags) { return ret }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags_dup_gtrace_stub.go
test/test_tags_dup_gtrace_stub.go
// Code generated by gtrace. DO NOT EDIT. // +build !gtrace package test import ( "bytes" "context" ) // Compose returns a new AnotherBuildTagTrace which has functional fields composed // both from t and x. func (t AnotherBuildTagTrace) Compose(x AnotherBuildTagTrace) (ret AnotherBuildTagTrace) { switch { case ...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_gtrace_linux.go
test/test_gtrace_linux.go
// Code generated by gtrace. DO NOT EDIT. // +build linux package test // Compose returns a new ConditionalBuildTrace which has functional fields composed // both from t and x. func (t ConditionalBuildTrace) Compose(x ConditionalBuildTrace) (ret ConditionalBuildTrace) { switch { case t.OnSomething == nil: ret.On...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_darwin.go
test/test_darwin.go
// +build darwin,!amd64,!arm64 package test //go:generate gtrace -v //gtrace:gen type ConditionalBuildTrace struct { OnSomething func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_darwin_arm64.go
test/test_darwin_arm64.go
// +build darwin,arm64 package test //go:generate gtrace -v //gtrace:gen type ConditionalBuildTrace struct { OnSomething func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_imports.go
test/test_imports.go
package test import "github.com/gobwas/gtrace/test/internal" //go:generate gtrace -v //gtrace:gen //gtrace:set context // NOTE: must compile without unused imports error. type TraceNoShortcut struct { OnSomethingA func(Type) OnSomethingB func(internal.Type) }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_gtrace_windows.go
test/test_gtrace_windows.go
// Code generated by gtrace. DO NOT EDIT. // +build windows package test // Compose returns a new ConditionalBuildTrace which has functional fields composed // both from t and x. func (t ConditionalBuildTrace) Compose(x ConditionalBuildTrace) (ret ConditionalBuildTrace) { switch { case t.OnSomething == nil: ret....
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_gtrace_darwin_arm64.go
test/test_gtrace_darwin_arm64.go
// Code generated by gtrace. DO NOT EDIT. // +build darwin,arm64 package test // Compose returns a new ConditionalBuildTrace which has functional fields composed // both from t and x. func (t ConditionalBuildTrace) Compose(x ConditionalBuildTrace) (ret ConditionalBuildTrace) { switch { case t.OnSomething == nil: ...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test.go
test/test.go
package test //go:generate gtrace -v //gtrace:gen //gtrace:set context //gtrace:set shortcut type Trace struct { OnTest func(string) func(string) OnAction func(TraceActionStart) func(TraceActionDone) OnActionPtr func(*TraceActionStart) func(*TraceActionDone) OnSomething0 func(int8) func(int16) func(int32) f...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_tags_gtrace.go
test/test_tags_gtrace.go
// Code generated by gtrace. DO NOT EDIT. // +build gtrace package test import ( "bytes" "context" ) // Compose returns a new BuildTagTrace which has functional fields composed // both from t and x. func (t BuildTagTrace) Compose(x BuildTagTrace) (ret BuildTagTrace) { switch { case t.OnSomethingA == nil: ret....
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_shortcut.go
test/test_shortcut.go
package test //go:generate gtrace -v //gtrace:gen type ShortcutPerFieldTrace struct { //gtrace:set shortcut OnFoo func() OnBar func() }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_returned_tags.go
test/test_returned_tags.go
package test //go:generate gtrace -v -tag gtrace //gtrace:gen //gtrace:set shortcut type TraceReturningTraceTags struct { OnReturnedTrace func() ReturnedTrace }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_returned.go
test/test_returned.go
package test //go:generate gtrace -v //gtrace:gen //gtrace:set shortcut type TraceReturningTrace struct { OnReturnedTrace func() ReturnedTrace } //gtrace:gen type ReturnedTrace struct { OnSomething func(a, b int) OnFoo func(_ int, _ int) OnBar func(_, _ int) OnBaz func(int, int) }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_test.go
test/test_test.go
package test import ( "context" "reflect" "testing" ) func TestReturnedTrace(t *testing.T) { var called bool trace := TraceReturningTrace{ OnReturnedTrace: func() ReturnedTrace { return ReturnedTrace{ OnSomething: func(a, b int) { called = true }, } }, } trace.onReturnedTrace().onSomethi...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/test_returned_tags_gtrace.go
test/test_returned_tags_gtrace.go
// Code generated by gtrace. DO NOT EDIT. // +build gtrace package test // Compose returns a new TraceReturningTraceTags which has functional fields composed // both from t and x. func (t TraceReturningTraceTags) Compose(x TraceReturningTraceTags) (ret TraceReturningTraceTags) { return ret }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/test/internal/types.go
test/internal/types.go
package internal type Type struct { }
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/examples/buildtags/main_gtrace.go
examples/buildtags/main_gtrace.go
// Code generated by gtrace. DO NOT EDIT. // +build gtrace package main // Compose returns a new Trace which has functional fields composed // both from t and x. func (t Trace) Compose(x Trace) (ret Trace) { switch { case t.OnInput == nil: ret.OnInput = x.OnInput case x.OnInput == nil: ret.OnInput = t.OnInput...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/examples/buildtags/main_gtrace_stub.go
examples/buildtags/main_gtrace_stub.go
// Code generated by gtrace. DO NOT EDIT. // +build !gtrace package main // Compose returns a new Trace which has functional fields composed // both from t and x. func (t Trace) Compose(x Trace) (ret Trace) { switch { case t.OnInput == nil: ret.OnInput = x.OnInput case x.OnInput == nil: ret.OnInput = t.OnInpu...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/examples/buildtags/main.go
examples/buildtags/main.go
package main import ( "log" "os" ) //go:generate gtrace -tag gtrace //gtrace:gen //gtrace:set shortcut type Trace struct { OnInput func(string) func() } func main() { log.SetFlags(0) log.SetPrefix("[logs] ") t := logTrace(Trace{}) done := traceOnInput(t, os.Args[1]) defer done() } func logTrace(t Trace) T...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/examples/pinger/main_gtrace.go
examples/pinger/main_gtrace.go
// Code generated by gtrace. DO NOT EDIT. package main import ( "context" "net/http" ) // Compose returns a new PingTrace which has functional fields composed // both from t and x. func (t PingTrace) Compose(x PingTrace) (ret PingTrace) { switch { case t.OnRequest == nil: ret.OnRequest = x.OnRequest case x.On...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
gobwas/gtrace
https://github.com/gobwas/gtrace/blob/ec925f3f92588ef8d4f360f9f87e642fb77b0e40/examples/pinger/main.go
examples/pinger/main.go
package main //go:generate gtrace import ( "bufio" "context" "flag" "fmt" "log" "net/http" "net/url" "os" "strings" "sync" "time" ) type ( //gtrace:gen //gtrace:set shortcut //gtrace:set context PingTrace struct { OnRequest func(PingTraceRequestStart) func(PingTraceRequestDone) } PingTraceRequestS...
go
MIT
ec925f3f92588ef8d4f360f9f87e642fb77b0e40
2026-01-07T09:45:48.556140Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/main.go
server/main.go
package main import ( "context" "net/http" "os" "os/signal" "runtime" "syscall" "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" "github.com/spf13/viper" "paste.org.cn/paste/server/db" "paste.org.cn/paste/server/middleware" "paste.org.cn/paste/server/router" "paste.org.cn/paste/server/storage...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/storage/storage.go
server/storage/storage.go
package storage import ( "context" "encoding/base64" "errors" "fmt" "io" "net/http" "path/filepath" "strings" "time" "github.com/gin-gonic/gin" "github.com/google/uuid" log "github.com/sirupsen/logrus" "github.com/spf13/viper" "paste.org.cn/paste/server/proto" "paste.org.cn/paste/server/util" ) // 存储...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/storage/tencent.go
server/storage/tencent.go
package storage import ( "context" "errors" "fmt" "io" "net/http" "net/url" "time" "github.com/spf13/viper" "github.com/tencentyun/cos-go-sdk-v5" "github.com/tencentyun/cos-go-sdk-v5/debug" ) // TencentOSS 腾讯云对象存储 type TencentOSS struct { OSS *cos.Client // 腾讯云对象存储客户端 Config OSSConfig // 腾讯云配置 } //...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/storage/oss.go
server/storage/oss.go
package storage import ( "context" "fmt" "io" ) const ( ProviderTencent = "tencent" ProviderAliyun = "aliyun" ProviderQiniu = "qiniu" ProviderAWS = "aws" ProviderAzure = "azure" ) type UploadOptions struct { ObjectKey string // 对象存储中的唯一标识符 ContentType string // 文件的内容类型 Met...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/util/service.go
server/util/service.go
package util import ( "context" "fmt" "net" "net/http" "os" "time" log "github.com/sirupsen/logrus" // 用logrus第三方开源库来替换标准库log包,logrus兼容标准库log包的所有API "github.com/spf13/viper" ) // 加载配置 func LoadConfig(configName string) { viper.SetConfigName(configName) viper.AddConfigPath(".") err := viper.ReadInConfig() ...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/util/reqid.go
server/util/reqid.go
package util import ( "context" "encoding/base64" "encoding/binary" "time" ) // 定义常量 REQID,用于在上下文作为键 const REQID string = "ReqID" // 生成一个基于当前时间戳的进程ID,用于生成唯一的请求ID var pid = uint32(time.Now().UnixNano() % 4294967291) // 定义一个空的结构体类型 reqIDKey,用于在上下文中作为键 type ( reqIDKey struct{} ) // GenReqID 生成一个新的请求ID // 该ID是由进程...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/util/util.go
server/util/util.go
package util import ( "log" "math/rand" "sync" "time" "unsafe" "golang.org/x/crypto/bcrypt" ) // 定义用于生成随机字符串的常量 const ( letterBytes = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" letterIdxBits = 6 // 每个字符占用的比特数 letterIdxMask = 1<<letterIdxBits - 1 // 用于位运算的掩码 letter...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/util/limit.go
server/util/limit.go
package util import ( "sync" log "github.com/sirupsen/logrus" "github.com/spf13/viper" ) type limitConfig struct { mu sync.RWMutex // 保护配置读写的互斥锁 Snippets_Length int `mapstructure:"snippets_length"` Snippets_Count int `mapstructure:"snippets_count"` Images_Size int ...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/util/logger.go
server/util/logger.go
package util import ( "context" "fmt" "path" "runtime" "github.com/sirupsen/logrus" ) func init() { logrus.SetReportCaller(true) // 让 logrus 在输出日志时自动包含调用日志记录函数的位置信息(文件名和行号) // 设置日志的输出格式 logrus.SetFormatter(&logrus.TextFormatter{ FullTimestamp: true, // 日志中包含完整的时间戳 // 自定义方法,用于美化调用者信息的显示格式 CallerPrettyfi...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/service/service.go
server/service/service.go
package service import ( "encoding/json" "fmt" "net/http" "time" "unicode/utf8" "github.com/gin-gonic/gin" "paste.org.cn/paste/server/db" "paste.org.cn/paste/server/proto" "paste.org.cn/paste/server/storage" "paste.org.cn/paste/server/util" ) type Paste struct { db.Paste } // 创建分享内容 func (p *Paste) Post...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/proto/error.go
server/proto/error.go
package proto // Error messages related to invalid user input or system issues const ( ErrInvalidArgs = "invalid request parameter" ErrTooManyContent = "content length exceeds the maximum allowed size of %d characters" ErrTooManyCount = "content count exceeds the allowed limit of %d" ErrOverMaxSize = "...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/proto/proto.go
server/proto/proto.go
package proto // Snippet 结构体表示片段类型 type Snippet struct { Langtype string `json:"langtype" bson:"langtype"` // 代码/文本(如 "go", "python", "text","markdown"等) Content string `json:"content" bson:"content"` // 片段内容,最大支持十万个字符 } // ImageFile 结构体表示图片类型 type ImageFile struct { StorageType string `json:"storage_type" bs...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/middleware/logger.go
server/middleware/logger.go
package middleware import ( "fmt" "github.com/gin-gonic/gin" "paste.org.cn/paste/server/util" ) // 使用gin框架提供的 LoggerWithFormatter 函数创建的自定义日志中间件,该中间件定义了日志的输出格式 var LogInfo = gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string { return fmt.Sprintf("%s [%s][%s] %s - \"%s %s %s %d %s \"%s\" %s\"\n", ...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/db/paste.go
server/db/paste.go
package db import ( "context" "errors" "sync" "time" "github.com/google/uuid" "github.com/spf13/viper" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "golang.org/x/crypto/bcrypt" "paste.org.cn/paste/server/proto" ) // 保存全局MongoDB客户端实例 var...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/db/model.go
server/db/model.go
package db import ( "time" "paste.org.cn/paste/server/proto" ) type PasteEntry struct { Key string `json:"key" bson:"key"` // 唯一标识 Title string `json:"title" bson:"title"` // 分享标题 Description string `json:...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
bodhiye/paste
https://github.com/bodhiye/paste/blob/11208a0e047c5edde5cec9e6fc750d17a4e7bbb5/server/router/router.go
server/router/router.go
package router import ( "net/http" "github.com/gin-gonic/gin" "paste.org.cn/paste/server/db" "paste.org.cn/paste/server/service" ) // 注册路由 func Init(r *gin.Engine, pasteDB db.Paste) { paste := &service.Paste{ Paste: pasteDB, } r.POST("/v1/paste", paste.PostPaste) //创建分享内容 r.POST("/v1/paste/once", paste.Po...
go
MIT
11208a0e047c5edde5cec9e6fc750d17a4e7bbb5
2026-01-07T09:45:48.729103Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/controller_test.go
controller_test.go
package raft import ( "context" "testing" "github.com/golang/mock/gomock" membershipmock "github.com/shaj13/raft/internal/mocks/membership" raftenginemock "github.com/shaj13/raft/internal/mocks/raftengine" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/transport" "github.com/stretch...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/node.go
node.go
package raft import ( "context" "errors" "fmt" "io" "math" "time" "github.com/shaj13/raft/internal/membership" "github.com/shaj13/raft/internal/raftengine" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/storage" "github.com/shaj13/raft/internal/storage/disk" "github.com/shaj13/r...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/node_test.go
node_test.go
package raft import ( "context" "fmt" "reflect" "testing" "time" "github.com/golang/mock/gomock" "github.com/shaj13/raft/internal/membership" membershipmock "github.com/shaj13/raft/internal/mocks/membership" raftenginemock "github.com/shaj13/raft/internal/mocks/raftengine" storagemock "github.com/shaj13/raf...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/example_test.go
example_test.go
package raft_test import ( "io" "net/http" "github.com/shaj13/raft" "github.com/shaj13/raft/transport" "github.com/shaj13/raft/transport/raftgrpc" "github.com/shaj13/raft/transport/rafthttp" "google.golang.org/grpc" ) type stateMachine struct{} func (stateMachine) Apply([]byte) {} f...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/controller.go
controller.go
package raft import ( "context" "fmt" "io" "sync" "github.com/shaj13/raft/internal/membership" "github.com/shaj13/raft/internal/raftengine" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/storage" "github.com/shaj13/raft/internal/transport" etcdraftpb "go.etcd.io/raft/v3/raftpb" ) ...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/raft_test.go
raft_test.go
package raft import ( "context" "fmt" "os" "testing" "time" "github.com/shaj13/raft/raftlog" "github.com/stretchr/testify/require" "go.etcd.io/raft/v3" ) func TestConfig(t *testing.T) { table := []struct { defaults interface{} expected interface{} opt Option value func(c *config) interface{}...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/raft.go
raft.go
package raft import ( "context" "os" "time" "github.com/shaj13/raft/internal/membership" "github.com/shaj13/raft/internal/raftengine" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/storage" "github.com/shaj13/raft/internal/transport" "github.com/shaj13/raft/raftlog" "go.etcd.io/ra...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/rafttest/sanity_test.go
rafttest/sanity_test.go
package rafttest_test import ( "context" "testing" raft "github.com/shaj13/raft" "github.com/shaj13/raft/transport" "github.com/stretchr/testify/require" ) func TestSanityCheck(t *testing.T) { numOfEnt := 100 otr := newOrchestrator(t) defer otr.teardown() nodes := otr.create(5) otr.start(nodes...) otr.wa...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/rafttest/membership_test.go
rafttest/membership_test.go
package rafttest_test import ( "context" "testing" "time" raft "github.com/shaj13/raft" "github.com/stretchr/testify/require" ) func TestUpdateMember(t *testing.T) { info := []byte("additional information") otr := newOrchestrator(t) defer otr.teardown() nodes := otr.create(2) otr.start(nodes...) otr.wait...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/rafttest/restore_test.go
rafttest/restore_test.go
package rafttest_test import ( "context" "os" "path/filepath" "strings" "testing" "time" raft "github.com/shaj13/raft" "github.com/shaj13/raft/internal/raftpb" "github.com/stretchr/testify/require" ) func TestSnapshotShare(t *testing.T) { numOfEnt := 5 otr := newOrchestrator(t) defer otr.teardown() nod...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/rafttest/infra_test.go
rafttest/infra_test.go
package rafttest_test import ( "context" "encoding/json" "fmt" "io" "io/ioutil" "log" "math/rand" "strings" "sync" "testing" "time" raft "github.com/shaj13/raft" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/transport" etransport "github.com/shaj13/raft/transport" etcdraftp...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/rafttest/doc.go
rafttest/doc.go
// Package rafttest provides functional tests for raft implementation. package rafttest
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/raftlog/raftlog.go
raftlog/raftlog.go
// Package raftlog implements a simple logging package. It defines a type, Logger, // with methods for formatting output. It also has a predefined 'standard' // Logger accessible through helper functions Info[f], Warning[f], Error[f], Fatal[f], and // Panic[f], which are easier to use than creating a Logger manually. /...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/types.go
internal/storage/types.go
package storage import ( "io" "github.com/shaj13/raft/internal/raftpb" etcdraftpb "go.etcd.io/raft/v3/raftpb" ) //go:generate mockgen -package storagemock -source internal/storage/types.go -destination internal/mocks/storage/storage.go // Snapshot is the state of a system at a particular point in time. type Snap...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/disk/snap_codec.go
internal/storage/disk/snap_codec.go
package disk import ( "bufio" "bytes" "encoding/binary" "errors" "fmt" "hash/crc64" "io" "os" "path/filepath" "github.com/shaj13/raft/internal/raftpb" "github.com/shaj13/raft/internal/storage" "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/server/v3/storage/wal/walpb" etcdraftpb "go.etcd.io/r...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/disk/ls.go
internal/storage/disk/ls.go
package disk import ( "io/ioutil" "sort" "strings" ) const ( snapExt = ".snap" walExt = ".wal" format = "%016x-%016x" ) func list(path, ext string) ([]string, error) { ls, err := ioutil.ReadDir(path) if err != nil { return nil, err } var files []string for _, f := range ls { if strings.HasSuffix(f....
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/disk/ls_test.go
internal/storage/disk/ls_test.go
package disk import ( "os" "path/filepath" "testing" "github.com/stretchr/testify/require" ) func TestList(t *testing.T) { dir := createTestDir("list", t) defer os.RemoveAll(dir) table := []struct { name string dir string files []string ext string expectedErr bool }{ ...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/disk/disk.go
internal/storage/disk/disk.go
package disk import ( "context" "fmt" "os" "path/filepath" "github.com/shaj13/raft/internal/storage" "github.com/shaj13/raft/raftlog" "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/server/v3/storage/wal" "go.etcd.io/etcd/server/v3/storage/wal/walpb" "go.etcd.io/raft/v3/raftpb" ) var _ storage.St...
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false
shaj13/raft
https://github.com/shaj13/raft/blob/a5e55c36efbb0c2f01a2e978716ca32c59513cb2/internal/storage/disk/snapshotter.go
internal/storage/disk/snapshotter.go
package disk import ( "bufio" "io" "os" "path/filepath" "github.com/shaj13/raft/internal/storage" ) var _ storage.Snapshotter = &snapshotter{} type snapshotter struct { snapdir string } func (s snapshotter) Reader(term uint64, index uint64) (io.ReadCloser, error) { path := s.path(term, index) f, err := os....
go
MIT
a5e55c36efbb0c2f01a2e978716ca32c59513cb2
2026-01-07T09:45:49.254147Z
false