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

3 years ago
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"
3 years ago
"sync"
)
var Config config.Config
func init() {
var err error
c.AddDriver(yaml.Driver)
err = c.LoadFiles("config.yml")
3 years ago
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()
3 years ago
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()
}()
3 years ago
wg.Wait()
}