summaryrefslogtreecommitdiff
path: root/plugin/plaintext/common_out.go
diff options
context:
space:
mode:
authorLoyalsoldier <[email protected]>2024-10-24 06:01:54 +0800
committerLoyalsoldier <[email protected]>2024-10-24 06:01:54 +0800
commit40e0ad6895d62ad12ea1b1da4293dbcc05ea1d29 (patch)
treea3b3310824baa53ff4d7dad417a90a769386269d /plugin/plaintext/common_out.go
parent4cf50641990c7df79b1a03438dd9273532182e2f (diff)
Feat: support to exclude specified lists when output
Diffstat (limited to 'plugin/plaintext/common_out.go')
-rw-r--r--plugin/plaintext/common_out.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/plugin/plaintext/common_out.go b/plugin/plaintext/common_out.go
index b8f1bb55..117d48c7 100644
--- a/plugin/plaintext/common_out.go
+++ b/plugin/plaintext/common_out.go
@@ -7,7 +7,6 @@ import (
"net"
"os"
"path/filepath"
- "strings"
"github.com/Loyalsoldier/geoip/lib"
)
@@ -26,6 +25,7 @@ type textOut struct {
OutputDir string
OutputExt string
Want []string
+ Exclude []string
OnlyIPType lib.IPType
AddPrefixInLine string
@@ -37,6 +37,7 @@ func newTextOut(iType string, action lib.Action, data json.RawMessage) (lib.Outp
OutputDir string `json:"outputDir"`
OutputExt string `json:"outputExtension"`
Want []string `json:"wantedList"`
+ Exclude []string `json:"excludedList"`
OnlyIPType lib.IPType `json:"onlyIPType"`
AddPrefixInLine string `json:"addPrefixInLine"`
@@ -66,21 +67,14 @@ func newTextOut(iType string, action lib.Action, data json.RawMessage) (lib.Outp
tmp.OutputExt = ".txt"
}
- // Filter want list
- wantList := make([]string, 0, len(tmp.Want))
- for _, want := range tmp.Want {
- if want = strings.ToUpper(strings.TrimSpace(want)); want != "" {
- wantList = append(wantList, want)
- }
- }
-
return &textOut{
Type: iType,
Action: action,
Description: descTextOut,
OutputDir: tmp.OutputDir,
OutputExt: tmp.OutputExt,
- Want: wantList,
+ Want: tmp.Want,
+ Exclude: tmp.Exclude,
OnlyIPType: tmp.OnlyIPType,
AddPrefixInLine: tmp.AddPrefixInLine,