mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
27
transport/internet/dialer_test.go
Normal file
27
transport/internet/dialer_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package internet_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"github.com/xtls/xray-core/v1/common"
|
||||
"github.com/xtls/xray-core/v1/common/net"
|
||||
"github.com/xtls/xray-core/v1/testing/servers/tcp"
|
||||
. "github.com/xtls/xray-core/v1/transport/internet"
|
||||
)
|
||||
|
||||
func TestDialWithLocalAddr(t *testing.T) {
|
||||
server := &tcp.Server{}
|
||||
dest, err := server.Start()
|
||||
common.Must(err)
|
||||
defer server.Close()
|
||||
|
||||
conn, err := DialSystem(context.Background(), net.TCPDestination(net.LocalHostIP, dest.Port), nil)
|
||||
common.Must(err)
|
||||
if r := cmp.Diff(conn.RemoteAddr().String(), "127.0.0.1:"+dest.Port.String()); r != "" {
|
||||
t.Error(r)
|
||||
}
|
||||
conn.Close()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue