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/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- goarch: 386
goos: darwin
include:
# BEIGIN MacOS ARM64
# BEGIN MacOS ARM64
- goos: darwin
goarch: arm64
# END MacOS ARM64
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion app/dns/nameserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/dns/nameserver_doh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
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 @@ -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)
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 @@ -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,
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
4 changes: 2 additions & 2 deletions common/buf/multi_buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
{
Expand Down Expand Up @@ -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)
}
}

Expand Down
6 changes: 3 additions & 3 deletions common/buf/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions common/net/cnc/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/platform/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion common/protocol/tls/cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/protocol/tls/sniff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion common/protocol/user.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/protocol/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 15 additions & 15 deletions common/session/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/signal/timer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
},
}))
Expand Down
2 changes: 1 addition & 1 deletion main/commands/base/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
},
}))
Expand Down
2 changes: 1 addition & 1 deletion main/toml/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
},
}))
Expand Down
2 changes: 1 addition & 1 deletion main/yaml/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
},
}))
Expand Down
4 changes: 2 additions & 2 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion proxy/socks/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proxy/socks/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion proxy/socks/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion proxy/socks/udpfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion proxy/trojan/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
Loading