This commit is contained in:
MHSanaei 2024-07-12 00:20:06 +02:00 committed by GitHub
parent c69d38ae82
commit 16de0937a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 72 additions and 72 deletions

View file

@ -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)
}
}

View file

@ -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
}

View file

@ -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,
}
}
}

View file

@ -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)

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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)
}