updated ipbl

This commit is contained in:
Paul 2022-09-18 10:24:55 +02:00
parent b81adb4f95
commit a3d1f84271
3 changed files with 17 additions and 2 deletions

View File

@ -38,9 +38,11 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println("unable to receive message from req socket")
continue
}
var lastip string
var topub [][]byte
for _, val := range req {
var apiip = models.APIIP{}
var ip = models.IP{}
@ -49,6 +51,11 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println("unable to parse ip address", err)
continue
}
if apiip.IP == lastip {
lastip = apiip.IP
continue
}
if apiip.Mode != "init" {
ip = *apiip.APIConvert()

View File

@ -1,10 +1,14 @@
package zmqrouter
import (
"fmt"
"gopkg.in/zeromq/goczmq.v4"
)
const pubsubport int = 9999
func InitPub() (sock *goczmq.Sock, err error) {
sock, err = goczmq.NewPub("tcp://*:9999")
sock, err = goczmq.NewPub(fmt.Sprintf("tcp://*:%d", pubsubport))
return
}

View File

@ -1,10 +1,14 @@
package zmqrouter
import (
"fmt"
"gopkg.in/zeromq/goczmq.v4"
)
const repreqport int = 9998
func InitRep() (sock *goczmq.Sock, err error) {
sock, err = goczmq.NewRep("tcp://*:9998")
sock, err = goczmq.NewRep(fmt.Sprintf("tcp://*:%d", repreqport))
return
}