2016-12-08 10:27:41 -05:00
|
|
|
package internet_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "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"
|
2017-10-26 15:44:22 -04:00
|
|
|
. "v2ray.com/ext/assert"
|
2016-12-08 10:27:41 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestAllHeadersLoadable(t *testing.T) {
|
2017-10-24 10:15:35 -04:00
|
|
|
assert := With(t)
|
2016-12-08 10:27:41 -05:00
|
|
|
|
2017-01-12 16:47:10 -05:00
|
|
|
noopAuth, err := CreatePacketHeader((*noop.Config)(nil))
|
2017-10-24 10:15:35 -04:00
|
|
|
assert(err, IsNil)
|
2018-04-02 16:17:06 -04:00
|
|
|
assert(noopAuth.Size(), Equals, int32(0))
|
2016-12-08 10:27:41 -05:00
|
|
|
|
2017-01-12 16:47:10 -05:00
|
|
|
srtp, err := CreatePacketHeader((*srtp.Config)(nil))
|
2017-10-24 10:15:35 -04:00
|
|
|
assert(err, IsNil)
|
2018-04-02 16:17:06 -04:00
|
|
|
assert(srtp.Size(), Equals, int32(4))
|
2016-12-08 10:27:41 -05:00
|
|
|
|
2017-01-12 16:47:10 -05:00
|
|
|
utp, err := CreatePacketHeader((*utp.Config)(nil))
|
2017-10-24 10:15:35 -04:00
|
|
|
assert(err, IsNil)
|
2018-04-02 16:17:06 -04:00
|
|
|
assert(utp.Size(), Equals, int32(4))
|
2016-12-08 10:27:41 -05:00
|
|
|
}
|