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 |
|---|---|---|---|---|---|---|---|---|
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/mtproto_test.go | infra/conf/mtproto_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/mtproto"
)
func TestMTProtoServerConfig(t *testing.T) {
creator := func() Buildable {
return new(MTProtoServerConfig)
}
runMultiTestCase(t, []TestCase{
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/errors.generated.go | infra/conf/errors.generated.go | package conf
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/vless_test.go | infra/conf/vless_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/vless"
"v2ray.com/core/proxy/vless/inbound"
"v2ray.com/core/proxy/vless/outbound"
)
func TestVLessOutbound(t *testing.T) {
crea... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/buildable.go | infra/conf/buildable.go | package conf
import "github.com/golang/protobuf/proto"
type Buildable interface {
Build() (proto.Message, error)
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/transport_test.go | infra/conf/transport_test.go | package conf_test
import (
"encoding/json"
"testing"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/transport"
"v2ray.com/core/transport/internet"
"v2ray.com/core/transport/internet/headers/http"
"v2ray.com/cor... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/shadowsocks.go | infra/conf/shadowsocks.go | package conf
import (
"strings"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/shadowsocks"
)
func cipherFromString(c string) shadowsocks.CipherType {
switch strings.ToLower(c) {
case "aes-256-cfb":
return shadowsocks.CipherType_AES_... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/transport_internet.go | infra/conf/transport_internet.go | package conf
import (
"encoding/json"
"strings"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/platform/filesystem"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/transport/internet"
"v2ray.com/core/transport/internet/domainsocket"
"v2ray.com/core/transport/interne... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/dns_proxy_test.go | infra/conf/dns_proxy_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/dns"
)
func TestDnsProxyConfig(t *testing.T) {
creator := func() Buildable {
return new(DnsOutboundConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"address": "8.8.8.8",
"p... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/router.go | infra/conf/router.go | package conf
import (
"encoding/json"
"strconv"
"strings"
"v2ray.com/core/app/router"
"v2ray.com/core/common/net"
"v2ray.com/core/common/platform/filesystem"
"github.com/golang/protobuf/proto"
)
type RouterRulesConfig struct {
RuleList []json.RawMessage `json:"rules"`
DomainStrategy string ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/vless.go | infra/conf/vless.go | package conf
import (
"encoding/json"
"runtime"
"strconv"
"syscall"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/vless"
"v2ray.com/core/proxy/vless/inbound"
"v2ray.com/core/proxy/vless/outbound"
)
type... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/v2ray.go | infra/conf/v2ray.go | package conf
import (
"encoding/json"
"log"
"os"
"strings"
"v2ray.com/core"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/app/stats"
"v2ray.com/core/common/serial"
"v2ray.com/core/transport/internet/xtls"
)
var (
inboundConfigLoader = NewJSONConfigLoader(ConfigCreatorCache{... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/dns.go | infra/conf/dns.go | package conf
import (
"encoding/json"
"sort"
"strings"
"v2ray.com/core/app/dns"
"v2ray.com/core/app/router"
"v2ray.com/core/common/net"
)
type NameServerConfig struct {
Address *Address
Port uint16
Domains []string
ExpectIPs StringList
}
func (c *NameServerConfig) UnmarshalJSON(data []byte) error... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/conf.go | infra/conf/conf.go | package conf
//go:generate go run v2ray.com/core/common/errors/errorgen
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/vmess_test.go | infra/conf/vmess_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/vmess"
"v2ray.com/core/proxy/vmess/inbound"
"v2ray.com/core/proxy/vmess/outbound"
)
func TestVMessOutbound(t *testing.T) {
crea... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/log.go | infra/conf/log.go | package conf
import (
"strings"
"v2ray.com/core/app/log"
clog "v2ray.com/core/common/log"
)
func DefaultLogConfig() *log.Config {
return &log.Config{
AccessLogType: log.LogType_None,
ErrorLogType: log.LogType_Console,
ErrorLogLevel: clog.Severity_Warning,
}
}
type LogConfig struct {
AccessLog string `j... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/dokodemo_test.go | infra/conf/dokodemo_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/dokodemo"
)
func TestDokodemoConfig(t *testing.T) {
creator := func() Buildable {
return new(DokodemoConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"address": "8.8.8.8",
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/socks_test.go | infra/conf/socks_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/socks"
)
func TestSocksInboundConfig(t *testing.T) {
creator := func() Buildable {
return new(SocksServerConfig)
}
runMultiT... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/v2ray_test.go | infra/conf/v2ray_test.go | package conf_test
import (
"encoding/json"
"reflect"
"testing"
"github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"v2ray.com/core"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core/app/log"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/app/router"
"v2ray.com/core/common"
clog "v2ray.com/core/... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/mtproto.go | infra/conf/mtproto.go | package conf
import (
"encoding/hex"
"encoding/json"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/mtproto"
)
type MTProtoAccount struct {
Secret string `json:"secret"`
}
// Build implements Buildable
func (a *MTProtoAccount) Build()... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/blackhole.go | infra/conf/blackhole.go | package conf
import (
"encoding/json"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/blackhole"
)
type NoneResponse struct{}
func (*NoneResponse) Build() (proto.Message, error) {
return new(blackhole.NoneResponse), nil
}
type HttpResponse struct{}
func (*HttpResponse... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/freedom_test.go | infra/conf/freedom_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/freedom"
)
func TestFreedomConfig(t *testing.T) {
creator := func() Buildable {
return new(FreedomConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/http_test.go | infra/conf/http_test.go | package conf_test
import (
"testing"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/http"
)
func TestHttpServerConfig(t *testing.T) {
creator := func() Buildable {
return new(HttpServerConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"timeout": 10,
"accounts": [
{
"user": "... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/http.go | infra/conf/http.go | package conf
import (
"encoding/json"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/http"
)
type HttpAccount struct {
Username string `json:"user"`
Password string `json:"pass"`
}
func (v *HttpAccount) Build() *http.Account {
return ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/router_test.go | infra/conf/router_test.go | package conf_test
import (
"encoding/json"
"testing"
"github.com/golang/protobuf/proto"
"v2ray.com/core/app/router"
"v2ray.com/core/common/net"
. "v2ray.com/core/infra/conf"
)
func TestRouterConfig(t *testing.T) {
createParser := func() func(string) (proto.Message, error) {
return func(s string) (proto.Mes... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/freedom.go | infra/conf/freedom.go | package conf
import (
"net"
"strings"
"github.com/golang/protobuf/proto"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/proxy/freedom"
)
type FreedomConfig struct {
DomainStrategy string `json:"domainStrategy"`
Timeout *uint32 `json:"timeout"`
Redirect strin... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/trojan.go | infra/conf/trojan.go | package conf
import (
"encoding/json"
"runtime"
"strconv"
"syscall"
"github.com/golang/protobuf/proto" // nolint: staticcheck
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/trojan"
)
// TrojanServerTarget is configuration of a single trojan... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/shadowsocks_test.go | infra/conf/shadowsocks_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/shadowsocks"
)
func TestShadowsocksServerConfigParsing(t *testing.T) {
creator := func() Buildable {
return new(ShadowsocksServ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/blackhole_test.go | infra/conf/blackhole_test.go | package conf_test
import (
"testing"
"v2ray.com/core/common/serial"
. "v2ray.com/core/infra/conf"
"v2ray.com/core/proxy/blackhole"
)
func TestHTTPResponseJSON(t *testing.T) {
creator := func() Buildable {
return new(BlackholeConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"response": {
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/transport_authenticators.go | infra/conf/transport_authenticators.go | package conf
import (
"sort"
"github.com/golang/protobuf/proto"
"v2ray.com/core/transport/internet/headers/http"
"v2ray.com/core/transport/internet/headers/noop"
"v2ray.com/core/transport/internet/headers/srtp"
"v2ray.com/core/transport/internet/headers/tls"
"v2ray.com/core/transport/internet/headers/utp"
"v... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/transport.go | infra/conf/transport.go | package conf
import (
"v2ray.com/core/common/serial"
"v2ray.com/core/transport"
"v2ray.com/core/transport/internet"
)
type TransportConfig struct {
TCPConfig *TCPConfig `json:"tcpSettings"`
KCPConfig *KCPConfig `json:"kcpSettings"`
WSConfig *WebSocketConfig `json:"wsSettings"`
HTTPConf... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/dokodemo.go | infra/conf/dokodemo.go | package conf
import (
"github.com/golang/protobuf/proto"
"v2ray.com/core/proxy/dokodemo"
)
type DokodemoConfig struct {
Host *Address `json:"address"`
PortValue uint16 `json:"port"`
NetworkList *NetworkList `json:"network"`
TimeoutValue uint32 `json:"timeout"`
Redirect bool ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/general_test.go | infra/conf/general_test.go | package conf_test
import (
"encoding/json"
"testing"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common"
. "v2ray.com/core/infra/conf"
)
func loadJSON(creator func() Buildable) func(string) (proto.Message, error) {
return func(s string) (proto.Message, error) {
instance := creator()
if err := json.U... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/dns_proxy.go | infra/conf/dns_proxy.go | package conf
import (
"github.com/golang/protobuf/proto"
"v2ray.com/core/common/net"
"v2ray.com/core/proxy/dns"
)
type DnsOutboundConfig struct {
Network Network `json:"network"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
}
func (c *DnsOutboundConfig) Build() (proto.Message, error) {
co... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/common.go | infra/conf/common.go | package conf
import (
"encoding/json"
"os"
"strings"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
)
type StringList []string
func NewStringList(raw []string) *StringList {
list := StringList(raw)
return &list
}
func (v StringList) Len() int {
return len(v)
}
func (v *StringList) UnmarshalJ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/reverse_test.go | infra/conf/reverse_test.go | package conf_test
import (
"testing"
"v2ray.com/core/app/reverse"
"v2ray.com/core/infra/conf"
)
func TestReverseConfig(t *testing.T) {
creator := func() conf.Buildable {
return new(conf.ReverseConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"bridges": [{
"tag": "test",
"domain": "te... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/command/errors.generated.go | infra/conf/command/errors.generated.go | package command
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/command/command.go | infra/conf/command/command.go | package command
//go:generate go run v2ray.com/core/common/errors/errorgen
import (
"os"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common"
"v2ray.com/core/infra/conf/serial"
"v2ray.com/core/infra/control"
)
type ConfigCommand struct{}
func (c *ConfigCommand) Name() string {
return "config"
}
func (... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/json/reader.go | infra/conf/json/reader.go | package json
import (
"io"
"v2ray.com/core/common/buf"
)
// State is the internal state of parser.
type State byte
const (
StateContent State = iota
StateEscape
StateDoubleQuote
StateDoubleQuoteEscape
StateSingleQuote
StateSingleQuoteEscape
StateComment
StateSlash
StateMultilineComment
StateMultilineCom... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/json/reader_test.go | infra/conf/json/reader_test.go | package json_test
import (
"bytes"
"io"
"testing"
"github.com/google/go-cmp/cmp"
"v2ray.com/core/common"
. "v2ray.com/core/infra/conf/json"
)
func TestReader(t *testing.T) {
data := []struct {
input string
output string
}{
{
`
content #comment 1
#comment 2
content 2`,
`
content
content 2`},
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/serial/loader.go | infra/conf/serial/loader.go | package serial
import (
"bytes"
"encoding/json"
"io"
"v2ray.com/core"
"v2ray.com/core/common/errors"
"v2ray.com/core/infra/conf"
json_reader "v2ray.com/core/infra/conf/json"
)
type offset struct {
line int
char int
}
func findOffset(b []byte, o int) *offset {
if o >= len(b) || o < 0 {
return nil
}
li... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/serial/errors.generated.go | infra/conf/serial/errors.generated.go | package serial
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/serial/serial.go | infra/conf/serial/serial.go | package serial
//go:generate go run v2ray.com/core/common/errors/errorgen
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/conf/serial/loader_test.go | infra/conf/serial/loader_test.go | package serial_test
import (
"bytes"
"strings"
"testing"
"v2ray.com/core/infra/conf/serial"
)
func TestLoaderError(t *testing.T) {
testCases := []struct {
Input string
Output string
}{
{
Input: `{
"log": {
// abcd
0,
"loglevel": "info"
}
}`,
Output: "line 4 char 6",
},
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/uuid.go | infra/control/uuid.go | package control
import (
"fmt"
"v2ray.com/core/common"
"v2ray.com/core/common/uuid"
)
type UUIDCommand struct{}
func (c *UUIDCommand) Name() string {
return "uuid"
}
func (c *UUIDCommand) Description() Description {
return Description{
Short: "Generate new UUIDs",
Usage: []string{"v2ctl uuid"},
}
}
func... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/verify.go | infra/control/verify.go | package control
import (
"flag"
"github.com/xiaokangwang/VSign/signerVerify"
"os"
"v2ray.com/core/common"
)
type VerifyCommand struct{}
func (c *VerifyCommand) Name() string {
return "verify"
}
func (c *VerifyCommand) Description() Description {
return Description{
Short: "Verify if a binary is officially s... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/api.go | infra/control/api.go | package control
import (
"context"
"errors"
"flag"
"fmt"
"strings"
"time"
"github.com/golang/protobuf/proto"
"google.golang.org/grpc"
logService "v2ray.com/core/app/log/command"
statsService "v2ray.com/core/app/stats/command"
"v2ray.com/core/common"
)
type ApiCommand struct{}
func (c *ApiCommand) Name()... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/errors.generated.go | infra/control/errors.generated.go | package control
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/config.go | infra/control/config.go | package control
import (
"bytes"
"io"
"io/ioutil"
"os"
"strings"
"github.com/golang/protobuf/proto"
"v2ray.com/core/common"
"v2ray.com/core/infra/conf"
"v2ray.com/core/infra/conf/serial"
)
// ConfigCommand is the json to pb convert struct
type ConfigCommand struct{}
// Name for cmd usage
func (c *ConfigCom... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/tlsping.go | infra/control/tlsping.go | package control
import (
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
"net"
"v2ray.com/core/common"
)
type TlsPingCommand struct{}
func (c *TlsPingCommand) Name() string {
return "tlsping"
}
func (c *TlsPingCommand) Description() Description {
return Description{
Short: "Ping the domain with TLS handshake",
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/fetch.go | infra/control/fetch.go | package control
import (
"net/http"
"net/url"
"os"
"strings"
"time"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
)
type FetchCommand struct{}
func (c *FetchCommand) Name() string {
return "fetch"
}
func (c *FetchCommand) Description() Description {
return Description{
Short: "Fetch resources",
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/control.go | infra/control/control.go | package control
//go:generate go run v2ray.com/core/common/errors/errorgen
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/cert.go | infra/control/cert.go | package control
import (
"context"
"crypto/x509"
"encoding/json"
"flag"
"os"
"strings"
"time"
"v2ray.com/core/common"
"v2ray.com/core/common/protocol/tls/cert"
"v2ray.com/core/common/task"
)
type stringList []string
func (l *stringList) String() string {
return "String list"
}
func (l *stringList) Set(v... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/command.go | infra/control/command.go | package control
import (
"fmt"
"log"
"os"
"strings"
)
type Description struct {
Short string
Usage []string
}
type Command interface {
Name() string
Description() Description
Execute(args []string) error
}
var (
commandRegistry = make(map[string]Command)
ctllog = log.New(os.Stderr, "v2ctl> ", 0)... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/love.go | infra/control/love.go | package control
import (
"bufio"
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"v2ray.com/core/common"
"v2ray.com/core/common/platform"
)
const content = "H4sIAAAAAAAC/4SVMaskNwzH+/kUW6izcSthMGrcqLhVk0rdQS5cSMg7Xu4S0vizB8meZd57M3ta2GHX/ukvyZZmY2ZKDMzCzJyY5yOlxKII1omsf+qkBiiC6WhbYsbkjDAfySQsJqD3jtrD0EBM3sBHz... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/infra/control/main/main.go | infra/control/main/main.go | package main
import (
"flag"
"fmt"
"os"
commlog "v2ray.com/core/common/log"
// _ "v2ray.com/core/infra/conf/command"
"v2ray.com/core/infra/control"
)
func getCommandName() string {
if len(os.Args) > 1 {
return os.Args[1]
}
return ""
}
func main() {
// let the v2ctl prints log at stderr
commlog.Register... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/errors.generated.go | features/errors.generated.go | package features
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/feature.go | features/feature.go | package features
import "v2ray.com/core/common"
//go:generate go run v2ray.com/core/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 be replaced by third-party ones.
... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/router.go | features/routing/router.go | package routing
import (
"v2ray.com/core/common"
"v2ray.com/core/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 context.
PickRoute(ctx Context) (R... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/dispatcher.go | features/routing/dispatcher.go | package routing
import (
"context"
"v2ray.com/core/common/net"
"v2ray.com/core/features"
"v2ray.com/core/transport"
)
// Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules.
// Dispatcher is required to be registered in a V2Ray instance to make V2Ray function properly.
//... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/context.go | features/routing/context.go | package routing
import (
"v2ray.com/core/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 source IPs bound... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/session/context.go | features/routing/session/context.go | package session
import (
"context"
"v2ray.com/core/common/net"
"v2ray.com/core/common/session"
"v2ray.com/core/features/routing"
)
// Context is an implementation of routing.Context, which is a wrapper of context.context with session info.
type Context struct {
Inbound *session.Inbound
Outbound *session.Outbo... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/dns/errors.generated.go | features/routing/dns/errors.generated.go | package dns
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/routing/dns/context.go | features/routing/dns/context.go | package dns
//go:generate go run v2ray.com/core/common/errors/errorgen
import (
"v2ray.com/core/common/net"
"v2ray.com/core/features/dns"
"v2ray.com/core/features/routing"
)
// ResolvableContext is an implementation of routing.Context, with domain resolving capability.
type ResolvableContext struct {
routing.Con... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/stats/stats.go | features/stats/stats.go | package stats
//go:generate go run v2ray.com/core/common/errors/errorgen
import (
"context"
"v2ray.com/core/common"
"v2ray.com/core/features"
)
// Counter is the interface for stats counters.
//
// v2ray:api:stable
type Counter interface {
// Value is the current value of the counter.
Value() int64
// Set set... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/stats/errors.generated.go | features/stats/errors.generated.go | package stats
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/dns/client.go | features/dns/client.go | package dns
import (
"v2ray.com/core/common/errors"
"v2ray.com/core/common/net"
"v2ray.com/core/common/serial"
"v2ray.com/core/features"
)
// Client is a V2Ray feature for querying DNS information.
//
// v2ray:api:stable
type Client interface {
features.Feature
// LookupIP returns IP address for the given doma... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/dns/localdns/client.go | features/dns/localdns/client.go | package localdns
import (
"v2ray.com/core/common/net"
"v2ray.com/core/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()
}
// Start implements common.Run... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/outbound/outbound.go | features/outbound/outbound.go | package outbound
import (
"context"
"v2ray.com/core/common"
"v2ray.com/core/features"
"v2ray.com/core/transport"
)
// Handler is the interface for handlers that process outbound connections.
//
// v2ray:api:stable
type Handler interface {
common.Runnable
Tag() string
Dispatch(ctx context.Context, link *transp... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/inbound/inbound.go | features/inbound/inbound.go | package inbound
import (
"context"
"v2ray.com/core/common"
"v2ray.com/core/common/net"
"v2ray.com/core/features"
)
// Handler is the interface for handlers that process inbound connections.
//
// v2ray:api:stable
type Handler interface {
common.Runnable
// The tag of this handler.
Tag() string
// Deprecated... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/features/policy/policy.go | features/policy/policy.go | package policy
import (
"context"
"runtime"
"time"
"v2ray.com/core/common/platform"
"v2ray.com/core/features"
)
// Timeout contains limits for connection timeout.
type Timeout struct {
// Timeout for handshake phase in a connection.
Handshake time.Duration
// Timeout for connection being idle, i.e., there is... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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 | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/common_test.go | common/common_test.go | package common_test
import (
"errors"
"testing"
. "v2ray.com/core/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 bool
}{
{
Pa... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/type_test.go | common/type_test.go | package common_test
import (
"context"
"testing"
. "v2ray.com/core/common"
)
type TConfig struct {
value int
}
type YConfig struct {
value string
}
func TestObjectCreation(t *testing.T) {
var f = func(ctx context.Context, t interface{}) (interface{}, error) {
return func() int {
return t.(*TConfig).valu... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/errors.generated.go | common/errors.generated.go | package common
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/interfaces.go | common/interfaces.go | package common
import "v2ray.com/core/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 objects that ca... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/type.go | common/type.go | package common
import (
"context"
"reflect"
)
// 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)
)
// RegisterConfig registers a global config creato... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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/ioutil"
"os"
"path/filepath"
"strings"
"v2ray.com/core/common/errors"
)
//go:generate go run v2ray.com/core/common/errors/errorgen
var (
// ErrNo... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/antireplay/antireplay.go | common/antireplay/antireplay.go | package antireplay
import (
cuckoo "github.com/seiflotfy/cuckoofilter"
"sync"
"time"
)
func NewAntiReplayWindow(AntiReplayTime int64) *AntiReplayWindow {
arw := &AntiReplayWindow{}
arw.AntiReplayTime = AntiReplayTime
return arw
}
type AntiReplayWindow struct {
lock sync.Mutex
poolA *cuckoo... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/bitmask/byte_test.go | common/bitmask/byte_test.go | package bitmask_test
import (
"testing"
. "v2ray.com/core/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, but actually not"... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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 | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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 | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/errors/errors_test.go | common/errors/errors_test.go | package errors_test
import (
"io"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
. "v2ray.com/core/common/errors"
"v2ray.com/core/common/log"
)
func TestError(t *testing.T) {
err := New("TestError")
if v := GetSeverity(err); v != log.Severity_Info {
t.Error("severity: ", v)
}
err = New("TestError2"... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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 | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/errors/errors.go | common/errors/errors.go | // Package errors is a drop-in replacement for Golang lib 'errors'.
package errors // import "v2ray.com/core/common/errors"
import (
"os"
"reflect"
"strings"
"v2ray.com/core/common/log"
"v2ray.com/core/common/serial"
)
type hasInnerError interface {
// Inner returns the underlying error of this one.
Inner() e... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/errors/errorgen/main.go | common/errors/errorgen/main.go | package main
import (
"fmt"
"log"
"os"
"path/filepath"
"v2ray.com/core/common"
)
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"
}
moduleName, gmnErr := common.Get... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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"
"v2ray.com/core/common"
. "v2ray.com/core/common/buf"
"v2ray.com/core/transport/pipe"
)
func TestWriter(t *testing.T) {
lb := New()
common.Must2(lb.ReadFrom(rand.Reader))
expectedBytes := append([]byte... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/readv_posix.go | common/buf/readv_posix.go | // +build !windows
// +build !wasm
// +build !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 := range bs {
iovecs ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/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 | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/errors.generated.go | common/buf/errors.generated.go | package buf
import "v2ray.com/core/common/errors"
type errPathObjHolder struct{}
func newError(values ...interface{}) *errors.Error {
return errors.New(values...).WithPathObj(errPathObjHolder{})
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/buffer.go | common/buf/buffer.go | package buf
import (
"io"
"v2ray.com/core/common/bytespool"
)
const (
// Size of a regular buffer.
Size = 2048
)
// Buffer is a recyclable allocation of a byte array. Buffer.Release() recycles
// the buffer into an internal buffer pool, in order to recreate a buffer more
// quickly.
type Buffer struct {
v ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/multi_buffer.go | common/buf/multi_buffer.go | package buf
import (
"io"
"v2ray.com/core/common"
"v2ray.com/core/common/errors"
"v2ray.com/core/common/serial"
)
// ReadAllToBytes reads all content from the reader into a byte array, until EOF.
func ReadAllToBytes(reader io.Reader) ([]byte, error) {
mb, err := ReadFrom(reader)
if err != nil {
return nil, e... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/io_test.go | common/buf/io_test.go | package buf_test
import (
"crypto/tls"
"io"
"testing"
. "v2ray.com/core/common/buf"
"v2ray.com/core/common/net"
"v2ray.com/core/testing/servers/tcp"
)
func TestWriterCreation(t *testing.T) {
tcpServer := tcp.Server{}
dest, err := tcpServer.Start()
if err != nil {
t.Fatal("failed to start tcp server: ", er... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/buf.go | common/buf/buf.go | // Package buf provides a light-weight memory allocation mechanism.
package buf // import "v2ray.com/core/common/buf"
//go:generate go run v2ray.com/core/common/errors/errorgen
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/writer.go | common/buf/writer.go | package buf
import (
"io"
"net"
"sync"
"v2ray.com/core/common"
"v2ray.com/core/common/errors"
)
// BufferToBytesWriter is a Writer that writes alloc.Buffer into underlying writer.
type BufferToBytesWriter struct {
io.Writer
cache [][]byte
}
// WriteMultiBuffer implements Writer. This method takes ownership ... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/reader.go | common/buf/reader.go | package buf
import (
"io"
"v2ray.com/core/common"
"v2ray.com/core/common/errors"
)
func readOneUDP(r io.Reader) (*Buffer, error) {
b := New()
for i := 0; i < 64; i++ {
_, err := b.ReadFrom(r)
if !b.IsEmpty() {
return b, nil
}
if err != nil {
b.Release()
return nil, err
}
}
b.Release()
ret... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/reader_test.go | common/buf/reader_test.go | package buf_test
import (
"bytes"
"io"
"strings"
"testing"
"v2ray.com/core/common"
. "v2ray.com/core/common/buf"
"v2ray.com/core/transport/pipe"
)
func TestBytesReaderWriteTo(t *testing.T) {
pReader, pWriter := pipe.New(pipe.WithSizeLimit(1024))
reader := &BufferedReader{Reader: pReader}
b1 := New()
b1.Wr... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/io.go | common/buf/io.go | package buf
import (
"io"
"net"
"os"
"syscall"
"time"
)
// Reader extends io.Reader with MultiBuffer.
type Reader interface {
// ReadMultiBuffer reads content from underlying reader, and put it into a MultiBuffer.
ReadMultiBuffer() (MultiBuffer, error)
}
// ErrReadTimeout is an error that happens with IO time... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/copy.go | common/buf/copy.go | package buf
import (
"io"
"time"
"v2ray.com/core/common/errors"
"v2ray.com/core/common/signal"
)
type dataHandler func(MultiBuffer)
type copyHandler struct {
onData []dataHandler
}
// SizeCounter is for counting bytes copied by Copy().
type SizeCounter struct {
Size int64
}
// CopyOption is an option for co... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/buffer_test.go | common/buf/buffer_test.go | package buf_test
import (
"bytes"
"crypto/rand"
"testing"
"github.com/google/go-cmp/cmp"
"v2ray.com/core/common"
. "v2ray.com/core/common/buf"
)
func TestBufferClear(t *testing.T) {
buffer := New()
defer buffer.Release()
payload := "Bytes"
buffer.Write([]byte(payload))
if diff := cmp.Diff(buffer.Bytes(),... | go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
v2ray/v2ray-core | https://github.com/v2ray/v2ray-core/blob/d80440f3d57b45c829dbf513306f7adf9a0f3f76/common/buf/readv_reader_wasm.go | common/buf/readv_reader_wasm.go | // +build wasm
package buf
import (
"io"
"syscall"
)
const useReadv = false
func NewReadVReader(reader io.Reader, rawConn syscall.RawConn) Reader {
panic("not implemented")
}
| go | MIT | d80440f3d57b45c829dbf513306f7adf9a0f3f76 | 2026-01-07T08:35:44.381088Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.