Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

此 Issue 会被立即关闭。

If you are not sure if your question is truely a bug in V2Ray, please discuss it [here](https://github.com/v2fly/discussion/issues) first.
If you are not sure if your question is truly a bug in V2Ray, please discuss it [here](https://github.com/v2fly/discussion/issues) first.

This issue will be closed immediately.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ about: "Create a bug report to help us improve"

<!--
Please answer all the questions with enough information. All issues not following this template will be closed immediately.
If you are not sure if your question is truely a bug of V2Ray, please discuss it at https://github.com/v2fly/v2ray-core/discussions first.
If you are not sure if your question is truly a bug of V2Ray, please discuss it at https://github.com/v2fly/v2ray-core/discussions first.
-->

## What version of V2Ray are you using?
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/other_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ about: "其它问题请使用 https://github.com/v2fly/v2ray-core/discussions

此 Issue 会被立即关闭。

If you are not sure if your question is truely a bug in V2Ray, please discuss it [here](https://github.com/v2fly/v2ray-core/discussions) first.
If you are not sure if your question is truly a bug in V2Ray, please discuss it [here](https://github.com/v2fly/v2ray-core/discussions) first.

This issue will be closed immediately.
2 changes: 1 addition & 1 deletion app/dns/fakedns/fakedns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func TestFakeDNSMultiAddPool(t *testing.T) {
})
common.Must(err)
if len(pools.holders) != 2 {
t.Error("HolderMulti.AddPoolMutli not returning holderMulti that has the same length as passed PoolMulti config")
t.Error("HolderMulti.AddPoolMulti not returning holderMulti that has the same length as passed PoolMulti config")
}
if pools.holders[0] != fakeMulti.holders[2] {
t.Error("HolderMulti.AddPoolMulti not returning same holder for existing IPv4 pool 192.168.168.0/16")
Expand Down
2 changes: 1 addition & 1 deletion app/dns/nameserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func NewClient(ctx context.Context, ns *NameServer, dns *Config) (*Client, error
}
}

// Priotize local domains with specific TLDs or without any dot to local DNS
// Prioritize local domains with specific TLDs or without any dot to local DNS
if strings.EqualFold(ns.Address.Address.GetDomain(), "localhost") {
ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...)
ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule)
Expand Down
2 changes: 1 addition & 1 deletion app/dns/nameserver_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (s *TCPNameServer) sendQuery(ctx context.Context, domain string, clientIP n

conn, err := s.dial(dnsCtx)
if err != nil {
newError("failed to dial namesever").Base(err).AtError().WriteToLog()
newError("failed to dial nameserver").Base(err).AtError().WriteToLog()
return
}
defer conn.Close()
Expand Down
2 changes: 1 addition & 1 deletion app/log/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
cmlog "github.com/v2fly/v2ray-core/v5/common/log"
)

// LoggerServer is the implemention of LoggerService
// LoggerServer is the implementation of LoggerService
type LoggerServer struct {
V *core.Instance
}
Expand Down
2 changes: 1 addition & 1 deletion app/observatory/burst/healthping.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (h *HealthPing) PutResult(tag string, rtt time.Duration) {
if !ok {
// validity is 2 times to sampling period, since the check are
// distributed in the time line randomly, in extreme cases,
// previous checks are distributed on the left, and latters
// previous checks are distributed on the left, and later ones
// on the right
validity := h.Settings.Interval * time.Duration(h.Settings.SamplingCount) * 2
r = NewHealthPingResult(h.Settings.SamplingCount, validity)
Expand Down
8 changes: 4 additions & 4 deletions app/proxyman/outbound/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
}
}

return h.getStatCouterConnection(conn), nil
return h.getStatCounterConnection(conn), nil
}

newError("failed to get outbound handler with tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx))
Expand Down Expand Up @@ -264,7 +264,7 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
return nil, newError("unable to listen socket").Base(err)
}
conn := packetaddr.ToPacketAddrConnWrapper(packetConn, isStream)
return h.getStatCouterConnection(conn), nil
return h.getStatCounterConnection(conn), nil
}

