From bff6cdd43462bc93443fdfc370b572f1079d1983 Mon Sep 17 00:00:00 2001 From: strNophix Date: Thu, 20 Oct 2022 18:45:58 +0200 Subject: [PATCH] Added chat microservice, removed air --- .air.linux.conf | 47 ------------- .air.windows.conf | 47 ------------- Makefile | 4 ++ chat-service/app/app.go | 34 +++++++++- chat-service/logic/logic.go | 70 ++++++++++++++++++++ chat-service/models/models.go | 11 +++ chat-service/repository/chat.go | 9 +++ chat-service/repository/scylla/chat.go | 48 ++++++++++++++ chat-service/repository/scylla/seed.go | 30 +++++++++ chat-service/serializer/json.go | 31 +++++++++ chat-service/serializer/serializer.go | 8 +++ chat-service/services/chat.go | 11 +++ chat-service/utils/validator.go | 5 ++ client/components/chat/index.tsx | 35 ++++++++++ client/components/message/ChatMessage.tsx | 4 +- client/config/index.ts | 1 + client/pages/[channel]/index.tsx | 15 +---- client/placeholder/chatMessages.ts | 9 --- client/types/index.ts | 7 +- config.example.json | 9 --- docker-compose.yml | 32 +++++---- go.mod | 26 +++++++- go.sum | 81 +++++++++++++++++++++-- main.go | 9 --- 24 files changed, 424 insertions(+), 159 deletions(-) delete mode 100644 .air.linux.conf delete mode 100644 .air.windows.conf create mode 100644 Makefile create mode 100644 chat-service/logic/logic.go create mode 100644 chat-service/models/models.go create mode 100644 chat-service/repository/chat.go create mode 100644 chat-service/repository/scylla/chat.go create mode 100644 chat-service/repository/scylla/seed.go create mode 100644 chat-service/serializer/json.go create mode 100644 chat-service/serializer/serializer.go create mode 100644 chat-service/services/chat.go create mode 100644 chat-service/utils/validator.go create mode 100644 client/components/chat/index.tsx delete mode 100644 client/placeholder/chatMessages.ts delete mode 100644 config.example.json delete mode 100644 main.go diff --git a/.air.linux.conf b/.air.linux.conf deleted file mode 100644 index 9eeb0ba..0000000 --- a/.air.linux.conf +++ /dev/null @@ -1,47 +0,0 @@ -# Config file for [Air](https://github.com/cosmtrek/air) in TOML format - -# Working directory -# . or absolute path, please note that the directories following must be under root. -root = "." -tmp_dir = "tmp" - -[build] -# Just plain old shell command. You could use `make` as well. -cmd = "go build -o ./application ./main.go" -# Binary file yields from `cmd`. -bin = "application" -# Customize binary. -full_bin = "application" -# Watch these filename extensions. -include_ext = ["go", "tpl", "tmpl", "html", "mustache", "hbs", "pug"] -# Ignore these filename extensions or directories. -exclude_dir = ["tmp", "vendor", "node_modules"] -# Watch these directories if you specified. -include_dir = [] -# Exclude files. -exclude_file = [] -# This log file places in your tmp_dir. -log = "air.log" -# It's not necessary to trigger build each time file changes if it's too frequent. -delay = 1000 # ms -# Stop running old binary when build errors occur. -stop_on_error = true -# Send Interrupt signal before killing process (windows does not support this feature) -send_interrupt = false -# Delay after sending Interrupt signal -kill_delay = 500 # ms - -[log] -# Show log time -time = false - -[color] -# Customize each part's color. If no color found, use the raw app log. -main = "magenta" -watcher = "cyan" -build = "yellow" -runner = "green" - -[misc] -# Delete tmp directory on exit -clean_on_exit = true diff --git a/.air.windows.conf b/.air.windows.conf deleted file mode 100644 index 6fddc6c..0000000 --- a/.air.windows.conf +++ /dev/null @@ -1,47 +0,0 @@ -# Config file for [Air](https://github.com/cosmtrek/air) in TOML format - -# Working directory -# . or absolute path, please note that the directories following must be under root. -root = "." -tmp_dir = "tmp" - -[build] -# Just plain old shell command. You could use `make` as well. -cmd = "go build -o ./application.exe ./main.go" -# Binary file yields from `cmd`. -bin = "application.exe" -# Customize binary. -full_bin = "application.exe" -# Watch these filename extensions. -include_ext = ["go", "tpl", "tmpl", "html", "mustache", "hbs", "pug"] -# Ignore these filename extensions or directories. -exclude_dir = ["tmp", "vendor", "node_modules"] -# Watch these directories if you specified. -include_dir = [] -# Exclude files. -exclude_file = [] -# This log file places in your tmp_dir. -log = "air.log" -# It's not necessary to trigger build each time file changes if it's too frequent. -delay = 1000 # ms -# Stop running old binary when build errors occur. -stop_on_error = true -# Send Interrupt signal before killing process (windows does not support this feature) -send_interrupt = false -# Delay after sending Interrupt signal -kill_delay = 500 # ms - -[log] -# Show log time -time = false - -[color] -# Customize each part's color. If no color found, use the raw app log. -main = "magenta" -watcher = "cyan" -build = "yellow" -runner = "green" - -[misc] -# Delete tmp directory on exit -clean_on_exit = true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c8d157b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: chat-service + +chat-service: + go build -o ./tmp/main ./cmd/chat-service/main.go \ No newline at end of file diff --git a/chat-service/app/app.go b/chat-service/app/app.go index c1e708a..7bd7cbb 100644 --- a/chat-service/app/app.go +++ b/chat-service/app/app.go @@ -1,15 +1,43 @@ package app import ( - "net/http" + "twitch-clone/chat-service/logic" + "twitch-clone/chat-service/models" + "twitch-clone/chat-service/repository" + "twitch-clone/chat-service/repository/scylla" + service "twitch-clone/chat-service/services" + "github.com/joho/godotenv" "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" ) func Run() { + err := godotenv.Load() + if err != nil { + panic(err) + } + e := echo.New() - e.GET("/", func(c echo.Context) error { - return c.String(http.StatusOK, "Hello, World!") + var c repository.ChatRepository = scylla.NewChatRepository() + var s service.ChatService = logic.NewChatService(c) + + e.Use(middleware.Logger()) + e.Use(middleware.Recover()) + + e.GET("*", func(c echo.Context) error { + return s.Subscribe(c.Response().Writer, c.Request()) }) + + e.POST("*", func(c echo.Context) error { + return s.Publish(c.Request().URL.Path, &models.ChatMessage{ + FromUserID: 0, + FromUser: "niku", + ToUserID: 0, + ToUser: "niku", + Content: "Welcome", + }) + }) + e.Logger.Fatal(e.Start(":1323")) } diff --git a/chat-service/logic/logic.go b/chat-service/logic/logic.go new file mode 100644 index 0000000..f61f1ca --- /dev/null +++ b/chat-service/logic/logic.go @@ -0,0 +1,70 @@ +package logic + +import ( + "encoding/json" + "net/http" + "time" + "twitch-clone/chat-service/models" + "twitch-clone/chat-service/repository" + "twitch-clone/chat-service/serializer" + + "github.com/bwmarrin/snowflake" + "github.com/olahol/melody" +) + +type chatService struct { + ChatRepo repository.ChatRepository + Melody melody.Melody + MsgSerializer serializer.JsonMessageSerializer + Snowflake snowflake.Node +} + +func NewChatService(chatRepo repository.ChatRepository) *chatService { + flakeGen, err := snowflake.NewNode(0) + if err != nil { + panic(err) + } + + c := &chatService{ + ChatRepo: chatRepo, + Melody: *melody.New(), + MsgSerializer: serializer.JsonMessageSerializer{}, + Snowflake: *flakeGen, + } + + c.Melody.HandleMessage(func(s *melody.Session, b []byte) { + msg, err := c.MsgSerializer.Decode(b) + if err != nil { + bytes, _ := json.Marshal(err.Error()) + s.Write(bytes) + return + } + c.Publish(s.Request.URL.Path, msg) + }) + + return c +} + +func (c *chatService) Subscribe(w http.ResponseWriter, r *http.Request) error { + return c.Melody.HandleRequest(w, r) +} + +func (c *chatService) Publish(namespace string, msg *models.ChatMessage) error { + msg.MessageID = c.Snowflake.Generate().Int64() + msg.CreatedAt = time.Now().Unix() + + rawMsg, err := c.MsgSerializer.Encode(msg) + if err != nil { + return err + } + + err = c.Melody.BroadcastFilter(rawMsg, func(q *melody.Session) bool { + return q.Request.URL.Path == namespace + }) + if err != nil { + return err + } + + err = c.ChatRepo.Store(msg) + return err +} diff --git a/chat-service/models/models.go b/chat-service/models/models.go new file mode 100644 index 0000000..76ebe42 --- /dev/null +++ b/chat-service/models/models.go @@ -0,0 +1,11 @@ +package models + +type ChatMessage struct { + MessageID int64 `json:"messageId,omitempty"` + FromUserID int64 `validate:"required" json:"fromUserID"` + FromUser string `validate:"required" json:"fromUser"` + ToUserID int64 `validate:"required" json:"toUserID"` + ToUser string `validate:"required" json:"toUser"` + Content string `validate:"required" json:"content"` + CreatedAt int64 `json:"createdAt,omitempty"` +} diff --git a/chat-service/repository/chat.go b/chat-service/repository/chat.go new file mode 100644 index 0000000..95199aa --- /dev/null +++ b/chat-service/repository/chat.go @@ -0,0 +1,9 @@ +package repository + +import ( + "twitch-clone/chat-service/models" +) + +type ChatRepository interface { + Store(*models.ChatMessage) error +} diff --git a/chat-service/repository/scylla/chat.go b/chat-service/repository/scylla/chat.go new file mode 100644 index 0000000..67337be --- /dev/null +++ b/chat-service/repository/scylla/chat.go @@ -0,0 +1,48 @@ +package scylla + +import ( + "os" + "twitch-clone/chat-service/models" + + "github.com/gocql/gocql" + "github.com/scylladb/gocqlx/v2" + "github.com/scylladb/gocqlx/v2/table" +) + +var messageMetadata = table.Metadata{ + Name: "chat_service.messages", + Columns: []string{"message_id", "from_user_id", "from_user", "to_user_id", "to_user", "content", "created_at"}, +} + +var messageTable = table.New(messageMetadata) + +type ChatRepository struct { + cluster gocql.ClusterConfig +} + +func (r *ChatRepository) Store(msg *models.ChatMessage) error { + session, err := gocqlx.WrapSession(r.cluster.CreateSession()) + if err != nil { + return err + } + defer session.Close() + + q := session.Query(messageTable.Insert()).BindStruct(msg) + if err := q.ExecRelease(); err != nil { + return err + } + + return nil +} + +func NewChatRepository() *ChatRepository { + cluster := gocql.NewCluster(os.Getenv("CHAT_SCYLLA_HOSTS")) + + session, _ := gocqlx.WrapSession(cluster.CreateSession()) + Seed(session) + session.Close() + + return &ChatRepository{ + cluster: *cluster, + } +} diff --git a/chat-service/repository/scylla/seed.go b/chat-service/repository/scylla/seed.go new file mode 100644 index 0000000..ae7b5c1 --- /dev/null +++ b/chat-service/repository/scylla/seed.go @@ -0,0 +1,30 @@ +package scylla + +import "github.com/scylladb/gocqlx/v2" + +func Seed(session gocqlx.Session) error { + err := session.ExecStmt(` + CREATE KEYSPACE IF NOT EXISTS chat_service + WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}`) + if err != nil { + return err + } + + err = session.ExecStmt(` + CREATE TABLE IF NOT EXISTS chat_service.messages ( + message_id bigint, + from_user_id bigint, + from_user text, + to_user_id bigint, + to_user text, + content text, + created_at timestamp, + PRIMARY KEY (to_user_id, message_id) + )`) + + if err != nil { + return err + } + + return nil +} diff --git a/chat-service/serializer/json.go b/chat-service/serializer/json.go new file mode 100644 index 0000000..827e24f --- /dev/null +++ b/chat-service/serializer/json.go @@ -0,0 +1,31 @@ +package serializer + +import ( + "encoding/json" + "twitch-clone/chat-service/models" + "twitch-clone/chat-service/utils" +) + +type JsonMessageSerializer struct{} + +func (s *JsonMessageSerializer) Decode(input []byte) (*models.ChatMessage, error) { + msg := &models.ChatMessage{} + if err := json.Unmarshal(input, msg); err != nil { + return nil, err + } + + if err := utils.Validate.Struct(msg); err != nil { + return nil, err + } + + return msg, nil +} + +func (s *JsonMessageSerializer) Encode(input *models.ChatMessage) ([]byte, error) { + msg, err := json.Marshal(input) + if err != nil { + return nil, err + } + + return msg, nil +} diff --git a/chat-service/serializer/serializer.go b/chat-service/serializer/serializer.go new file mode 100644 index 0000000..fc4690c --- /dev/null +++ b/chat-service/serializer/serializer.go @@ -0,0 +1,8 @@ +package serializer + +import "twitch-clone/chat-service/models" + +type MessageSerializer interface { + Decode(input []byte) (*models.ChatMessage, error) + Encode(input *models.ChatMessage) ([]byte, error) +} diff --git a/chat-service/services/chat.go b/chat-service/services/chat.go new file mode 100644 index 0000000..b4ff2e4 --- /dev/null +++ b/chat-service/services/chat.go @@ -0,0 +1,11 @@ +package service + +import ( + "net/http" + "twitch-clone/chat-service/models" +) + +type ChatService interface { + Subscribe(http.ResponseWriter, *http.Request) error + Publish(string, *models.ChatMessage) error +} diff --git a/chat-service/utils/validator.go b/chat-service/utils/validator.go new file mode 100644 index 0000000..15ae421 --- /dev/null +++ b/chat-service/utils/validator.go @@ -0,0 +1,5 @@ +package utils + +import "github.com/go-playground/validator/v10" + +var Validate = validator.New() diff --git a/client/components/chat/index.tsx b/client/components/chat/index.tsx new file mode 100644 index 0000000..821b7c8 --- /dev/null +++ b/client/components/chat/index.tsx @@ -0,0 +1,35 @@ +import { FC, useEffect, useState } from "react" +import { CHAT_URL } from "../../config" +import { ChatMessage as Message } from "../../types" +import Input from "../common/Input" +import ChatMessage from "../message/ChatMessage" + +const Chat: FC = () => { + const [messages, setMessages] = useState([]) + + useEffect(() => { + const ws = new WebSocket(CHAT_URL) + ws.onmessage = (ev) => { + const newMsg = JSON.parse(ev.data) as Message + setMessages((old) => [...old, newMsg]) + } + }, []) + + return ( +
+
+

