|
@@ -186,6 +186,10 @@ func processPacket(packet gopacket.Packet) {
|
|
|
ipSrc = ip.SrcIP.String()
|
|
|
ipDst = ip.DstIP.String()
|
|
|
hasIPv4 = true
|
|
|
+ if config.Trace {
|
|
|
+ log.Printf("IPv4 packet %s -> %s\n", ipSrc, ipDst)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// IPv6
|
|
@@ -194,6 +198,9 @@ func processPacket(packet gopacket.Packet) {
|
|
|
ip := ipLayer.(*layers.IPv6)
|
|
|
ipSrc = ip.SrcIP.String()
|
|
|
ipDst = ip.DstIP.String()
|
|
|
+ if config.Trace {
|
|
|
+ log.Printf("IPv6 packet %s -> %s\n", ipSrc, ipDst)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -254,8 +261,8 @@ func processPacket(packet gopacket.Packet) {
|
|
|
request.Source = request.XRealIP
|
|
|
}
|
|
|
|
|
|
- if *trace {
|
|
|
- fmt.Println("Request for NATS")
|
|
|
+ if config.Trace {
|
|
|
+ log.Println("Request for NATS")
|
|
|
pretty.Println(request)
|
|
|
}
|
|
|
|
|
@@ -263,8 +270,8 @@ func processPacket(packet gopacket.Packet) {
|
|
|
}
|
|
|
|
|
|
func processAJP13(request *data.Request, appData []byte) error {
|
|
|
- if *trace {
|
|
|
- fmt.Printf("packet: %v\n", appData)
|
|
|
+ if config.Trace {
|
|
|
+ log.Printf("packet: %v\n", appData)
|
|
|
}
|
|
|
|
|
|
a, err := ajp13.Parse(appData)
|
|
@@ -272,8 +279,8 @@ func processAJP13(request *data.Request, appData []byte) error {
|
|
|
return fmt.Errorf("Failed to parse AJP13 request: %s", err)
|
|
|
}
|
|
|
|
|
|
- if *trace {
|
|
|
- fmt.Println("AJP13")
|
|
|
+ if config.Trace {
|
|
|
+ log.Println("AJP13")
|
|
|
pretty.Println(a)
|
|
|
}
|
|
|
|
|
@@ -329,8 +336,8 @@ func processAJP13(request *data.Request, appData []byte) error {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if *trace {
|
|
|
- fmt.Println("Request")
|
|
|
+ if config.Trace {
|
|
|
+ log.Println("Request")
|
|
|
pretty.Println(request)
|
|
|
}
|
|
|
|
|
@@ -453,6 +460,7 @@ func loadConfig() {
|
|
|
config.UseXForwardedAsSource = *useXForwardedAsSource
|
|
|
config.Protocol = *protocol
|
|
|
config.Quiet = *beQuiet
|
|
|
+ config.Trace = *trace
|
|
|
|
|
|
if *configFile == "" {
|
|
|
return
|