diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-17 18:07:32 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-18 21:55:35 +0700 |
| commit | a37fef27aa5411b7df102cb227768fe8a010ea42 (patch) | |
| tree | df6e528c5c4f859017c704422b1cdee19bf141ac /haminer.go | |
| parent | b86893f6dd315cb253ec5479501791c500d82876 (diff) | |
| download | haminer-a37fef27aa5411b7df102cb227768fe8a010ea42.tar.xz | |
all: add unit test for ParseUDPPacket
The function signature to parse the UDP packet changes to return HTTPLog
instead of as receiver.
Diffstat (limited to 'haminer.go')
| -rw-r--r-- | haminer.go | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -118,9 +118,6 @@ func (h *Haminer) Start() (err error) { // filter will return true if log is accepted; otherwise it will return false. func (h *Haminer) filter(halog *HTTPLog) bool { - if halog == nil { - return false - } if halog.BackendName == `-` { return false } @@ -153,10 +150,8 @@ func (h *Haminer) consume() { continue } - halog = &HTTPLog{} - - ok = halog.ParseUDPPacket(packet[:n], h.cfg.RequestHeaders) - if !ok { + halog = ParseUDPPacket(packet[:n], h.cfg.RequestHeaders) + if halog == nil { continue } |