Stream Chat

+
+
+ {messages.map((message) => ( + + ))} +
+
+ +
+
+ ) +} + +export default Chat diff --git a/client/components/message/ChatMessage.tsx b/client/components/message/ChatMessage.tsx index 30af24f..0767d4e 100644 --- a/client/components/message/ChatMessage.tsx +++ b/client/components/message/ChatMessage.tsx @@ -6,12 +6,12 @@ export interface ChatMessageProps { } const ChatMessage: FC = ({ - message: { author, content }, + message: { fromUser, content }, }) => { return (
- {author}: + {fromUser}:
{content}
diff --git a/client/config/index.ts b/client/config/index.ts index 3a2a2b0..dcf2f6b 100644 --- a/client/config/index.ts +++ b/client/config/index.ts @@ -1 +1,2 @@ export const KRATOS_URL = "http://127.0.0.1:4433" +export const CHAT_URL = "ws://localhost:1323" diff --git a/client/pages/[channel]/index.tsx b/client/pages/[channel]/index.tsx index 3f666dc..7bd96b1 100644 --- a/client/pages/[channel]/index.tsx +++ b/client/pages/[channel]/index.tsx @@ -3,6 +3,7 @@ import Input from "../../components/common/Input" import { NextPage } from "next" import BrowseLayout from "../../components/layout/BrowseLayout" import { createRandomMessage } from "../../placeholder/chatMessages" +import Chat from "../../components/chat" const ChannelPage: NextPage = () => { return ( @@ -18,19 +19,7 @@ const ChannelPage: NextPage = () => {
1:14:32
-
-
-

Stream Chat

-
-
- {new Array(60).fill(0).map((_, i) => ( - - ))} -
-
- -
-
+ ) diff --git a/client/placeholder/chatMessages.ts b/client/placeholder/chatMessages.ts deleted file mode 100644 index c8ff9e3..0000000 --- a/client/placeholder/chatMessages.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChatMessage } from "../types" -import { faker } from "@faker-js/faker" - -export const createRandomMessage = (): ChatMessage => { - return { - author: faker.name.firstName(), - content: faker.lorem.words(10), - } -} diff --git a/client/types/index.ts b/client/types/index.ts index cff2536..a2eb61b 100644 --- a/client/types/index.ts +++ b/client/types/index.ts @@ -1,4 +1,9 @@ export interface ChatMessage { - author: string + messageId: bigint + fromUserId: bigint + fromUser: string + toUserId: bigint + toUser: string content: string + createdAt: bigint } diff --git a/config.example.json b/config.example.json deleted file mode 100644 index 4d4bf8c..0000000 --- a/config.example.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "db": { - "user":"test", - "password":"pass", - "server":"test.mongodb.net", - "cluster":"test" - }, - "env": "dev" -} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7a58084..5bad6af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,19 +7,27 @@ services: # - app-postgres # ports: # - 5000:5000 - rtmp: - image: alfg/nginx-rtmp + # rtmp: + # image: alfg/nginx-rtmp + # ports: + # - 1935:1935 + # - 8080:80 + # app-postgres: + # image: postgres:9.6 + # ports: + # - '5433:5432' + # environment: + # - POSTGRES_USER=${POSTGRES_USER} + # - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + # - POSTGRES_DB=${POSTGRES_DB} + chat-service-scylla: + image: scylladb/scylla ports: - - 1935:1935 - - 8080:80 - app-postgres: - image: postgres:9.6 - ports: - - '5433:5432' - environment: - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - - POSTGRES_DB=${POSTGRES_DB} + - 7000:7000 + - 7001:7001 + - 9042:9042 + - 9160:9160 + - 10000:10000 kratos-migrate: image: oryd/kratos:v0.10.1 environment: diff --git a/go.mod b/go.mod index 5e277eb..262985a 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,34 @@ module twitch-clone go 1.19 require ( - github.com/labstack/echo/v4 v4.9.1 // indirect + github.com/bwmarrin/snowflake v0.3.0 + github.com/go-playground/validator/v10 v10.11.1 + github.com/gocql/gocql v1.2.1 + github.com/joho/godotenv v1.4.0 + github.com/labstack/echo/v4 v4.9.1 + github.com/olahol/melody v1.1.1 + github.com/scylladb/gocqlx/v2 v2.7.0 +) + +require ( + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/gorilla/websocket v1.5.0 // indirect + github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect github.com/labstack/gommon v0.4.0 // indirect + github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-colorable v0.1.11 // indirect github.com/mattn/go-isatty v0.0.14 // indirect + github.com/scylladb/go-reflectx v1.0.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect - golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect - golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect + golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect + golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect golang.org/x/sys v0.0.0-20211103235746-7861aae1554b // indirect golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect ) diff --git a/go.sum b/go.sum index 459d022..567c45b 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,103 @@ +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= +github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= +github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/gocql/gocql v1.2.1 h1:G/STxUzD6pGvRHzG0Fi7S04SXejMKBbRZb7pwre1edU= +github.com/gocql/gocql v1.2.1/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= +github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= +github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= +github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo/v4 v4.9.1 h1:GliPYSpzGKlyOhqIbG8nmHBo3i1saKWFOgh41AN3b+Y= github.com/labstack/echo/v4 v4.9.1/go.mod h1:Pop5HLc+xoc4qhTZ1ip6C0RtP7Z+4VzRLWZZFKqbbjo= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/olahol/melody v1.1.1 h1:amgBhR7pDY0rA0JHWprgLF0LnVztognAwEQgf/WYLVM= +github.com/olahol/melody v1.1.1/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/scylladb/go-reflectx v1.0.1 h1:b917wZM7189pZdlND9PbIJ6NQxfDPfBvUaQ7cjj1iZQ= +github.com/scylladb/go-reflectx v1.0.1/go.mod h1:rWnOfDIRWBGN0miMLIcoPt/Dhi2doCMZqwMCJ3KupFc= +github.com/scylladb/gocqlx/v2 v2.7.0 h1:/w1VeJHCEAsg9eTculTvIS9eIe/VmEu0clhlH1CF7lc= +github.com/scylladb/gocqlx/v2 v2.7.0/go.mod h1:jKhM0/LkEAhEOSwd10TCMQdlC5x8aEzK7cXjQcPyMJ0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b h1:1VkfZQv42XQlA/jchYumAnv1UPo6RgF9rJFkTgZIxO4= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/main.go b/main.go deleted file mode 100644 index 5680263..0000000 --- a/main.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import ( - "twitch-clone/pkg/app" -) - -func main() { - app.Init() -}