diff --git a/cmd/queryer/main.go b/cmd/queryer/main.go index 5dac3c2..10feb54 100644 --- a/cmd/queryer/main.go +++ b/cmd/queryer/main.go @@ -4,6 +4,7 @@ import ( "os" "github.com/L4B0MB4/EVTSRC/pkg/client" + tcpClient "github.com/L4B0MB4/EVTSRC/pkg/tcp/client" "github.com/L4B0MB4/PRYVT/identification/pkg/query/eventhandling" "github.com/L4B0MB4/PRYVT/identification/pkg/query/httphandler" "github.com/L4B0MB4/PRYVT/identification/pkg/query/httphandler/controller" @@ -46,7 +47,24 @@ func main() { userEventHandler := eventhandling.NewUserEventHandler(userRepo) eventPolling := eventpolling.NewEventPolling(c, eventRepo, userEventHandler) - go eventPolling.PollEvents() + tcpC, err := tcpClient.NewTcpEventClient() + if err != nil { + log.Error().Err(err).Msg("Unsuccessful initialization of tcp client") + return + } + channel := make(chan string, 1) + go tcpC.ListenForEvents(channel) + + eventPolling.PollEventsUntilEmpty() + go func() { + for { + select { + case event := <-channel: + log.Info().Msgf("Received event: %s", event) + eventPolling.PollEventsUntilEmpty() + } + } + }() h.Start() } diff --git a/go.mod b/go.mod index e9f2919..af0f202 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.23.1 require github.com/mattn/go-sqlite3 v1.14.24 require ( - github.com/L4B0MB4/EVTSRC v0.4.5 // indirect - github.com/PRYVT/utils v0.2.0 // indirect + github.com/L4B0MB4/EVTSRC v0.5.1 // indirect + github.com/PRYVT/utils v0.2.0-rc-2 // indirect github.com/bytedance/sonic v1.12.2 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/cloudwego/base64x v0.1.4 // indirect diff --git a/go.sum b/go.sum index fd86ff0..183be29 100644 --- a/go.sum +++ b/go.sum @@ -16,12 +16,28 @@ github.com/L4B0MB4/EVTSRC v0.4.0 h1:Y0/oEoMAv9kgGH/dgN9v1YBno6ZghXbWNPixScz9CX8= github.com/L4B0MB4/EVTSRC v0.4.0/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= github.com/L4B0MB4/EVTSRC v0.4.5 h1:HA4tp4fa/oCPTCl3gTD2FkRjo+nFKWm4rLmpudxcxXg= github.com/L4B0MB4/EVTSRC v0.4.5/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-1 h1:r8FLKDAnFh0rOZVXTqBB9uQRu800MpAQoszNpW9g+QQ= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-1/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-2 h1:fTuKRKwmhshP3PYkq1Gu/3pywAKcbGGUo/okhZEfGe8= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-2/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-3 h1:bI9Fhh0zq6zU3lVCYBynpYhZb91g1o4hsZ703RCMkn8= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-3/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-4 h1:gUFnWbNnxlk3yYKKs1ymjySYoVyDyWbk0cmXZ3vyWcg= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-4/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-5 h1:CT3eZqVq2b4ghoG5g5bvvrcXZUGVy3AQoV3NAZ12Al0= +github.com/L4B0MB4/EVTSRC v0.5.0-rc-5/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= +github.com/L4B0MB4/EVTSRC v0.5.1 h1:EB/lK0FTWtepToOtRFJdUhBf6tlb1L0bIRbRTMwArsQ= +github.com/L4B0MB4/EVTSRC v0.5.1/go.mod h1:hpyNdNWqikZ6dcm8dhZAXgnAXZQNGAfXgRw902zjby0= github.com/PRYVT/utils v0.1.0 h1:Oq/sKHTKBVoAX+pLJMniYaZfv0ReDlQ+5E8qpKGiVjI= github.com/PRYVT/utils v0.1.0/go.mod h1:RDgZFSTf1GPnpjVqnw0PSY68bzyp+WTK/wgAklOBFxY= github.com/PRYVT/utils v0.1.1 h1:Y/WHkTHID0T40O2XfzlLM1QsDyQWE8FtH8ncaU4ags8= github.com/PRYVT/utils v0.1.1/go.mod h1:b7zk2FAGwJ8BPJx2JQ8qd+bA59g5EY7Y1vZQPWZHK3s= github.com/PRYVT/utils v0.1.2 h1:U9qhq+18iIblQDrM4I0fmJkvlZ+BCY+DIjjKI4ebtlk= github.com/PRYVT/utils v0.1.2/go.mod h1:b7zk2FAGwJ8BPJx2JQ8qd+bA59g5EY7Y1vZQPWZHK3s= +github.com/PRYVT/utils v0.2.0-rc-1 h1:CwYscVZqozFxc8vdtZnoNv6XYfu7RPODZ7g3ecNvKPE= +github.com/PRYVT/utils v0.2.0-rc-1/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w= +github.com/PRYVT/utils v0.2.0-rc-2 h1:7fp2kgp22HIQxBCNrYStxPuiReCwbgrqIuWCZ0pBsBM= +github.com/PRYVT/utils v0.2.0-rc-2/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w= github.com/PRYVT/utils v0.2.0 h1:hWdHchXlGOYlJ1nfMmGffq/EjFn3ncvzTgsGCLUpiEE= github.com/PRYVT/utils v0.2.0/go.mod h1:j61GmoyWWXgnCq/laZTIJm4yhD0PreLDMZnYQqjSv7w= github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=