github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/transport/internet/header_test.go (about) 1 package internet_test 2 3 import ( 4 "testing" 5 6 "v2ray.com/core/common" 7 . "v2ray.com/core/transport/internet" 8 "v2ray.com/core/transport/internet/headers/noop" 9 "v2ray.com/core/transport/internet/headers/srtp" 10 "v2ray.com/core/transport/internet/headers/utp" 11 "v2ray.com/core/transport/internet/headers/wechat" 12 "v2ray.com/core/transport/internet/headers/wireguard" 13 ) 14 15 func TestAllHeadersLoadable(t *testing.T) { 16 testCases := []struct { 17 Input interface{} 18 Size int32 19 }{ 20 { 21 Input: new(noop.Config), 22 Size: 0, 23 }, 24 { 25 Input: new(srtp.Config), 26 Size: 4, 27 }, 28 { 29 Input: new(utp.Config), 30 Size: 4, 31 }, 32 { 33 Input: new(wechat.VideoConfig), 34 Size: 13, 35 }, 36 { 37 Input: new(wireguard.WireguardConfig), 38 Size: 4, 39 }, 40 } 41 42 for _, testCase := range testCases { 43 header, err := CreatePacketHeader(testCase.Input) 44 common.Must(err) 45 if header.Size() != testCase.Size { 46 t.Error("expected size ", testCase.Size, " but got ", header.Size()) 47 } 48 } 49 }