aboutsummaryrefslogtreecommitdiff
path: root/haminer.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-03-17 18:07:32 +0700
committerShulhan <ms@kilabit.info>2024-03-18 21:55:35 +0700
commita37fef27aa5411b7df102cb227768fe8a010ea42 (patch)
treedf6e528c5c4f859017c704422b1cdee19bf141ac /haminer.go
parentb86893f6dd315cb253ec5479501791c500d82876 (diff)
downloadhaminer-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.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/haminer.go b/haminer.go
index b89b619..ca1f850 100644
--- a/haminer.go
+++ b/haminer.go
@@ -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
}