updated ipbl to handle init of ipblc
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3f000cbf8f
commit
e92d332269
@ -55,18 +55,18 @@ func (cfg *Config) GetConfig() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Db *xorm.Engine `json:"-"`
|
Db *xorm.Engine
|
||||||
DbParams struct {
|
DbParams struct {
|
||||||
DbHostname string
|
DbHostname string
|
||||||
DbUsername string
|
DbUsername string
|
||||||
DbPassword string
|
DbPassword string
|
||||||
DbDatabase string
|
DbDatabase string
|
||||||
} `json:"-"`
|
}
|
||||||
Options struct {
|
Options struct {
|
||||||
Version string
|
Version string
|
||||||
HideBanner bool
|
HideBanner bool
|
||||||
ZMQChannel string
|
ZMQChannel string
|
||||||
} `json:"-"`
|
}
|
||||||
Switchs struct {
|
Switchs struct {
|
||||||
Port int
|
Port int
|
||||||
NoFeed bool
|
NoFeed bool
|
||||||
@ -75,5 +75,5 @@ type Config struct {
|
|||||||
Init bool
|
Init bool
|
||||||
Version bool
|
Version bool
|
||||||
NoScanIP bool
|
NoScanIP bool
|
||||||
} `json:"-"`
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,4 +219,5 @@ type APIIP struct {
|
|||||||
City string `json:"city"`
|
City string `json:"city"`
|
||||||
Country string `json:"country"`
|
Country string `json:"country"`
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
|
Mode string `json:"mode"`
|
||||||
}
|
}
|
||||||
|
@ -49,16 +49,18 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
|
|||||||
log.Println("unable to parse ip address", err)
|
log.Println("unable to parse ip address", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ip = *apiip.APIConvert()
|
if apiip.Mode != "init" {
|
||||||
|
ip = *apiip.APIConvert()
|
||||||
|
|
||||||
numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
|
numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
}
|
||||||
|
log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate)
|
||||||
}
|
}
|
||||||
log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate)
|
|
||||||
tmpval := fmt.Sprintf("%s %s", channel, string(val))
|
tmpval := fmt.Sprintf("%s %s", channel, string(val))
|
||||||
val = []byte(tmpval)
|
ipjson := []byte(tmpval)
|
||||||
topub = append(topub, val)
|
topub = append(topub, ipjson)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pubsock.SendMessage(topub)
|
err = pubsock.SendMessage(topub)
|
||||||
|
Loading…
Reference in New Issue
Block a user