updated ipbl
This commit is contained in:
parent
b81adb4f95
commit
a3d1f84271
@ -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()
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user