github.com/metacubex/tfo-go@v0.0.0-20240228025757-be1269474a66/tfo_unsupported_test.go (about) 1 //go:build !darwin && !freebsd && !linux && !windows 2 3 package tfo 4 5 import ( 6 "context" 7 "testing" 8 ) 9 10 func TestListenTFO(t *testing.T) { 11 ln, err := Listen("tcp", "") 12 if ln != nil { 13 t.Error("Expected nil listener") 14 } 15 if err != ErrPlatformUnsupported { 16 t.Errorf("Expected ErrPlatformUnsupported, got %v", err) 17 } 18 19 lntcp, err := ListenTCP("tcp", nil) 20 if lntcp != nil { 21 t.Error("Expected nil listener") 22 } 23 if err != ErrPlatformUnsupported { 24 t.Errorf("Expected ErrPlatformUnsupported, got %v", err) 25 } 26 } 27 28 func TestDialTFO(t *testing.T) { 29 s, err := newDiscardTCPServer(context.Background()) 30 if err != nil { 31 t.Fatal(err) 32 } 33 defer s.Close() 34 35 addr := s.Addr() 36 37 c, err := Dial("tcp", addr.String(), hello) 38 if c != nil { 39 t.Error("Expected nil connection") 40 } 41 if err != ErrPlatformUnsupported { 42 t.Errorf("Expected ErrPlatformUnsupported, got %v", err) 43 } 44 45 tc, err := DialTCP("tcp", nil, addr, hello) 46 if tc != nil { 47 t.Error("Expected nil connection") 48 } 49 if err != ErrPlatformUnsupported { 50 t.Errorf("Expected ErrPlatformUnsupported, got %v", err) 51 } 52 }