updated ipbl to handle init of ipblc
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2022-09-11 23:34:51 +02:00
parent 3f000cbf8f
commit e92d332269
3 changed files with 14 additions and 11 deletions

View File

@ -55,18 +55,18 @@ func (cfg *Config) GetConfig() error {
}
type Config struct {
Db *xorm.Engine `json:"-"`
Db *xorm.Engine
DbParams struct {
DbHostname string
DbUsername string
DbPassword string
DbDatabase string
} `json:"-"`
}
Options struct {
Version string
HideBanner bool
ZMQChannel string
} `json:"-"`
}
Switchs struct {
Port int
NoFeed bool
@ -75,5 +75,5 @@ type Config struct {
Init bool
Version bool
NoScanIP bool
} `json:"-"`
}
}

View File

@ -219,4 +219,5 @@ type APIIP struct {
City string `json:"city"`
Country string `json:"country"`
Date string `json:"date"`
Mode string `json:"mode"`
}

View File

@ -49,6 +49,7 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println("unable to parse ip address", err)
continue
}
if apiip.Mode != "init" {
ip = *apiip.APIConvert()
numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
@ -56,9 +57,10 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println(err)
}
log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate)
}
tmpval := fmt.Sprintf("%s %s", channel, string(val))
val = []byte(tmpval)
topub = append(topub, val)
ipjson := []byte(tmpval)
topub = append(topub, ipjson)
}
err = pubsock.SendMessage(topub)