mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
977 B
49 lines
977 B
package internet_test |
|
|
|
import ( |
|
"testing" |
|
|
|
"v2ray.com/core/common" |
|
. "v2ray.com/core/transport/internet" |
|
"v2ray.com/core/transport/internet/headers/noop" |
|
"v2ray.com/core/transport/internet/headers/srtp" |
|
"v2ray.com/core/transport/internet/headers/utp" |
|
"v2ray.com/core/transport/internet/headers/wechat" |
|
"v2ray.com/core/transport/internet/headers/wireguard" |
|
) |
|
|
|
func TestAllHeadersLoadable(t *testing.T) { |
|
testCases := []struct { |
|
Input interface{} |
|
Size int32 |
|
}{ |
|
{ |
|
Input: new(noop.Config), |
|
Size: 0, |
|
}, |
|
{ |
|
Input: new(srtp.Config), |
|
Size: 4, |
|
}, |
|
{ |
|
Input: new(utp.Config), |
|
Size: 4, |
|
}, |
|
{ |
|
Input: new(wechat.VideoConfig), |
|
Size: 13, |
|
}, |
|
{ |
|
Input: new(wireguard.WireguardConfig), |
|
Size: 4, |
|
}, |
|
} |
|
|
|
for _, testCase := range testCases { |
|
header, err := CreatePacketHeader(testCase.Input) |
|
common.Must(err) |
|
if header.Size() != testCase.Size { |
|
t.Error("expected size ", testCase.Size, " but got ", header.Size()) |
|
} |
|
} |
|
}
|
|
|