From b38e4278f2e93485677b138a74f018944809d635 Mon Sep 17 00:00:00 2001 From: perp Date: Sun, 12 Nov 2023 00:46:51 +0000 Subject: [PATCH] :goal_net: Check for a protocol & print panic errors --- cmd/infinite/commands/check.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/infinite/commands/check.go b/cmd/infinite/commands/check.go index aa2e5b4..db7faf6 100644 --- a/cmd/infinite/commands/check.go +++ b/cmd/infinite/commands/check.go @@ -1,6 +1,8 @@ package commands import ( + "errors" + "github.com/panjf2000/ants/v2" "github.com/rs/zerolog/log" "github.com/spf13/cobra" @@ -21,10 +23,15 @@ var checkCmd = &cobra.Command{ Use: "check", Short: "Check proxies from a file", Run: func(_ *cobra.Command, _ []string) { + // Missing protocol + if socks5 == false && socks4 == false && socks4a == false { + log.Fatal().Err(errors.New("A protocol is required")).Msg("") + } + // Get file lines lines, err := utils.Read(file) if err != nil { - log.Panic().Err(err) + log.Panic().Err(err).Msg("") } // Get job count & make channel @@ -34,7 +41,7 @@ var checkCmd = &cobra.Command{ // Create new pool pool, err := ants.NewPool(threads) if err != nil { - log.Panic().Err(err) + log.Panic().Err(err).Msg("") } defer pool.Release()