@@ -16,10 +16,8 @@ func TestRecordBinaryEncoding(t *testing.T) {
1616 0x03 , // u16 direction
1717 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , // data_link: u8[6] src_mac
1818 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f , // data_link: u8[6] dst_mac
19- 0x06 , 0x07 , 0x08 , 0x09 , // network: u32 src_ip
20- 0x0a , 0x0b , 0x0c , 0x0d , // network: u32 dst_ip
21- 0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 , // network6: u8[16] src_ip
22- 0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d , // network6: u8[16] dst_ip
19+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0x06 , 0x07 , 0x08 , 0x09 , // network: u8[16] src_ip
20+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0x0a , 0x0b , 0x0c , 0x0d , // network: u32 dst_ip
2321 0x0e , 0x0f , // transport: u16 src_port
2422 0x10 , 0x11 , // transport: u16 dst_port
2523 0x12 , // transport: u8protocol
@@ -37,12 +35,8 @@ func TestRecordBinaryEncoding(t *testing.T) {
3735 DstMac : MacAddr {0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f },
3836 },
3937 Network : Network {
40- SrcAddr : 0x09080706 ,
41- DstAddr : 0x0d0c0b0a ,
42- },
43- NetworkV6 : NetworkV6 {
44- SrcAddr : IP6Addr {0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 , 0x06 , 0x07 , 0x08 , 0x09 },
45- DstAddr : IP6Addr {0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d , 0x0a , 0x0b , 0x0c , 0x0d },
38+ SrcAddr : IPAddr {0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0x06 , 0x07 , 0x08 , 0x09 },
39+ DstAddr : IPAddr {0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0x0a , 0x0b , 0x0c , 0x0d },
4640 },
4741 Transport : Transport {
4842 SrcPort : 0x0f0e ,
@@ -53,5 +47,7 @@ func TestRecordBinaryEncoding(t *testing.T) {
5347 Bytes : 0x1a19181716151413 ,
5448 },
5549 }, * fr )
56-
50+ // assert that IP addresses are interpreted as IPv4 addresses
51+ assert .Equal (t , "6.7.8.9" , fr .Network .SrcAddr .IP ().String ())
52+ assert .Equal (t , "10.11.12.13" , fr .Network .DstAddr .IP ().String ())
5753}
0 commit comments