package parser import ( "encoding/json" "io/ioutil" "github.com/sirupsen/logrus" "gitlab.dcso.lolcat/LABS/styx/models" "gitlab.dcso.lolcat/LABS/styx/utils" ) // read node recieved on kafka // create a node in the node file // save domains in another file with node ID // parallel routine // look throught domain names and if find some that exists already, create the // edge file const ( NodesFilename = "nodes.json" EdgesFilename = "edges.json" ) func ParseEvent(domains []string) { nodeFile, err := ioutil.ReadFile(NodesFilename) if err != nil { logrus.Error(err) } nodeDatas := []models.Node{} if err := json.Unmarshal(nodeFile, &nodeDatas); err != nil { logrus.Error(err) } for _, node := range nodeDatas { utils.SaveDomains(node.Data.Data.LeafCert.AllDomains) } // saveDomains() // go findDomainEdges() } // Helpers