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
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/geodata/memconservative/errors.generated.go
infra/conf/geodata/memconservative/errors.generated.go
package memconservative import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/geodata/memconservative/cache.go
infra/conf/geodata/memconservative/cache.go
package memconservative import ( "os" "strings" "google.golang.org/protobuf/proto" "github.com/v2fly/v2ray-core/v5/app/router/routercommon" "github.com/v2fly/v2ray-core/v5/common/platform" ) type GeoIPCache map[string]*routercommon.GeoIP func (g GeoIPCache) Has(key string) bool { return !(g.Get(key) == nil) ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/geodata/memconservative/memc.go
infra/conf/geodata/memconservative/memc.go
package memconservative import ( "runtime" "github.com/v2fly/v2ray-core/v5/app/router/routercommon" "github.com/v2fly/v2ray-core/v5/infra/conf/geodata" ) //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen type memConservativeLoader struct { geoipcache GeoIPCache geositecache GeoSiteCa...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/geodata/memconservative/decode.go
infra/conf/geodata/memconservative/decode.go
package memconservative import ( "errors" "io" "strings" "google.golang.org/protobuf/encoding/protowire" "github.com/v2fly/v2ray-core/v5/common/platform/filesystem" ) var ( errFailedToReadBytes = errors.New("failed to read bytes") errFailedToReadExpectedLenBytes = errors.New("failed to read expect...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/geodata/memconservative/decode_test.go
infra/conf/geodata/memconservative/decode_test.go
package memconservative import ( "bytes" "errors" "io/fs" "os" "path/filepath" "testing" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/common/platform" "github.com/v2fly/v2ray-core/v5/common/platform/filesystem" ) func init() { const ( geoipURL = "https://raw.githubusercontent...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/serial/loader.go
infra/conf/serial/loader.go
package serial import ( "bytes" "encoding/json" "io" core "github.com/v2fly/v2ray-core/v5" "github.com/v2fly/v2ray-core/v5/common/errors" json_reader "github.com/v2fly/v2ray-core/v5/infra/conf/json" v4 "github.com/v2fly/v2ray-core/v5/infra/conf/v4" ) type offset struct { line int char int } func findOffset...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/serial/errors.generated.go
infra/conf/serial/errors.generated.go
package serial import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/serial/serial.go
infra/conf/serial/serial.go
package serial //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/serial/loader_test.go
infra/conf/serial/loader_test.go
package serial_test import ( "bytes" "strings" "testing" "github.com/v2fly/v2ray-core/v5/infra/conf/serial" ) func TestLoaderError(t *testing.T) { testCases := []struct { Input string Output string }{ { Input: `{ "log": { // abcd 0, "loglevel": "info" } }`, Output: "line 4...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/common_test.go
infra/conf/cfgcommon/common_test.go
package cfgcommon_test import ( "encoding/json" "os" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/protocol" "github.com/v2fly/v2ray-core/v5/infra/conf...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/errors.generated.go
infra/conf/cfgcommon/errors.generated.go
package cfgcommon import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/buildable.go
infra/conf/cfgcommon/buildable.go
package cfgcommon import ( "context" "github.com/golang/protobuf/proto" ) type Buildable interface { Build() (proto.Message, error) } type BuildableV5 interface { BuildV5(ctx context.Context) (proto.Message, error) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/session.go
infra/conf/cfgcommon/session.go
package cfgcommon import ( "context" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/infra/conf/geodata" ) type configureLoadingContext int const confContextKey = configureLoadingContext(1) type configureLoadingEnvironment struct { geoLoader geodata.Loader } func (c *configureLoadingEn...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/common.go
infra/conf/cfgcommon/common.go
package cfgcommon import ( "encoding/json" "os" "strings" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/protocol" ) //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen type StringList []string func NewStringList(raw []string) *StringList { list := S...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/tlscfg/errors.generated.go
infra/conf/cfgcommon/tlscfg/errors.generated.go
package tlscfg import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/tlscfg/tls.go
infra/conf/cfgcommon/tlscfg/tls.go
package tlscfg import ( "encoding/base64" "strings" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/common/platform/filesystem" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon" "github.com/v2fly/v2ray-core/v5/transport/internet/tls" ) //go:generate go run github.com/v2fly/v2ray-core/v5...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/loader/loader.go
infra/conf/cfgcommon/loader/loader.go
package loader import ( "encoding/json" "strings" ) //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen type ConfigCreator func() interface{} type ConfigCreatorCache map[string]ConfigCreator func (v ConfigCreatorCache) RegisterCreator(id string, creator ConfigCreator) error { if _, found ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/loader/errors.generated.go
infra/conf/cfgcommon/loader/errors.generated.go
package loader import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/proxycfg/proxy.go
infra/conf/cfgcommon/proxycfg/proxy.go
package proxycfg import "github.com/v2fly/v2ray-core/v5/transport/internet" type ProxyConfig struct { Tag string `json:"tag"` TransportLayerProxy bool `json:"transportLayer"` } //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen // Build implements Buildable. func (v *Prox...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/proxycfg/errors.generated.go
infra/conf/cfgcommon/proxycfg/errors.generated.go
package proxycfg import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/duration/duration_test.go
infra/conf/cfgcommon/duration/duration_test.go
package duration_test import ( "encoding/json" "testing" "time" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon/duration" ) type testWithDuration struct { Duration duration.Duration } func TestDurationJSON(t *testing.T) { expected := &testWithDuration{ Duration: duration.Duration(time.Hour), } data, ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/duration/duration.go
infra/conf/cfgcommon/duration/duration.go
package duration import ( "encoding/json" "fmt" "time" ) type Duration int64 func (d *Duration) MarshalJSON() ([]byte, error) { dr := time.Duration(*d) return json.Marshal(dr.String()) } func (d *Duration) UnmarshalJSON(b []byte) error { var v interface{} if err := json.Unmarshal(b, &v); err != nil { retur...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/sniffer/errors.generated.go
infra/conf/cfgcommon/sniffer/errors.generated.go
package sniffer import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/sniffer/sniffer.go
infra/conf/cfgcommon/sniffer/sniffer.go
package sniffer import ( "strings" "github.com/v2fly/v2ray-core/v5/app/proxyman" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon" ) //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen type SniffingConfig struct { Enabled bool `json:"enabled"` DestOverride *cfgc...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/testassist/general.go
infra/conf/cfgcommon/testassist/general.go
package testassist import ( "encoding/json" "testing" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon" ) func LoadJSON(creator func() cfgcommon.Buildable) func(string) (proto.Message, error) { return func(s string) (proto.Message,...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/muxcfg/mux.go
infra/conf/cfgcommon/muxcfg/mux.go
package muxcfg import "github.com/v2fly/v2ray-core/v5/app/proxyman" type MuxConfig struct { Enabled bool `json:"enabled"` Concurrency int16 `json:"concurrency"` } // Build creates MultiplexingConfig, Concurrency < 0 completely disables mux. func (m *MuxConfig) Build() *proxyman.MultiplexingConfig { if m.Conc...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/cfgcommon/socketcfg/socket.go
infra/conf/cfgcommon/socketcfg/socket.go
package socketcfg import ( "strings" "github.com/v2fly/v2ray-core/v5/transport/internet" ) type SocketConfig struct { Mark uint32 `json:"mark"` TFO *bool `json:"tcpFastOpen"` TProxy string `json:"tproxy"` AcceptProxyProtocol bool `json:"acceptProxyProtocol"` ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/dns/dns_test.go
infra/conf/synthetic/dns/dns_test.go
package dns_test import ( "encoding/json" "errors" "io/fs" "os" "path/filepath" "testing" "google.golang.org/protobuf/runtime/protoiface" "github.com/v2fly/v2ray-core/v5/app/dns" "github.com/v2fly/v2ray-core/v5/app/dns/fakedns" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/common...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/dns/errors.generated.go
infra/conf/synthetic/dns/errors.generated.go
package dns import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/dns/dns.go
infra/conf/synthetic/dns/dns.go
package dns //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen import ( "context" "encoding/json" "sort" "strings" "github.com/v2fly/v2ray-core/v5/app/dns" "github.com/v2fly/v2ray-core/v5/app/dns/fakedns" "github.com/v2fly/v2ray-core/v5/app/router/routercommon" "github.com/v2fly/v2ray...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/dns/fakedns.go
infra/conf/synthetic/dns/fakedns.go
package dns import ( "encoding/json" "net" "github.com/v2fly/v2ray-core/v5/app/dns/fakedns" ) type FakeDNSPoolElementConfig struct { IPPool string `json:"ipPool"` LRUSize int64 `json:"poolSize"` } type FakeDNSConfig struct { pool *FakeDNSPoolElementConfig pools []*FakeDNSPoolElementConfig } // UnmarshalJ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/router/errors.generated.go
infra/conf/synthetic/router/errors.generated.go
package router import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/router/router.go
infra/conf/synthetic/router/router.go
package router //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen import ( "context" "encoding/json" "strings" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/app/router" "github.com/v2fly/v2ray-core/v5/common/platform" "github.com/v2fly/v2ray-core/v5/common/serial"...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/router/router_strategy.go
infra/conf/synthetic/router/router_strategy.go
package router import ( "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/app/observatory/burst" "github.com/v2fly/v2ray-core/v5/app/router" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon/duration" "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon/loader" ) const ( strategyRandom s...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/router/router_test.go
infra/conf/synthetic/router/router_test.go
package router_test import ( "encoding/json" "testing" "time" _ "unsafe" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/app/router" "github.com/v2fly/v2ray-core/v5/app/router/routercommon" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/serial" "github...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/synthetic/log/log.go
infra/conf/synthetic/log/log.go
package log import ( "strings" "github.com/v2fly/v2ray-core/v5/app/log" clog "github.com/v2fly/v2ray-core/v5/common/log" ) func DefaultLogConfig() *log.Config { return &log.Config{ Access: &log.LogSpecification{Type: log.LogType_None}, Error: &log.LogSpecification{Type: log.LogType_Console, Level: clog.Seve...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/merge.go
infra/conf/merge/merge.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. /* Package merge provides the capability to merge multiple JSON files or contents into one output. Merge Rules: - Simple values (string, number, boolean) are overwritten, othe...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/merge_test.go
infra/conf/merge/merge_test.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. package merge_test import ( "bytes" "reflect" "strings" "testing" "github.com/v2fly/v2ray-core/v5/infra/conf/merge" "github.com/v2fly/v2ray-core/v5/infra/conf/serial" ) ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/rules.go
infra/conf/merge/rules.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. package merge import "fmt" const ( priorityKey string = "_priority" tagKey string = "_tag" ) // ApplyRules applies merge rules according to _tag, _priority fields, and...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/errors.generated.go
infra/conf/merge/errors.generated.go
package merge import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/priority.go
infra/conf/merge/priority.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. package merge import "sort" func getPriority(v interface{}) float64 { var m map[string]interface{} var ok bool if m, ok = v.(map[string]interface{}); !ok { return 0 } i...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/map.go
infra/conf/merge/map.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. package merge import ( "fmt" "reflect" ) // mergeMaps merges source map into target // it supports only map[string]interface{} type for any children of the map tree func mer...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/merge/tag.go
infra/conf/merge/tag.go
// Copyright 2020 Jebbs. All rights reserved. // Use of this source code is governed by MIT // license that can be found in the LICENSE file. package merge import ( "strings" ) func getTag(v map[string]interface{}, tagKeyOnly bool) string { if !tagKeyOnly { if field, ok := v["tag"]; ok { if t, ok := field.(st...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/followerany.go
infra/conf/v2jsonpb/followerany.go
package v2jsonpb import "google.golang.org/protobuf/reflect/protoreflect" type V2JsonProtobufAnyTypeDescriptor struct { protoreflect.MessageDescriptor } func (v V2JsonProtobufAnyTypeDescriptor) FullName() protoreflect.FullName { return "org.v2fly.SynAny" } func (v V2JsonProtobufAnyTypeDescriptor) Fields() protore...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/errors.generated.go
infra/conf/v2jsonpb/errors.generated.go
package v2jsonpb import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/followermap.go
infra/conf/v2jsonpb/followermap.go
package v2jsonpb import "google.golang.org/protobuf/reflect/protoreflect" type V2JsonProtobufMapFollower struct { protoreflect.Map ValueKind protoreflect.FieldDescriptor } func (v V2JsonProtobufMapFollower) Len() int { panic("implement me") } func (v V2JsonProtobufMapFollower) Range(f func(protoreflect.MapKey, p...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/follower.go
infra/conf/v2jsonpb/follower.go
package v2jsonpb import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/anypb" "github.com/v2fly/v2ray-core/v5/common/serial" ) type V2JsonProtobufFollowerFieldDescriptor struct { protoreflect.FieldDescriptor } type V2JsonProtobufFo...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/v2jsonpb.go
infra/conf/v2jsonpb/v2jsonpb.go
package v2jsonpb import ( "io" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" core "github.com/v2fly/v2ray-core/v5" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/common/buf" "github.com/v2fly/v2ray-core/v5/common/cmdarg" "github.com/v2fly/v2ray-co...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/followerlist.go
infra/conf/v2jsonpb/followerlist.go
package v2jsonpb import "google.golang.org/protobuf/reflect/protoreflect" type V2JsonProtobufListFollower struct { protoreflect.List } func (v V2JsonProtobufListFollower) Len() int { return v.List.Len() } func (v V2JsonProtobufListFollower) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage(&V2Js...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/infra/conf/v2jsonpb/any2.go
infra/conf/v2jsonpb/any2.go
package v2jsonpb import ( "github.com/golang/protobuf/jsonpb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) type anyresolverv2 struct { backgroundResolver jsonpb.AnyResolver } func (r anyresolverv2) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageTyp...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/errors.generated.go
features/errors.generated.go
package features import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/feature.go
features/feature.go
package features import "github.com/v2fly/v2ray-core/v5/common" //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen // Feature is the interface for V2Ray features. All features must implement this interface. // All existing features have an implementation in app directory. These features can b...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/storage.go
features/extension/storage.go
package extension import ( "context" "github.com/v2fly/v2ray-core/v5/features" ) type PersistentStorageEngine interface { features.Feature PersistentStorageEngine() Put(ctx context.Context, key []byte, value []byte) error Get(ctx context.Context, key []byte) ([]byte, error) List(ctx context.Context, keyPrefix...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/browser.go
features/extension/browser.go
package extension import ( "io" "net/http" ) type BrowserForwarder interface { DialWebsocket(url string, header http.Header) (io.ReadWriteCloser, error) } func BrowserForwarderType() interface{} { return (*BrowserForwarder)(nil) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/instance.go
features/extension/instance.go
package extension import ( "context" "github.com/v2fly/v2ray-core/v5/features" ) // InstanceManagement : unstable type InstanceManagement interface { features.Feature ListInstance(ctx context.Context) ([]string, error) AddInstance(ctx context.Context, name string, config []byte, configType string) error StartI...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/contextreceiver.go
features/extension/contextreceiver.go
package extension import "context" type ContextReceiver interface { InjectContext(ctx context.Context) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/observatory.go
features/extension/observatory.go
package extension import ( "context" "github.com/golang/protobuf/proto" "github.com/v2fly/v2ray-core/v5/features" ) type Observatory interface { features.Feature GetObservation(ctx context.Context) (proto.Message, error) } func ObservatoryType() interface{} { return (*Observatory)(nil) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/extension/storage/storage.go
features/extension/storage/storage.go
package storage import ( "context" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/features" ) type ScopedPersistentStorage interface { ScopedPersistentStorageEngine() Put(ctx context.Context, key []byte, value []byte) error Get(ctx context.Context, key []byte) ([]byte, error) List(ctx...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/balancer.go
features/routing/balancer.go
package routing type BalancerOverrider interface { SetOverrideTarget(tag, target string) error GetOverrideTarget(tag string) (string, error) } type BalancerPrincipleTarget interface { GetPrincipleTarget(tag string) ([]string, error) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/router.go
features/routing/router.go
package routing import ( "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/features" ) // Router is a feature to choose an outbound tag for the given request. // // v2ray:api:stable type Router interface { features.Feature // PickRoute returns a route decision based on the given routing con...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/dispatcher.go
features/routing/dispatcher.go
package routing import ( "context" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/features" "github.com/v2fly/v2ray-core/v5/transport" ) // Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules. // Dispatcher is required to be registered in a V2...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/context.go
features/routing/context.go
package routing import ( "github.com/v2fly/v2ray-core/v5/common/net" ) // Context is a feature to store connection information for routing. // // v2ray:api:stable type Context interface { // GetInboundTag returns the tag of the inbound the connection was from. GetInboundTag() string // GetSourcesIPs returns the ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/session/context.go
features/routing/session/context.go
package session import ( "context" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/session" "github.com/v2fly/v2ray-core/v5/features/routing" ) // Context is an implementation of routing.Context, which is a wrapper of context.context with session info. type Context struct { In...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/dns/errors.generated.go
features/routing/dns/errors.generated.go
package dns import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/routing/dns/context.go
features/routing/dns/context.go
package dns //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen import ( "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/features/dns" "github.com/v2fly/v2ray-core/v5/features/routing" ) // ResolvableContext is an implementation of routing.Context, with domain re...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/stats/stats.go
features/stats/stats.go
package stats //go:generate go run github.com/v2fly/v2ray-core/v5/common/errors/errorgen import ( "context" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/features" ) // Counter is the interface for stats counters. // // v2ray:api:stable type Counter interface { // Value is the current ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/stats/errors.generated.go
features/stats/errors.generated.go
package stats import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/dns/client.go
features/dns/client.go
package dns import ( "github.com/v2fly/v2ray-core/v5/common/errors" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/serial" "github.com/v2fly/v2ray-core/v5/features" ) // IPOption is an object for IP query options. type IPOption struct { IPv4Enable bool IPv6Enable bool FakeEn...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/dns/fakedns.go
features/dns/fakedns.go
package dns import ( "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/features" ) // FakeDNSEngine is a V2Ray feature for converting between domain and fake IPs. // // v2ray:api:beta type FakeDNSEngine interface { features.Feature // GetFakeIPForDomain returns fake IP addresses for the...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/dns/localdns/errors.generated.go
features/dns/localdns/errors.generated.go
package localdns import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/dns/localdns/client.go
features/dns/localdns/client.go
package localdns import ( "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/features/dns" ) // Client is an implementation of dns.Client, which queries localhost for DNS. type Client struct{} // Type implements common.HasType. func (*Client) Type() interface{} { return dns.ClientType() }...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/outbound/outbound.go
features/outbound/outbound.go
package outbound import ( "context" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/features" "github.com/v2fly/v2ray-core/v5/transport" ) // Handler is the interface for handlers that process outbound connections. // // v2ray:api:stable type Handler interface { common.Runnable Tag() st...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/inbound/inbound.go
features/inbound/inbound.go
package inbound import ( "context" "github.com/v2fly/v2ray-core/v5/common" "github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/features" ) // Handler is the interface for handlers that process inbound connections. // // v2ray:api:stable type Handler interface { common.Runnable // The ta...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/policy/policy.go
features/policy/policy.go
package policy import ( "context" "runtime" "time" "github.com/v2fly/v2ray-core/v5/common/platform" "github.com/v2fly/v2ray-core/v5/features" ) // Timeout contains limits for connection timeout. type Timeout struct { // Timeout for handshake phase in a connection. Handshake time.Duration // Timeout for conne...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/features/policy/default.go
features/policy/default.go
package policy import ( "time" ) // DefaultManager is the implementation of the Manager. type DefaultManager struct{} // Type implements common.HasType. func (DefaultManager) Type() interface{} { return ManagerType() } // ForLevel implements Manager. func (DefaultManager) ForLevel(level uint32) Session { p := Se...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/common_test.go
common/common_test.go
package common_test import ( "errors" "testing" . "github.com/v2fly/v2ray-core/v5/common" ) func TestMust(t *testing.T) { hasPanic := func(f func()) (ret bool) { defer func() { if r := recover(); r != nil { ret = true } }() f() return false } testCases := []struct { Input func() Panic bo...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/type_test.go
common/type_test.go
package common_test import ( "context" "testing" . "github.com/v2fly/v2ray-core/v5/common" ) type TConfig struct { value int } type YConfig struct { value string } func TestObjectCreation(t *testing.T) { f := func(ctx context.Context, t interface{}) (interface{}, error) { return func() int { return t.(*...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/errors.generated.go
common/errors.generated.go
package common import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/interfaces.go
common/interfaces.go
package common import "github.com/v2fly/v2ray-core/v5/common/errors" // Closable is the interface for objects that can release its resources. // // v2ray:api:beta type Closable interface { // Close release all resources used by this object, including goroutines. Close() error } // Interruptible is an interface for...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/type.go
common/type.go
package common import ( "context" "reflect" "github.com/v2fly/v2ray-core/v5/common/registry" ) // ConfigCreator is a function to create an object by a config. type ConfigCreator func(ctx context.Context, config interface{}) (interface{}, error) var typeCreatorRegistry = make(map[reflect.Type]ConfigCreator) // R...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/common.go
common/common.go
// Package common contains common utilities that are shared among other packages. // See each sub-package for detail. package common import ( "fmt" "go/build" "io" "net/http" "net/url" "os" "path/filepath" "strings" "time" "github.com/v2fly/v2ray-core/v5/common/errors" ) //go:generate go run github.com/v2f...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/antireplay/bloomring.go
common/antireplay/bloomring.go
package antireplay import ( "sync" ss_bloomring "github.com/v2fly/ss-bloomring" ) type BloomRing struct { *ss_bloomring.BloomRing lock *sync.Mutex } func (b BloomRing) Interval() int64 { return 9999999 } func (b BloomRing) Check(sum []byte) bool { b.lock.Lock() defer b.lock.Unlock() if b.Test(sum) { retu...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/antireplay/replayfilter.go
common/antireplay/replayfilter.go
package antireplay import ( "sync" "time" cuckoo "github.com/seiflotfy/cuckoofilter" ) const replayFilterCapacity = 100000 // ReplayFilter checks for replay attacks. type ReplayFilter struct { lock sync.Mutex poolA *cuckoo.Filter poolB *cuckoo.Filter poolSwap bool lastSwap int64 interval int64 } ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/antireplay/antireplay.go
common/antireplay/antireplay.go
package antireplay type GeneralizedReplayFilter interface { Interval() int64 Check(sum []byte) bool }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/bitmask/byte_test.go
common/bitmask/byte_test.go
package bitmask_test import ( "testing" . "github.com/v2fly/v2ray-core/v5/common/bitmask" ) func TestBitmaskByte(t *testing.T) { b := Byte(0) b.Set(Byte(1)) if !b.Has(1) { t.Fatal("expected ", b, " to contain 1, but actually not") } b.Set(Byte(2)) if !b.Has(2) { t.Fatal("expected ", b, " to contain 2, b...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/bitmask/byte.go
common/bitmask/byte.go
package bitmask // Byte is a bitmask in byte. type Byte byte // Has returns true if this bitmask contains another bitmask. func (b Byte) Has(bb Byte) bool { return (b & bb) != 0 } func (b *Byte) Set(bb Byte) { *b |= bb } func (b *Byte) Clear(bb Byte) { *b &= ^bb } func (b *Byte) Toggle(bb Byte) { *b ^= bb }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/cmdarg/errors.generated.go
common/cmdarg/errors.generated.go
package cmdarg import "github.com/v2fly/v2ray-core/v5/common/errors" type errPathObjHolder struct{} func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/cmdarg/cmdarg.go
common/cmdarg/cmdarg.go
package cmdarg import "strings" // Arg is used by flag to accept multiple argument. type Arg []string func (c *Arg) String() string { return strings.Join([]string(*c), " ") } // Set is the method flag package calls func (c *Arg) Set(value string) error { *c = append(*c, value) return nil }
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/cmdarg/arg.go
common/cmdarg/arg.go
package cmdarg import ( "bytes" "io" "os" ) // LoadArg loads one arg, maybe an remote url, or local file path func LoadArg(arg string) (out io.Reader, err error) { bs, err := LoadArgToBytes(arg) if err != nil { return nil, err } out = bytes.NewBuffer(bs) return } // LoadArgToBytes loads one arg to []byte, ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/cache/lru_test.go
common/cache/lru_test.go
package cache_test import ( "testing" . "github.com/v2fly/v2ray-core/v5/common/cache" ) func TestLruReplaceValue(t *testing.T) { lru := NewLru(2) lru.Put(2, 6) lru.Put(1, 5) lru.Put(1, 2) v, _ := lru.Get(1) if v != 2 { t.Error("should get 2", v) } v, _ = lru.Get(2) if v != 6 { t.Error("should get 6", ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/cache/lru.go
common/cache/lru.go
package cache import ( "container/list" "sync" ) // Lru simple, fast lru cache implementation type Lru interface { Get(key interface{}) (value interface{}, ok bool) GetKeyFromValue(value interface{}) (key interface{}, ok bool) Put(key, value interface{}) } type lru struct { capacity int doubleLinkedli...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/units/bytesize.go
common/units/bytesize.go
package units import ( "errors" "strconv" "strings" "unicode" ) var ( errInvalidSize = errors.New("invalid size") errInvalidUnit = errors.New("invalid or unsupported unit") ) // ByteSize is the size of bytes type ByteSize uint64 const ( _ = iota // KB = 1KB KB ByteSize = 1 << (10 * iota) // MB = 1MB MB ...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/units/bytesize_test.go
common/units/bytesize_test.go
package units_test import ( "testing" "github.com/v2fly/v2ray-core/v5/common/units" ) func TestByteSizes(t *testing.T) { size := units.ByteSize(0) assertSizeString(t, size, "0") size++ assertSizeValue(t, assertSizeString(t, size, "1.00B"), size, ) size <<= 10 assertSizeValue(t, assertSizeString(t, siz...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/errors/errors_test.go
common/errors/errors_test.go
package errors_test import ( "io" "strings" "testing" "github.com/google/go-cmp/cmp" . "github.com/v2fly/v2ray-core/v5/common/errors" "github.com/v2fly/v2ray-core/v5/common/log" ) func TestError(t *testing.T) { err := New("TestError") if v := GetSeverity(err); v != log.Severity_Info { t.Error("severity: "...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/errors/multi_error.go
common/errors/multi_error.go
package errors import ( "strings" ) type multiError []error func (e multiError) Error() string { var r strings.Builder r.WriteString("multierr: ") for _, err := range e { r.WriteString(err.Error()) r.WriteString(" | ") } return r.String() } func Combine(maybeError ...error) error { var errs multiError f...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/errors/errors.go
common/errors/errors.go
// Package errors is a drop-in replacement for Golang lib 'errors'. package errors import ( "os" "reflect" "strings" "github.com/v2fly/v2ray-core/v5/common/log" "github.com/v2fly/v2ray-core/v5/common/serial" ) type hasInnerError interface { // Inner returns the underlying error of this one. Inner() error } t...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/errors/errorgen/main.go
common/errors/errorgen/main.go
package main import ( "fmt" "os" "path/filepath" ) func main() { pwd, err := os.Getwd() if err != nil { fmt.Println("can not get current working directory") os.Exit(1) } pkg := filepath.Base(pwd) if pkg == "v2ray-core" { pkg = "core" } file, err := os.OpenFile("errors.generated.go", os.O_WRONLY|os.O_...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/buf/writer_test.go
common/buf/writer_test.go
package buf_test import ( "bufio" "bytes" "crypto/rand" "io" "testing" "github.com/google/go-cmp/cmp" "github.com/v2fly/v2ray-core/v5/common" . "github.com/v2fly/v2ray-core/v5/common/buf" "github.com/v2fly/v2ray-core/v5/transport/pipe" ) func TestWriter(t *testing.T) { lb := New() common.Must2(lb.ReadFro...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/buf/readv_posix.go
common/buf/readv_posix.go
//go:build !windows && !wasm && !illumos // +build !windows,!wasm,!illumos package buf import ( "syscall" "unsafe" ) type posixReader struct { iovecs []syscall.Iovec } func (r *posixReader) Init(bs []*Buffer) { iovecs := r.iovecs if iovecs == nil { iovecs = make([]syscall.Iovec, 0, len(bs)) } for idx, b :=...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false
v2fly/v2ray-core
https://github.com/v2fly/v2ray-core/blob/b2c3b2506695d872162baeed95c9525fbfdbfda0/common/buf/readv_windows.go
common/buf/readv_windows.go
package buf import ( "syscall" ) type windowsReader struct { bufs []syscall.WSABuf } func (r *windowsReader) Init(bs []*Buffer) { if r.bufs == nil { r.bufs = make([]syscall.WSABuf, 0, len(bs)) } for _, b := range bs { r.bufs = append(r.bufs, syscall.WSABuf{Len: uint32(Size), Buf: &b.v[0]}) } } func (r *wi...
go
MIT
b2c3b2506695d872162baeed95c9525fbfdbfda0
2026-01-07T08:36:12.135351Z
false