From 16de0937a82b936e267c8c7437ba192c2b31f2f3 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 12 Jul 2024 00:20:06 +0200 Subject: [PATCH] Fix typos (#3527) --- .github/workflows/release.yml | 2 +- Makefile | 4 +-- app/dns/nameserver.go | 2 +- app/dns/nameserver_doh.go | 2 +- app/log/log.go | 4 +-- app/observatory/burst/healthping.go | 2 +- app/router/command/command_test.go | 2 +- app/stats/channel_test.go | 2 +- app/stats/counter_test.go | 2 +- common/buf/multi_buffer_test.go | 4 +-- common/buf/reader.go | 6 ++-- common/net/cnc/connection.go | 4 +-- common/platform/windows.go | 2 +- common/protocol/tls/cert/cert.go | 2 +- common/protocol/tls/sniff_test.go | 2 +- common/protocol/user.pb.go | 2 +- common/protocol/user.proto | 2 +- common/session/context.go | 30 ++++++++++---------- common/signal/timer_test.go | 2 +- core/config.go | 2 +- main/commands/base/env.go | 2 +- main/json/json.go | 2 +- main/toml/toml.go | 2 +- main/yaml/yaml.go | 2 +- proxy/proxy.go | 4 +-- proxy/socks/config.pb.go | 2 +- proxy/socks/config.proto | 2 +- proxy/socks/protocol_test.go | 2 +- proxy/socks/udpfilter.go | 2 +- proxy/trojan/client.go | 2 +- proxy/vless/inbound/inbound.go | 16 +++++------ proxy/vless/outbound/outbound.go | 6 ++-- transport/internet/domainsocket/config.pb.go | 2 +- transport/internet/domainsocket/config.proto | 2 +- transport/internet/headers/http/config.pb.go | 2 +- transport/internet/headers/http/config.proto | 2 +- transport/internet/httpupgrade/connection.go | 8 +++--- transport/internet/memory_settings.go | 2 +- transport/internet/tcp_hub.go | 2 +- 39 files changed, 72 insertions(+), 72 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a9a30c5..a2b9da73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,7 +83,7 @@ jobs: - goarch: 386 goos: darwin include: - # BEIGIN MacOS ARM64 + # BEGIN MacOS ARM64 - goos: darwin goarch: arm64 # END MacOS ARM64 diff --git a/Makefile b/Makefile index e6c13953..7653e306 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,13 @@ NAME = xray VERSION=$(shell git describe --always --dirty) # NOTE: This MAKEFILE can be used to build Xray-core locally and in Automatic workflows. It is \ - provided for convinience in automatic building and functions as a part of it. + provided for convenience in automatic building and functions as a part of it. # NOTE: If you need to modify this file, please be aware that:\ - This file is not the main Makefile; it only accepts environment variables and builds the \ binary.\ - Automatic building expects the correct binaries to be built by this Makefile. If you \ intend to propose a change to this Makefile, carefully review the file below and ensure \ - that the change will not accidently break the automatic building:\ + that the change will not accidentally break the automatic building:\ .github/workflows/release.yml \ Otherwise it is recommended to contact the project maintainers. diff --git a/app/dns/nameserver.go b/app/dns/nameserver.go index 52ab7a91..c7ff8a84 100644 --- a/app/dns/nameserver.go +++ b/app/dns/nameserver.go @@ -85,7 +85,7 @@ func NewClient( return errors.New("failed to create nameserver").Base(err).AtWarning() } - // Priotize local domains with specific TLDs or without any dot to local DNS + // Prioritize local domains with specific TLDs or those without any dot for the local DNS if _, isLocalDNS := server.(*LocalNameServer); isLocalDNS { ns.PrioritizedDomain = append(ns.PrioritizedDomain, localTLDsAndDotlessDomains...) ns.OriginalRules = append(ns.OriginalRules, localTLDsAndDotlessDomainsRule) diff --git a/app/dns/nameserver_doh.go b/app/dns/nameserver_doh.go index 01e7ede1..d34709e9 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -259,7 +259,7 @@ func (s *DoHNameServer) sendQuery(ctx context.Context, domain string, clientIP n }) // forced to use mux for DOH - // dnsCtx = session.ContextWithMuxPrefered(dnsCtx, true) + // dnsCtx = session.ContextWithMuxPreferred(dnsCtx, true) var cancel context.CancelFunc dnsCtx, cancel = context.WithDeadline(dnsCtx, deadline) diff --git a/app/log/log.go b/app/log/log.go index 88bac44f..098fe631 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -30,8 +30,8 @@ func New(ctx context.Context, config *Config) (*Instance, error) { } log.RegisterHandler(g) - // start logger instantly on inited - // other modules would log during init + // Start logger instantly on initialization + // Other modules would log during initialization if err := g.startInternal(); err != nil { return nil, err } diff --git a/app/observatory/burst/healthping.go b/app/observatory/burst/healthping.go index 34690f58..41d5e754 100644 --- a/app/observatory/burst/healthping.go +++ b/app/observatory/burst/healthping.go @@ -209,7 +209,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) diff --git a/app/router/command/command_test.go b/app/router/command/command_test.go index 096e90ee..e8329695 100644 --- a/app/router/command/command_test.go +++ b/app/router/command/command_test.go @@ -272,7 +272,7 @@ func TestServiceSubscribeSubsetOfFields(t *testing.T) { } } -func TestSerivceTestRoute(t *testing.T) { +func TestServiceTestRoute(t *testing.T) { c := stats.NewChannel(&stats.ChannelConfig{ SubscriberLimit: 1, BufferSize: 16, diff --git a/app/stats/channel_test.go b/app/stats/channel_test.go index 75764f0b..ccae8269 100644 --- a/app/stats/channel_test.go +++ b/app/stats/channel_test.go @@ -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() diff --git a/app/stats/counter_test.go b/app/stats/counter_test.go index 81106468..d7086540 100644 --- a/app/stats/counter_test.go +++ b/app/stats/counter_test.go @@ -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 { diff --git a/common/buf/multi_buffer_test.go b/common/buf/multi_buffer_test.go index 4f9499af..2b83a548 100644 --- a/common/buf/multi_buffer_test.go +++ b/common/buf/multi_buffer_test.go @@ -106,7 +106,7 @@ func TestMultiBufferReadAllToByte(t *testing.T) { common.Must(err) if l := len(b); l != 8*1024 { - t.Error("unexpceted length from ReadAllToBytes", l) + t.Error("unexpected length from ReadAllToBytes", l) } } { @@ -139,7 +139,7 @@ func TestMultiBufferCopy(t *testing.T) { mb.Copy(lbdst) if d := cmp.Diff(lb, lbdst); d != "" { - t.Error("unexpceted different from MultiBufferCopy ", d) + t.Error("unexpected different from MultiBufferCopy ", d) } } diff --git a/common/buf/reader.go b/common/buf/reader.go index c6c50274..33d362d4 100644 --- a/common/buf/reader.go +++ b/common/buf/reader.go @@ -41,8 +41,8 @@ type BufferedReader struct { Reader Reader // Buffer is the internal buffer to be read from first Buffer MultiBuffer - // Spliter is a function to read bytes from MultiBuffer - Spliter func(MultiBuffer, []byte) (MultiBuffer, int) + // Splitter is a function to read bytes from MultiBuffer + Splitter func(MultiBuffer, []byte) (MultiBuffer, int) } // BufferedBytes returns the number of bytes that is cached in this reader. @@ -59,7 +59,7 @@ 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 + spliter := r.Splitter if spliter == nil { spliter = SplitBytes } diff --git a/common/net/cnc/connection.go b/common/net/cnc/connection.go index 42b632e7..bdae5409 100644 --- a/common/net/cnc/connection.go +++ b/common/net/cnc/connection.go @@ -51,8 +51,8 @@ func ConnectionOutputMulti(reader buf.Reader) ConnectionOption { func ConnectionOutputMultiUDP(reader buf.Reader) ConnectionOption { return func(c *connection) { c.reader = &buf.BufferedReader{ - Reader: reader, - Spliter: buf.SplitFirstBytes, + Reader: reader, + Splitter: buf.SplitFirstBytes, } } } diff --git a/common/platform/windows.go b/common/platform/windows.go index 2aeca80c..872e8461 100644 --- a/common/platform/windows.go +++ b/common/platform/windows.go @@ -19,7 +19,7 @@ func GetToolLocation(file string) string { return filepath.Join(toolPath, file+".exe") } -// GetAssetLocation searches for `file` in the excutable dir +// GetAssetLocation searches for `file` in the executable dir func GetAssetLocation(file string) string { assetPath := NewEnvFlag(AssetLocation).GetValue(getExecutableDir) return filepath.Join(assetPath, file) diff --git a/common/protocol/tls/cert/cert.go b/common/protocol/tls/cert/cert.go index 5bd92a5c..f7629327 100644 --- a/common/protocol/tls/cert/cert.go +++ b/common/protocol/tls/cert/cert.go @@ -19,7 +19,7 @@ import ( //go:generate go run github.com/xtls/xray-core/common/errors/errorgen type Certificate struct { - // Cerificate in ASN.1 DER format + // certificate in ASN.1 DER format Certificate []byte // Private key in ASN.1 DER format PrivateKey []byte diff --git a/common/protocol/tls/sniff_test.go b/common/protocol/tls/sniff_test.go index d334089c..59f3a35f 100644 --- a/common/protocol/tls/sniff_test.go +++ b/common/protocol/tls/sniff_test.go @@ -147,7 +147,7 @@ func TestTLSHeaders(t *testing.T) { header, err := SniffTLS(test.input) if test.err { if err == nil { - t.Errorf("Exepct error but nil in test %v", test) + t.Errorf("Expect error but nil in test %v", test) } } else { if err != nil { diff --git a/common/protocol/user.pb.go b/common/protocol/user.pb.go index 0230b37c..dfa89b33 100644 --- a/common/protocol/user.pb.go +++ b/common/protocol/user.pb.go @@ -21,7 +21,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// User is a generic user for all procotols. +// User is a generic user for all protocols. type User struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/common/protocol/user.proto b/common/protocol/user.proto index 44770edf..14cf995b 100644 --- a/common/protocol/user.proto +++ b/common/protocol/user.proto @@ -8,7 +8,7 @@ option java_multiple_files = true; import "common/serial/typed_message.proto"; -// User is a generic user for all procotols. +// User is a generic user for all protocols. message User { uint32 level = 1; string email = 2; diff --git a/common/session/context.go b/common/session/context.go index da3ad4a8..3fed0151 100644 --- a/common/session/context.go +++ b/common/session/context.go @@ -13,16 +13,16 @@ import ( func IndependentCancelCtx(parent context.Context) context.Context const ( - inboundSessionKey ctx.SessionKey = 1 - outboundSessionKey ctx.SessionKey = 2 - contentSessionKey ctx.SessionKey = 3 - muxPreferedSessionKey ctx.SessionKey = 4 - sockoptSessionKey ctx.SessionKey = 5 + inboundSessionKey ctx.SessionKey = 1 + outboundSessionKey ctx.SessionKey = 2 + contentSessionKey ctx.SessionKey = 3 + muxPreferredSessionKey ctx.SessionKey = 4 + sockoptSessionKey ctx.SessionKey = 5 trackedConnectionErrorKey ctx.SessionKey = 6 - dispatcherKey ctx.SessionKey = 7 - timeoutOnlyKey ctx.SessionKey = 8 - allowedNetworkKey ctx.SessionKey = 9 - handlerSessionKey ctx.SessionKey = 10 + dispatcherKey ctx.SessionKey = 7 + timeoutOnlyKey ctx.SessionKey = 8 + allowedNetworkKey ctx.SessionKey = 9 + handlerSessionKey ctx.SessionKey = 10 ) func ContextWithInbound(ctx context.Context, inbound *Inbound) context.Context { @@ -58,14 +58,14 @@ func ContentFromContext(ctx context.Context) *Content { return nil } -// ContextWithMuxPrefered returns a new context with the given bool -func ContextWithMuxPrefered(ctx context.Context, forced bool) context.Context { - return context.WithValue(ctx, muxPreferedSessionKey, forced) +// ContextWithMuxPreferred returns a new context with the given bool +func ContextWithMuxPreferred(ctx context.Context, forced bool) context.Context { + return context.WithValue(ctx, muxPreferredSessionKey, forced) } -// MuxPreferedFromContext returns value in this context, or false if not contained. -func MuxPreferedFromContext(ctx context.Context) bool { - if val, ok := ctx.Value(muxPreferedSessionKey).(bool); ok { +// MuxPreferredFromContext returns value in this context, or false if not contained. +func MuxPreferredFromContext(ctx context.Context) bool { + if val, ok := ctx.Value(muxPreferredSessionKey).(bool); ok { return val } return false diff --git a/common/signal/timer_test.go b/common/signal/timer_test.go index d56eed2b..263bec9e 100644 --- a/common/signal/timer_test.go +++ b/common/signal/timer_test.go @@ -29,7 +29,7 @@ func TestActivityTimerUpdate(t *testing.T) { timer.SetTimeout(time.Second * 1) time.Sleep(time.Second * 2) if ctx.Err() == nil { - t.Error("expcted some error, but got nil") + t.Error("expected some error, but got nil") } runtime.KeepAlive(timer) } diff --git a/core/config.go b/core/config.go index 32fea49e..aa9b63c9 100644 --- a/core/config.go +++ b/core/config.go @@ -174,7 +174,7 @@ func init() { common.Must(err) return loadProtobufConfig(data) default: - return nil, errors.New("unknow type") + return nil, errors.New("unknown type") } }, })) diff --git a/main/commands/base/env.go b/main/commands/base/env.go index 476ed133..75d141e9 100644 --- a/main/commands/base/env.go +++ b/main/commands/base/env.go @@ -7,7 +7,7 @@ import ( // CommandEnvHolder is a struct holds the environment info of commands type CommandEnvHolder struct { - // Excutable name of current binary + // Executable name of current binary Exec string // commands column width of current command CommandsWidth int diff --git a/main/json/json.go b/main/json/json.go index f14b0eec..aad2dc6b 100644 --- a/main/json/json.go +++ b/main/json/json.go @@ -43,7 +43,7 @@ func init() { case io.Reader: return serial.LoadJSONConfig(v) default: - return nil, errors.New("unknow type") + return nil, errors.New("unknown type") } }, })) diff --git a/main/toml/toml.go b/main/toml/toml.go index 22e1c3dc..b17526ec 100644 --- a/main/toml/toml.go +++ b/main/toml/toml.go @@ -43,7 +43,7 @@ func init() { case io.Reader: return serial.LoadTOMLConfig(v) default: - return nil, errors.New("unknow type") + return nil, errors.New("unknown type") } }, })) diff --git a/main/yaml/yaml.go b/main/yaml/yaml.go index 59bab8fa..a2ead8a7 100644 --- a/main/yaml/yaml.go +++ b/main/yaml/yaml.go @@ -43,7 +43,7 @@ func init() { case io.Reader: return serial.LoadYAMLConfig(v) default: - return nil, errors.New("unknow type") + return nil, errors.New("unknown type") } }, })) diff --git a/proxy/proxy.go b/proxy/proxy.go index 87abd1a2..926bf164 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -243,7 +243,7 @@ func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error { return w.Writer.WriteMultiBuffer(mb) } -// ReshapeMultiBuffer prepare multi buffer for padding stucture (max 21 bytes) +// ReshapeMultiBuffer prepare multi buffer for padding structure (max 21 bytes) func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBuffer { needReshape := 0 for _, b := range buffer { @@ -278,7 +278,7 @@ func ReshapeMultiBuffer(ctx context.Context, buffer buf.MultiBuffer) buf.MultiBu return mb2 } -// XtlsPadding add padding to eliminate length siganature during tls handshake +// XtlsPadding add padding to eliminate length signature during tls handshake func XtlsPadding(b *buf.Buffer, command byte, userUUID *[]byte, longPadding bool, ctx context.Context) *buf.Buffer { var contentLen int32 = 0 var paddingLen int32 = 0 diff --git a/proxy/socks/config.pb.go b/proxy/socks/config.pb.go index 6471babf..d13ebd10 100644 --- a/proxy/socks/config.pb.go +++ b/proxy/socks/config.pb.go @@ -26,7 +26,7 @@ const ( type AuthType int32 const ( - // NO_AUTH is for anounymous authentication. + // NO_AUTH is for anonymous authentication. AuthType_NO_AUTH AuthType = 0 // PASSWORD is for username/password authentication. AuthType_PASSWORD AuthType = 1 diff --git a/proxy/socks/config.proto b/proxy/socks/config.proto index 7e7dc09f..85dded0d 100644 --- a/proxy/socks/config.proto +++ b/proxy/socks/config.proto @@ -17,7 +17,7 @@ message Account { // AuthType is the authentication type of Socks proxy. enum AuthType { - // NO_AUTH is for anounymous authentication. + // NO_AUTH is for anonymous authentication. NO_AUTH = 0; // PASSWORD is for username/password authentication. PASSWORD = 1; diff --git a/proxy/socks/protocol_test.go b/proxy/socks/protocol_test.go index 99e07389..b8c84f68 100644 --- a/proxy/socks/protocol_test.go +++ b/proxy/socks/protocol_test.go @@ -68,7 +68,7 @@ func TestReadUsernamePassword(t *testing.T) { t.Error("for input: ", testCase.Input, " expect username ", testCase.Username, " but actually ", username) } if testCase.Password != password { - t.Error("for input: ", testCase.Input, " expect passowrd ", testCase.Password, " but actually ", password) + t.Error("for input: ", testCase.Input, " expect password ", testCase.Password, " but actually ", password) } } } diff --git a/proxy/socks/udpfilter.go b/proxy/socks/udpfilter.go index 25f8a416..9ae3e697 100644 --- a/proxy/socks/udpfilter.go +++ b/proxy/socks/udpfilter.go @@ -9,7 +9,7 @@ import ( In the sock implementation of * ray, UDP authentication is flawed and can be bypassed. Tracking a UDP connection may be a bit troublesome. Here is a simple solution. -We creat a filter, add remote IP to the pool when it try to establish a UDP connection with auth. +We create a filter, add remote IP to the pool when it try to establish a UDP connection with auth. And drop UDP packets from unauthorized IP. After discussion, we believe it is not necessary to add a timeout mechanism to this filter. */ diff --git a/proxy/trojan/client.go b/proxy/trojan/client.go index 21b7d73e..a667d352 100644 --- a/proxy/trojan/client.go +++ b/proxy/trojan/client.go @@ -124,7 +124,7 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter return errors.New("failed to write A request payload").Base(err).AtWarning() } - // Flush; bufferWriter.WriteMultiBufer now is bufferWriter.writer.WriteMultiBuffer + // Flush; bufferWriter.WriteMultiBuffer now is bufferWriter.writer.WriteMultiBuffer if err = bufferWriter.SetBuffered(false); err != nil { return errors.New("failed to flush payload").Base(err).AtWarning() } diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index 891f725d..3bb2c09c 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -223,14 +223,14 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s cs := tlsConn.ConnectionState() name = cs.ServerName alpn = cs.NegotiatedProtocol - errors.LogInfo(ctx, "realName = " + name) - errors.LogInfo(ctx, "realAlpn = " + alpn) + errors.LogInfo(ctx, "realName = "+name) + errors.LogInfo(ctx, "realAlpn = "+alpn) } else if realityConn, ok := iConn.(*reality.Conn); ok { cs := realityConn.ConnectionState() name = cs.ServerName alpn = cs.NegotiatedProtocol - errors.LogInfo(ctx, "realName = " + name) - errors.LogInfo(ctx, "realAlpn = " + alpn) + errors.LogInfo(ctx, "realName = "+name) + errors.LogInfo(ctx, "realAlpn = "+alpn) } name = strings.ToLower(name) alpn = strings.ToLower(alpn) @@ -295,7 +295,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s } if k == '?' || k == ' ' { path = string(firstBytes[i:j]) - errors.LogInfo(ctx, "realPath = " + path) + errors.LogInfo(ctx, "realPath = "+path) if pfb[path] == nil { path = "" } @@ -524,7 +524,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s clientReader = proxy.NewVisionReader(clientReader, trafficState, ctx1) err = encoding.XtlsRead(clientReader, serverWriter, timer, connection, input, rawInput, trafficState, nil, ctx1) } else { - // from clientReader.ReadMultiBuffer to serverWriter.WriteMultiBufer + // from clientReader.ReadMultiBuffer to serverWriter.WriteMultiBuffer err = buf.Copy(clientReader, serverWriter, buf.UpdateActivity(timer)) } @@ -552,7 +552,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s if err := clientWriter.WriteMultiBuffer(multiBuffer); err != nil { return err // ... } - // Flush; bufferWriter.WriteMultiBufer now is bufferWriter.writer.WriteMultiBuffer + // Flush; bufferWriter.WriteMultiBuffer now is bufferWriter.writer.WriteMultiBuffer if err := bufferWriter.SetBuffered(false); err != nil { return errors.New("failed to write A response payload").Base(err).AtWarning() } @@ -561,7 +561,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection s if requestAddons.Flow == vless.XRV { err = encoding.XtlsWrite(serverReader, clientWriter, timer, connection, trafficState, nil, ctx) } else { - // from serverReader.ReadMultiBuffer to clientWriter.WriteMultiBufer + // from serverReader.ReadMultiBuffer to clientWriter.WriteMultiBuffer err = buf.Copy(serverReader, clientWriter, buf.UpdateActivity(timer)) } if err != nil { diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index 0c9e4721..027a241f 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -219,7 +219,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte } else { errors.LogDebug(ctx, "Reader is not timeout reader, will send out vless header separately from first payload") } - // Flush; bufferWriter.WriteMultiBufer now is bufferWriter.writer.WriteMultiBuffer + // Flush; bufferWriter.WriteMultiBuffer now is bufferWriter.writer.WriteMultiBuffer if err := bufferWriter.SetBuffered(false); err != nil { return errors.New("failed to write A request payload").Base(err).AtWarning() } @@ -238,7 +238,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte ctx1 := session.ContextWithInbound(ctx, nil) // TODO enable splice err = encoding.XtlsWrite(clientReader, serverWriter, timer, conn, trafficState, ob, ctx1) } else { - // from clientReader.ReadMultiBuffer to serverWriter.WriteMultiBufer + // from clientReader.ReadMultiBuffer to serverWriter.WriteMultiBuffer err = buf.Copy(clientReader, serverWriter, buf.UpdateActivity(timer)) } if err != nil { @@ -276,7 +276,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte if requestAddons.Flow == vless.XRV { err = encoding.XtlsRead(serverReader, clientWriter, timer, conn, input, rawInput, trafficState, ob, ctx) } else { - // from serverReader.ReadMultiBuffer to clientWriter.WriteMultiBufer + // from serverReader.ReadMultiBuffer to clientWriter.WriteMultiBuffer err = buf.Copy(serverReader, clientWriter, buf.UpdateActivity(timer)) } diff --git a/transport/internet/domainsocket/config.pb.go b/transport/internet/domainsocket/config.pb.go index 3ab1adc6..cc33be07 100644 --- a/transport/internet/domainsocket/config.pb.go +++ b/transport/internet/domainsocket/config.pb.go @@ -28,7 +28,7 @@ type Config struct { // Path of the domain socket. This overrides the IP/Port parameter from // upstream caller. Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - // Abstract speicifies whether to use abstract namespace or not. + // Abstract specifies whether to use abstract namespace or not. // Traditionally Unix domain socket is file system based. Abstract domain // socket can be used without acquiring file lock. Abstract bool `protobuf:"varint,2,opt,name=abstract,proto3" json:"abstract,omitempty"` diff --git a/transport/internet/domainsocket/config.proto b/transport/internet/domainsocket/config.proto index 900dbbe3..dafb9bc6 100644 --- a/transport/internet/domainsocket/config.proto +++ b/transport/internet/domainsocket/config.proto @@ -10,7 +10,7 @@ message Config { // Path of the domain socket. This overrides the IP/Port parameter from // upstream caller. string path = 1; - // Abstract speicifies whether to use abstract namespace or not. + // Abstract specifies whether to use abstract namespace or not. // Traditionally Unix domain socket is file system based. Abstract domain // socket can be used without acquiring file lock. bool abstract = 2; diff --git a/transport/internet/headers/http/config.pb.go b/transport/internet/headers/http/config.pb.go index 681323f1..73fa04c2 100644 --- a/transport/internet/headers/http/config.pb.go +++ b/transport/internet/headers/http/config.pb.go @@ -374,7 +374,7 @@ type Config struct { unknownFields protoimpl.UnknownFields // Settings for authenticating requests. If not set, client side will not send - // authenication header, and server side will bypass authentication. + // authentication header, and server side will bypass authentication. Request *RequestConfig `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` // Settings for authenticating responses. If not set, client side will bypass // authentication, and server side will not send authentication header. diff --git a/transport/internet/headers/http/config.proto b/transport/internet/headers/http/config.proto index c7659371..fd5799c4 100644 --- a/transport/internet/headers/http/config.proto +++ b/transport/internet/headers/http/config.proto @@ -56,7 +56,7 @@ message ResponseConfig { message Config { // Settings for authenticating requests. If not set, client side will not send - // authenication header, and server side will bypass authentication. + // authentication header, and server side will bypass authentication. RequestConfig request = 1; // Settings for authenticating responses. If not set, client side will bypass diff --git a/transport/internet/httpupgrade/connection.go b/transport/internet/httpupgrade/connection.go index c7a33af9..1bc4d755 100644 --- a/transport/internet/httpupgrade/connection.go +++ b/transport/internet/httpupgrade/connection.go @@ -2,18 +2,18 @@ package httpupgrade import "net" -type connnection struct { +type connection struct { net.Conn remoteAddr net.Addr } -func newConnection(conn net.Conn, remoteAddr net.Addr) *connnection { - return &connnection{ +func newConnection(conn net.Conn, remoteAddr net.Addr) *connection { + return &connection{ Conn: conn, remoteAddr: remoteAddr, } } -func (c *connnection) RemoteAddr() net.Addr { +func (c *connection) RemoteAddr() net.Addr { return c.remoteAddr } diff --git a/transport/internet/memory_settings.go b/transport/internet/memory_settings.go index 3c4770d2..e1625f37 100644 --- a/transport/internet/memory_settings.go +++ b/transport/internet/memory_settings.go @@ -1,6 +1,6 @@ package internet -// MemoryStreamConfig is a parsed form of StreamConfig. This is used to reduce number of Protobuf parsing. +// MemoryStreamConfig is a parsed form of StreamConfig. This is used to reduce the number of Protobuf parsings. type MemoryStreamConfig struct { ProtocolName string ProtocolSettings interface{} diff --git a/transport/internet/tcp_hub.go b/transport/internet/tcp_hub.go index 0cdd50d1..cf0ad80d 100644 --- a/transport/internet/tcp_hub.go +++ b/transport/internet/tcp_hub.go @@ -40,7 +40,7 @@ func ListenUnix(ctx context.Context, address net.Address, settings *MemoryStream protocol := settings.ProtocolName listenFunc := transportListenerCache[protocol] if listenFunc == nil { - return nil, errors.New(protocol, " unix istener not registered.").AtError() + return nil, errors.New(protocol, " unix listener not registered.").AtError() } listener, err := listenFunc(ctx, address, net.Port(0), settings, handler) if err != nil {