<commit_before>// Copyright 2012 Google, Inc. All rights reserved.

/*
Package pcap allows users of gopacket to read packets off the wire or from
pcap files.

Reading PCAP Files

The following code can be used to read in data from a pcap file.

 if h, err := pcap.OpenOffline(filename); err != nil {
   panic(err)
 } else {
   for packet, err := h.Next(); err != pcap.NextErrorNoMorePackets; packet, err = h.Next() {
     if err != nil {
       fmt.Println("Error reading in packet:", err)
     } else {
       handlePacket(packet)
     }
   }
 }

Reading Live Packets

The following code can be used to read in data from a live device, in this case
"eth0".

 var handle *pcap.Handle
 if h, err := pcap.OpenLive("eth0", 1600, true, 0); err != nil {
   panic(err)
 } else if err := h.SetFilter("tcp and port 80"); err != nil {
   panic(err)
 } else {
   handle = h
 }
 for {
   packet, err := handle.Next()
   if err != nil {
     fmt.Println("Error reading in packet:", err)
     continue
   }
   handlePacket(packet)
 }
*/
package pcap
<commit_msg>Add more doc comments for pcap.<commit_after>// Copyright 2012 Google, Inc. All rights reserved.

/*
Package pcap allows users of gopacket to read packets off the wire or from
pcap files.

Reading PCAP Files

The following code can be used to read in data from a pcap file.

 if handle, err := pcap.OpenOffline(filename); err != nil {
   panic(err)
 } else {
   for packet, err := handle.Next(); err != pcap.NextErrorNoMorePackets; packet, err = handle.Next() {
     if err != nil {
       fmt.Println("Error reading in packet:", err)
     } else {
       handlePacket(packet)
     }
   }
 }

Reading Live Packets

The following code can be used to read in data from a live device, in this case
"eth0".

 if handle, err := pcap.OpenLive("eth0", 1600, true, 0); err != nil {
   panic(err)
 } else if err := handle.SetFilter("tcp and port 80"); err != nil {
   panic(err)
 } else {
   for {
     packet, err := handle.Next()
     if err != nil {
       fmt.Println("Error reading in packet:", err)
       continue
     }
     handlePacket(packet)
   }
 }

Changing Packet Decoding Behavior

You have a few options for changing the behavior of packet decoding on a handle.
The first is to modify the DecodeOptions of the handle:

 handle, _ := pcap.OpenLive(...)
 // See gopacket.DecodeOptions for more options you can set here.
 handle.DecodeOptions.Lazy = true

The second option is to change the default decoder used to decode each packet.
By default, we set the decoder based on the link type of the handler, so you
should very rarely need to do this.  However, if you want, you can:

 handle, _ := pcap.OpenLive(...)
 // Force the handle to decode every packet as if it were PPP
 handle.Decoder = gopacket.LinkTypePPP
*/
package pcap

{'fraction_non_alphanumeric': 0.10233393177737882, 'fraction_numerical': 0.00933572710951526, 'mean_word_length': 3.0028735632183907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3247283', 'n_tokens_mistral': 875, 'n_tokens_neox': 837, 'n_words': 363}