sockopt_linux_test.go 532 B

12345678910111213141516171819202122232425262728
  1. // +build linux
  2. package tcp_test
  3. import (
  4. "context"
  5. "testing"
  6. "v2ray.com/core/testing/assert"
  7. "v2ray.com/core/testing/servers/tcp"
  8. )
  9. func TestGetOriginalDestination(t *testing.T) {
  10. assert := assert.On(t)
  11. tcpServer := tcp.Server{
  12. MsgProcessor: xor,
  13. }
  14. dest, err := tcpServer.Start()
  15. assert.Error(err).IsNil()
  16. defer tcpServer.Close()
  17. conn, err := Dial(context.Background(), dest)
  18. assert.Error(err).IsNil()
  19. _, err := GetOriginalDestination(conn)
  20. assert.String(err.Error()).Contains("failed to call getsockopt")
  21. }