(t *testing.T)
| 405 | } |
| 406 | |
| 407 | func TestDecodeUDPSFlow(t *testing.T) { |
| 408 | p := gopacket.NewPacket(SFlowTestPacket1, LayerTypeEthernet, gopacket.Default) |
| 409 | if p.ErrorLayer() != nil { |
| 410 | t.Error("Failed to decode packet:", p.ErrorLayer().Error()) |
| 411 | } |
| 412 | checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeSFlow}, t) |
| 413 | if got, ok := p.TransportLayer().(*UDP); ok { |
| 414 | want := &UDP{ |
| 415 | BaseLayer: BaseLayer{SFlowTestPacket1[34:42], SFlowTestPacket1[42:]}, |
| 416 | sPort: []byte{199, 87}, |
| 417 | dPort: []byte{24, 199}, |
| 418 | SrcPort: 51031, |
| 419 | DstPort: 6343, |
| 420 | Checksum: 8763, |
| 421 | Length: 1448, |
| 422 | } |
| 423 | if !reflect.DeepEqual(want, got) { |
| 424 | t.Errorf("UDP layer mismatch, \nwant %#v\ngot %#v\n", want, got) |
| 425 | } |
| 426 | } else { |
| 427 | t.Error("Transport layer packet not UDP") |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | func TestDecodeSFlowDatagram(t *testing.T) { |
| 432 | p := gopacket.NewPacket(SFlowTestPacket1, LayerTypeEthernet, gopacket.Default) |
nothing calls this directly
no test coverage detected
searching dependent graphs…