1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 18:00:43 +00:00
This commit is contained in:
秋のかえで 2021-12-23 13:14:43 +08:00
parent 79f751662c
commit 423d566024
No known key found for this signature in database
GPG Key ID: E343534293081E5D
10 changed files with 18 additions and 18 deletions

View File

@ -203,7 +203,7 @@ func TestStatsChannelBlocking(t *testing.T) {
// Test blocking channel publishing // Test blocking channel publishing
go func() { go func() {
// Dummy messsage with no subscriber receiving, will block broadcasting goroutine // Dummy message with no subscriber receiving, will block broadcasting goroutine
c.Publish(context.Background(), nil) c.Publish(context.Background(), nil)
<-pauseCh <-pauseCh

View File

@ -48,9 +48,9 @@ func TestChaCha20Stream(t *testing.T) {
for _, c := range cases { for _, c := range cases {
s := NewChaCha20Stream(c.key, c.iv) s := NewChaCha20Stream(c.key, c.iv)
input := make([]byte, len(c.output)) input := make([]byte, len(c.output))
actualOutout := make([]byte, len(c.output)) actualOutput := make([]byte, len(c.output))
s.XORKeyStream(actualOutout, input) s.XORKeyStream(actualOutput, input)
if r := cmp.Diff(c.output, actualOutout); r != "" { if r := cmp.Diff(c.output, actualOutput); r != "" {
t.Fatal(r) t.Fatal(r)
} }
} }

View File

@ -18,7 +18,7 @@ import (
//go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen //go:generate go run github.com/v2fly/v2ray-core/v4/common/errors/errorgen
type Certificate struct { type Certificate struct {
// Cerificate in ASN.1 DER format // Certificate in ASN.1 DER format
Certificate []byte Certificate []byte
// Private key in ASN.1 DER format // Private key in ASN.1 DER format
PrivateKey []byte PrivateKey []byte

View File

@ -29,7 +29,7 @@ func TestActivityTimerUpdate(t *testing.T) {
timer.SetTimeout(time.Second * 1) timer.SetTimeout(time.Second * 1)
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
if ctx.Err() == nil { if ctx.Err() == nil {
t.Error("expcted some error, but got nil") t.Error("expected some error, but got nil")
} }
runtime.KeepAlive(timer) runtime.KeepAlive(timer)
} }

View File

@ -35,7 +35,7 @@ type Context interface {
// GetUser returns the user email from the connection content, if exists. // GetUser returns the user email from the connection content, if exists.
GetUser() string GetUser() string
// GetAttributes returns extra attributes from the conneciont content. // GetAttributes returns extra attributes from the connection content.
GetAttributes() map[string]string GetAttributes() map[string]string
// GetSkipDNSResolve returns a flag switch for weather skip dns resolve during route pick. // GetSkipDNSResolve returns a flag switch for weather skip dns resolve during route pick.

View File

@ -47,7 +47,7 @@ func SubscribeRunnableChannel(c Channel) (chan interface{}, error) {
return c.Subscribe() return c.Subscribe()
} }
// UnsubscribeClosableChannel unsubcribes the channel and close it if there is no more subscriber. // UnsubscribeClosableChannel unsubscribes the channel and close it if there is no more subscriber.
func UnsubscribeClosableChannel(c Channel, sub chan interface{}) error { func UnsubscribeClosableChannel(c Channel, sub chan interface{}) error {
if err := c.Unsubscribe(sub); err != nil { if err := c.Unsubscribe(sub); err != nil {
return err return err

View File

@ -24,13 +24,13 @@ func init() {
} }
func makeMergeLoader(formatName string) (*core.ConfigFormat, error) { func makeMergeLoader(formatName string) (*core.ConfigFormat, error) {
extenstoins, err := mergers.GetExtensions(formatName) extensions, err := mergers.GetExtensions(formatName)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &core.ConfigFormat{ return &core.ConfigFormat{
Name: []string{formatName}, Name: []string{formatName},
Extension: extenstoins, Extension: extensions,
Loader: makeLoaderFunc(formatName), Loader: makeLoaderFunc(formatName),
}, nil }, nil
} }

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.27.1 // protoc-gen-go v1.27.1
// protoc v3.17.3 // protoc v3.19.1
// source: transport/internet/domainsocket/config.proto // source: transport/internet/domainsocket/config.proto
package domainsocket package domainsocket
@ -28,7 +28,7 @@ type Config struct {
// Path of the domain socket. This overrides the IP/Port parameter from // Path of the domain socket. This overrides the IP/Port parameter from
// upstream caller. // upstream caller.
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` 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 // Traditionally Unix domain socket is file system based. Abstract domain
// socket can be used without acquiring file lock. // socket can be used without acquiring file lock.
Abstract bool `protobuf:"varint,2,opt,name=abstract,proto3" json:"abstract,omitempty"` Abstract bool `protobuf:"varint,2,opt,name=abstract,proto3" json:"abstract,omitempty"`

View File

@ -10,7 +10,7 @@ message Config {
// Path of the domain socket. This overrides the IP/Port parameter from // Path of the domain socket. This overrides the IP/Port parameter from
// upstream caller. // upstream caller.
string path = 1; 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 // Traditionally Unix domain socket is file system based. Abstract domain
// socket can be used without acquiring file lock. // socket can be used without acquiring file lock.
bool abstract = 2; bool abstract = 2;

View File

@ -18,7 +18,7 @@ import (
) )
func TestDialAndListen(t *testing.T) { func TestDialAndListen(t *testing.T) {
listerner, err := NewListener(context.Background(), net.LocalHostIP, net.Port(0), &internet.MemoryStreamConfig{ listener, err := NewListener(context.Background(), net.LocalHostIP, net.Port(0), &internet.MemoryStreamConfig{
ProtocolName: "mkcp", ProtocolName: "mkcp",
ProtocolSettings: &Config{}, ProtocolSettings: &Config{},
}, func(conn internet.Connection) { }, func(conn internet.Connection) {
@ -38,9 +38,9 @@ func TestDialAndListen(t *testing.T) {
}(conn) }(conn)
}) })
common.Must(err) common.Must(err)
defer listerner.Close() defer listener.Close()
port := net.Port(listerner.Addr().(*net.UDPAddr).Port) port := net.Port(listener.Addr().(*net.UDPAddr).Port)
var errg errgroup.Group var errg errgroup.Group
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
@ -76,10 +76,10 @@ func TestDialAndListen(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
for i := 0; i < 60 && listerner.ActiveConnections() > 0; i++ { for i := 0; i < 60 && listener.ActiveConnections() > 0; i++ {
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
} }
if v := listerner.ActiveConnections(); v != 0 { if v := listener.ActiveConnections(); v != 0 {
t.Error("active connections: ", v) t.Error("active connections: ", v)
} }
} }