mirror of
https://github.com/nxtrace/nali
synced 2024-11-21 16:49:39 +00:00
opti
This commit is contained in:
parent
b71b39f1f0
commit
ea9fd5d6c3
@ -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)
|
||||
|
11
cmd/parse.go
11
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")
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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("我是中文")
|
||||
}
|
Loading…
Reference in New Issue
Block a user