summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/redq/main.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/redq/main.go b/cmd/redq/main.go
index f368dae..288c6be 100644
--- a/cmd/redq/main.go
+++ b/cmd/redq/main.go
@@ -9,14 +9,14 @@ import (
"syscall"
"github.com/jackc/pgx/v5"
- "sinanmohd.com/redq/db"
"sinanmohd.com/redq/api"
+ "sinanmohd.com/redq/db"
"sinanmohd.com/redq/usage"
)
func main() {
- var u usage.Usage
- var a api.Api
+ var u *usage.Usage
+ var a *api.Api
iface, err := net.InterfaceByName("wlan0")
if err != nil {
@@ -31,11 +31,11 @@ func main() {
defer conn.Close(ctx)
queries := db.New(conn)
- err = a.Init()
+ a, err = api.New()
if err != nil {
os.Exit(0)
}
- err = u.Init(iface)
+ u, err = usage.New(iface)
if err != nil {
os.Exit(0)
}
@@ -44,11 +44,11 @@ func main() {
signal.Notify(sigs, os.Interrupt, os.Kill, syscall.SIGTERM)
go func() {
<-sigs
- u.CleanUp(queries, ctx)
- a.CleanUp()
+ usage.Close(u, queries, ctx)
+ api.Close(a)
os.Exit(0)
}()
go u.Run(iface, queries, ctx)
- a.Run(&u)
+ a.Run(u)
}