Skip to content

Commit

Permalink
Rename protocols to layers
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaglow committed Aug 4, 2019
1 parent 2ce390d commit f9ceb95
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions badcapt.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type TaggedPacket struct {
// Record contains packet data, that is ready to be exported
type Record struct {
SrcIP net.IP `json:"src_ip,omitempty"`
Protocols []string `json:"protocols,omitempty"`
Layers []string `json:"layers,omitempty"`
SrcPort uint16 `json:"src_port,omitempty"`
DstIP net.IP `json:"dst_ip,omitempty"`
DstPort uint16 `json:"dst_port,omitempty"`
Expand Down Expand Up @@ -80,9 +80,9 @@ func unpackTCP(p gopacket.Packet) *layers.TCP {

// NewRecord constructs a record to write to the database
func NewRecord(tp *TaggedPacket) (*Record, error) {
var protos []string
var layers []string
for _, l := range tp.Packet.Layers() {
protos = append(protos, l.LayerType().String())
layers = append(layers, l.LayerType().String())
}

var srcIP, dstIP net.IP
Expand Down Expand Up @@ -111,7 +111,7 @@ func NewRecord(tp *TaggedPacket) (*Record, error) {
Payload: payload,
PayloadString: string(payload),
Tags: tp.Tags,
Protocols: protos,
Layers: layers,
}, nil
}

Expand Down

0 comments on commit f9ceb95

Please sign in to comment.