diff --git a/README.md b/README.md index c4793b6..8e208d6 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,3 @@ $ go get -u -v github.com/zu1k/nali Pre-built binaries are available here: [release](https://github.com/zu1k/nali/releases) ## Usage - -## License - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fzu1k%2Fnali.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fzu1k%2Fhe?ref=badge_large) diff --git a/cmd/parse.go b/cmd/parse.go index 70df3cb..74019ea 100644 --- a/cmd/parse.go +++ b/cmd/parse.go @@ -6,7 +6,6 @@ import ( "github.com/spf13/cobra" ) -// parseCmd represents the parse command var parseCmd = &cobra.Command{ Use: "parse", Short: "Query IP information", @@ -19,14 +18,4 @@ var parseCmd = &cobra.Command{ func init() { rootCmd.AddCommand(parseCmd) - - // Here you will define your flags and configuration settings. - - // Cobra supports Persistent Flags which will work for this command - // and all subcommands, e.g.: - // parseCmd.PersistentFlags().String("foo", "", "A help for foo") - - // Cobra supports local flags which will only run when this command - // is called directly, e.g.: - // parseCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } diff --git a/cmd/root.go b/cmd/root.go index 8349996..cd3aa34 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" ) -// rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "nali", Short: "", @@ -25,8 +24,6 @@ var rootCmd = &cobra.Command{ }, } -// Execute adds all child commands to the root command and sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { if err := rootCmd.Execute(); err != nil { log.Fatal(err.Error()) @@ -35,11 +32,5 @@ func Execute() { } func init() { - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. - - // Cobra also supports local flags, which will only run - // when this action is called directly. rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") } diff --git a/internal/app/parse.go b/internal/app/parse.go index 50903d6..2439ca6 100644 --- a/internal/app/parse.go +++ b/internal/app/parse.go @@ -21,6 +21,7 @@ var ( func InitIPDB() { qqip = qqwry.NewQQwry(filepath.Join(constant.HomePath, "qqwry.dat")) //geoip = geoip2.NewGeoIP(filepath.Join(constant.HomePath, "GeoLite2-City.mmdb")) + db = qqip } diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index baabc57..7b2a0a7 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -21,7 +21,6 @@ func NewGeoIP(filePath string) GeoIP { } func (g GeoIP) Find(ip string) string { - // If you are using strings that may be invalid, check that ip is not nil ipData := net.ParseIP(ip) record, err := g.db.City(ipData) if err != nil { diff --git a/pkg/qqwry/qqwry_test.go b/pkg/qqwry/qqwry_test.go deleted file mode 100644 index beea95a..0000000 --- a/pkg/qqwry/qqwry_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package qqwry - -import ( - "fmt" - "testing" -) - -func TestNewQQwry(t *testing.T) { - fmt.Println("看看中文") - qqwry := NewQQwry("../../db/qqwry.dat") - fmt.Println(qqwry.Find("8.8.8.8")) - fmt.Println("我是中文") -}