mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-10-11 05:30:57 -04:00
31 lines
668 B
Go
31 lines
668 B
Go
// +build linux
|
|
|
|
package tcp_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"v2ray.com/core/testing/assert"
|
|
"v2ray.com/core/testing/servers/tcp"
|
|
"v2ray.com/core/transport/internet"
|
|
. "v2ray.com/core/transport/internet/tcp"
|
|
)
|
|
|
|
func TestGetOriginalDestination(t *testing.T) {
|
|
assert := assert.On(t)
|
|
|
|
tcpServer := tcp.Server{}
|
|
dest, err := tcpServer.Start()
|
|
assert.Error(err).IsNil()
|
|
defer tcpServer.Close()
|
|
|
|
ctx := internet.ContextWithTransportSettings(context.Background, &Config{})
|
|
conn, err := Dial(ctx, dest)
|
|
assert.Error(err).IsNil()
|
|
defer conn.Close()
|
|
|
|
_, err = GetOriginalDestination(conn)
|
|
assert.String(err.Error()).Contains("failed to call getsockopt")
|
|
}
|