You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
779 B
Go
53 lines
779 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
c "github.com/gookit/config/v2"
|
|
"github.com/gookit/config/v2/yaml"
|
|
"live-gateway/bilibili"
|
|
"live-gateway/config"
|
|
"live-gateway/logger"
|
|
"live-gateway/mq"
|
|
"sync"
|
|
)
|
|
|
|
var Config config.Config
|
|
|
|
func init() {
|
|
var err error
|
|
|
|
c.AddDriver(yaml.Driver)
|
|
err = c.LoadFiles("config.yml")
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = c.BindStruct("", &Config)
|
|
if err != nil {
|
|
return
|
|
}
|
|
fmt.Printf("%+v\n", Config)
|
|
}
|
|
|
|
func main() {
|
|
_ = logger.InitLogger(&Config.Log.File, &Config.Log.Console)
|
|
defer logger.Sync()
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
bLive := bilibili.NewLiveBilibili(&Config.Bilibili)
|
|
wg.Add(1)
|
|
go func() {
|
|
if err := bLive.Serve(); err != nil {
|
|
wg.Done()
|
|
panic(err)
|
|
}
|
|
}()
|
|
|
|
wg.Add(1)
|
|
go func() {
|
|
go mq.NewConsumer()
|
|
}()
|
|
|
|
wg.Wait()
|
|
}
|