proxyEnvironment := envctx.EnvironmentFromContext(h.ctx).(environment.ProxyEnvironment)
Expand All @@ -274,7 +274,7 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
}
ctx = envctx.ContextWithEnvironment(ctx, transportEnvironment)
conn, err := internet.Dial(ctx, dest, h.streamSettings)
return h.getStatCouterConnection(conn), err
return h.getStatCounterConnection(conn), err
}

func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Address) net.Address {
Expand All @@ -293,7 +293,7 @@ func (h *Handler) resolveIP(ctx context.Context, domain string, localAddr net.Ad
return net.IPAddress(ips[dice.Roll(len(ips))])
}

func (h *Handler) getStatCouterConnection(conn internet.Connection) internet.Connection {
func (h *Handler) getStatCounterConnection(conn internet.Connection) internet.Connection {
if h.uplinkCounter != nil || h.downlinkCounter != nil {
return &internet.StatCouterConnection{
Connection: conn,
Expand Down
2 changes: 1 addition & 1 deletion app/router/command/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestServiceSubscribeRoutingStats(t *testing.T) {
}
}

func TestSerivceTestRoute(t *testing.T) {
func TestServiceTestRoute(t *testing.T) {
c := stats.NewChannel(&stats.ChannelConfig{
SubscriberLimit: 1,
BufferSize: 16,
Expand Down
2 changes: 1 addition & 1 deletion app/router/config.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ type StrategyLeastLoadConfig struct {
Baselines []int64 `protobuf:"varint,3,rep,packed,name=baselines,proto3" json:"baselines,omitempty"`
// expected nodes count to select
Expected int32 `protobuf:"varint,4,opt,name=expected,proto3" json:"expected,omitempty"`
// max acceptable rtt, filter away high delay nodes. defalut 0
// max acceptable rtt, filter away high delay nodes. default 0
MaxRTT int64 `protobuf:"varint,5,opt,name=maxRTT,proto3" json:"maxRTT,omitempty"`
// acceptable failure rate
Tolerance float32 `protobuf:"fixed32,6,opt,name=tolerance,proto3" json:"tolerance,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion app/router/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ message StrategyLeastLoadConfig {
repeated int64 baselines = 3;
// expected nodes count to select
int32 expected = 4;
// max acceptable rtt, filter away high delay nodes. defalut 0
// max acceptable rtt, filter away high delay nodes. default 0
int64 maxRTT = 5;
// acceptable failure rate
float tolerance = 6;
Expand Down
2 changes: 1 addition & 1 deletion app/router/strategy_random.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s *RandomStrategy) PickOutbound(candidates []string) string {
aliveTags = append(aliveTags, candidate)
}
} else {
// unfound candidate is considered alive
// a candidate that is not found is considered alive
aliveTags = append(aliveTags, candidate)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/stats/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *Channel) Start() error {
for {
select {
case pub := <-c.channel: // Published message received
for _, sub := range c.Subscribers() { // Concurrency-safe subscribers retrievement
for _, sub := range c.Subscribers() { // Concurrency-safe subscribers retrieval
if c.blocking {
pub.broadcast(sub)
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/stats/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestStatsChannel(t *testing.T) {
}
}

func TestStatsChannelUnsubcribe(t *testing.T) {
func TestStatsChannelUnsubscribe(t *testing.T) {
c := NewChannel(&ChannelConfig{Blocking: true})
common.Must(c.Start())
defer c.Close()
Expand Down
2 changes: 1 addition & 1 deletion app/stats/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestStatsCounter(t *testing.T) {
common.Must(err)

if v := c.Add(1); v != 1 {
t.Fatal("unpexcted Add(1) return: ", v, ", wanted ", 1)
t.Fatal("unexpected Add(1) return: ", v, ", wanted ", 1)
}

if v := c.Set(0); v != 1 {
Expand Down
2 changes: 1 addition & 1 deletion common/buf/buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestBufferResize(t *testing.T) {
}

if s := buffer.String(); s != "Str" {
t.Error("unexpect buffer ", s)
t.Error("unexpected buffer ", s)
}

buffer.Resize(int32(len(payload)), 200)
Expand Down
2 changes: 1 addition & 1 deletion common/buf/multi_buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestSplitFirstBytes(t *testing.T) {
t.Error("unexpected cnt from SplitFirstBytes ", cnt)
}
if d := cmp.Diff(string(o), "ab"); d != "" {
t.Error("unexpected splited result from SplitFirstBytes ", d)
t.Error("unexpected split result from SplitFirstBytes ", d)
}
}

Expand Down
10 changes: 5 additions & 5 deletions common/buf/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ func (r *BufferedReader) ReadByte() (byte, error) {

// Read implements io.Reader. It reads from internal buffer first (if available) and then reads from the underlying reader.
func (r *BufferedReader) Read(b []byte) (int, error) {
spliter := r.Spliter
if spliter == nil {
spliter = SplitBytes
splitter := r.Spliter
if splitter == nil {
splitter = SplitBytes
}

if !r.Buffer.IsEmpty() {
buffer, nBytes := spliter(r.Buffer, b)
buffer, nBytes := splitter(r.Buffer, b)
r.Buffer = buffer
if r.Buffer.IsEmpty() {
r.Buffer = nil
Expand All @@ -78,7 +78,7 @@ func (r *BufferedReader) Read(b []byte) (int, error) {
return 0, err
}

mb, nBytes := spliter(mb, b)
mb, nBytes := splitter(mb, b)
if !mb.IsEmpty() {
r.Buffer = mb
}
Expand Down
4 changes: 2 additions & 2 deletions common/buf/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestReadByte(t *testing.T) {
nBytes, err := reader.WriteTo(DiscardBytes)
common.Must(err)
if nBytes != 3 {
t.Error("unexpect bytes written: ", nBytes)
t.Error("unexpected bytes written: ", nBytes)
}
}

Expand Down Expand Up @@ -105,7 +105,7 @@ func TestReadAtMost(t *testing.T) {
nBytes, err := reader.WriteTo(DiscardBytes)
common.Must(err)
if nBytes != 1 {
t.Error("unexpect bytes written: ", nBytes)
t.Error("unexpected bytes written: ", nBytes)
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/crypto/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (w *AuthenticationWriter) seal(b []byte) (*buf.Buffer, error) {
return nil, err
}
if paddingSize > 0 {
// These paddings will send in clear text.
// These paddings will be sent in clear text.
// To avoid leakage of PRNG internal state, a cryptographically secure PRNG should be used.
paddingBytes := eb.Extend(paddingSize)
common.Must2(rand.Read(paddingBytes))
Expand Down
2 changes: 1 addition & 1 deletion common/crypto/chacha20.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/v2fly/v2ray-core/v5/common/crypto/internal"
)

// NewChaCha20Stream creates a new Chacha20 encryption/descryption stream based on give key and IV.
// NewChaCha20Stream creates a new Chacha20 encryption/decryption stream based on given key and IV.
// Caller must ensure the length of key is 32 bytes, and length of IV is either 8 or 12 bytes.
func NewChaCha20Stream(key []byte, iv []byte) cipher.Stream {
return internal.NewChaCha20Stream(key, iv, 20)
Expand Down
2 changes: 1 addition & 1 deletion common/mux/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

type ClientManager struct {
Enabled bool // wheather mux is enabled from user config
Enabled bool // whether mux is enabled from user config
Picker WorkerPicker
}

Expand Down
30 changes: 15 additions & 15 deletions common/net/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestAddressProperty(t *testing.T) {
type addrProprty struct {
type addrProperty struct {
IP []byte
Domain string
Family AddressFamily
Expand All @@ -19,11 +19,11 @@ func TestAddressProperty(t *testing.T) {

testCases := []struct {
Input Address
Output addrProprty
Output addrProperty
}{
{
Input: IPAddress([]byte{byte(1), byte(2), byte(3), byte(4)}),
Output: addrProprty{
Output: addrProperty{
IP: []byte{byte(1), byte(2), byte(3), byte(4)},
Family: AddressFamilyIPv4,
String: "1.2.3.4",
Expand All @@ -36,7 +36,7 @@ func TestAddressProperty(t *testing.T) {
byte(1), byte(2), byte(3), byte(4),
byte(1), byte(2), byte(3), byte(4),
}),
Output: addrProprty{
Output: addrProperty{
IP: []byte{
byte(1), byte(2), byte(3), byte(4),
byte(1), byte(2), byte(3), byte(4),
Expand All @@ -54,71 +54,71 @@ func TestAddressProperty(t *testing.T) {
byte(0), byte(0), byte(255), byte(255),
byte(1), byte(2), byte(3), byte(4),
}),
Output: addrProprty{
Output: addrProperty{
IP: []byte{byte(1), byte(2), byte(3), byte(4)},
Family: AddressFamilyIPv4,
String: "1.2.3.4",
},
},
{
Input: DomainAddress("v2fly.org"),
Output: addrProprty{
Output: addrProperty{
Domain: "v2fly.org",
Family: AddressFamilyDomain,
String: "v2fly.org",
},
},
{
Input: IPAddress(net.IPv4(1, 2, 3, 4)),
Output: addrProprty{
Output: addrProperty{
IP: []byte{byte(1), byte(2), byte(3), byte(4)},
Family: AddressFamilyIPv4,
String: "1.2.3.4",
},
},
{
Input: ParseAddress("[2001:4860:0:2001::68]"),
Output: addrProprty{
Output: addrProperty{
IP: []byte{0x20, 0x01, 0x48, 0x60, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68},
Family: AddressFamilyIPv6,
String: "[2001:4860:0:2001::68]",
},
},
{
Input: ParseAddress("::0"),
Output: addrProprty{
Output: addrProperty{
IP: AnyIPv6.IP(),
Family: AddressFamilyIPv6,
String: "[::]",
},
},
{
Input: ParseAddress("[::ffff:123.151.71.143]"),
Output: addrProprty{
Output: addrProperty{
IP: []byte{123, 151, 71, 143},
Family: AddressFamilyIPv4,
String: "123.151.71.143",
},
},
{
Input: NewIPOrDomain(ParseAddress("v2fly.org")).AsAddress(),
Output: addrProprty{
Output: addrProperty{
Domain: "v2fly.org",
Family: AddressFamilyDomain,
String: "v2fly.org",
},
},
{
Input: NewIPOrDomain(ParseAddress("8.8.8.8")).AsAddress(),
Output: addrProprty{
Output: addrProperty{
IP: []byte{8, 8, 8, 8},
Family: AddressFamilyIPv4,
String: "8.8.8.8",
},
},
{
Input: NewIPOrDomain(ParseAddress("[2001:4860:0:2001::68]")).AsAddress(),
Output: addrProprty{
Output: addrProperty{
IP: []byte{0x20, 0x01, 0x48, 0x60, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68},
Family: AddressFamilyIPv6,
String: "[2001:4860:0:2001::68]",
Expand All @@ -127,7 +127,7 @@ func TestAddressProperty(t *testing.T) {
}

for _, testCase := range testCases {
actual := addrProprty{
actual := addrProperty{
Family: testCase.Input.Family(),
String: testCase.Input.String(),
}
Expand All @@ -143,7 +143,7 @@ func TestAddressProperty(t *testing.T) {
}
}

func TestInvalidAddressConvertion(t *testing.T) {
func TestInvalidAddressConversion(t *testing.T) {
panics := func(f func()) (ret bool) {
defer func() {
if r := recover(); r != nil {
Expand Down
2 changes: 1 addition & 1 deletion common/platform/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func LineSeparator() string {
return "\r\n"
}

// GetAssetLocation search for `file` in the excutable dir
// GetAssetLocation search for `file` in the executable dir
func GetAssetLocation(file string) string {
const name = "v2ray.location.asset"
assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
Expand Down
Loading
Loading