mirror of
https://github.com/maride/pancap.git
synced 2024-10-18 12:06:32 +00:00
20 lines
560 B
Go
20 lines
560 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/google/gopacket"
|
||
|
"github.com/google/gopacket/layers"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
// Analyzes the given packet source
|
||
|
func analyzePCAP(source *gopacket.PacketSource, linkType layers.LinkType) error {
|
||
|
log.Printf("PCAP capture link type is %s (ID %d)", getNameOfLinkType(linkType), linkType)
|
||
|
// TODO: maybe, just maybe, we wanna print more here than just the link type :)
|
||
|
_, _ = source, linkType
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Returns the name of the LinkType constant handed over
|
||
|
func getNameOfLinkType(lt layers.LinkType) string {
|
||
|
return lt.String()
|
||
|
}
|