From 60009db14891b46777124fab5c2a9098f77bde46 Mon Sep 17 00:00:00 2001 From: hktalent <18223385+hktalent@users.noreply.github.com> Date: Mon, 1 Jan 2024 20:56:50 +0800 Subject: [PATCH] fixed --json 2024-01-01 --- core/device/device.go | 2 +- main.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/device/device.go b/core/device/device.go index b1bc3e6..a9c6134 100644 --- a/core/device/device.go +++ b/core/device/device.go @@ -66,7 +66,7 @@ func AutoGetDevices() *EtherTable { continue } if dnsLayer := packet.Layer(layers.LayerTypeDNS); dnsLayer != nil { - //gologger.Printf(".") + gologger.Printf(".") dns, _ := dnsLayer.(*layers.DNS) if !dns.QR { continue diff --git a/main.go b/main.go index 24b53df..47acabf 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "log" _ "net/http/pprof" "os" + "strings" "sync" ) @@ -18,9 +19,11 @@ var config embed.FS // go tool pprof -seconds=60 -http=:9999 http://127.0.0.1:6060/debug/pprof/heap // go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=60 func main() { - os.Setenv("devDebug", "false") - os.Setenv("ProductMod", "release") - log.SetOutput(io.Discard) + if strings.Contains(strings.Join(os.Args[1:], " "), "--json") { + os.Setenv("devDebug", "false") + os.Setenv("ProductMod", "release") + log.SetOutput(io.Discard) + } os.RemoveAll(".DbCache") defer os.RemoveAll("ksubdomain.yaml") util.Wg = &sync.WaitGroup{}