generateJSONOutput generates printf for JSON format.
()
| 585 | |
| 586 | // generateJSONOutput generates printf for JSON format. |
| 587 | func (g *ScriptGenerator) generateJSONOutput() string { |
| 588 | return ` // Output JSON with numeric reason code |
| 589 | printf("{\"time\":\"%s\",\"type\":\"DROP\",\"reason_code\":%d,\"probe\":\"kfree_skb\",\"src_ip\":\"%s\",\"src_port\":%d,\"dst_ip\":\"%s\",\"dst_port\":%d}\n", |
| 590 | strftime("%H:%M:%S", nsecs), |
| 591 | $reason, |
| 592 | $saddr, $sport, |
| 593 | $daddr, $dport); |
| 594 | ` |
| 595 | } |
| 596 | |
| 597 | // generateEndBlock creates the END block. |
| 598 | func (g *ScriptGenerator) generateEndBlock() string { |
no outgoing calls
no test coverage detected