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.
43 lines
602 B
Go
43 lines
602 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
c "github.com/gookit/config/v2"
|
|
"github.com/gookit/config/v2/yaml"
|
|
"live-gateway/bilibili"
|
|
"live-gateway/config"
|
|
"sync"
|
|
)
|
|
|
|
var Config config.Config
|
|
|
|
func init() {
|
|
var err error
|
|
|
|
c.AddDriver(yaml.Driver)
|
|
err = c.LoadFiles("config.yaml")
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = c.BindStruct("", &Config)
|
|
if err != nil {
|
|
return
|
|
}
|
|
fmt.Printf("%+v\n", Config)
|
|
}
|
|
|
|
func main() {
|
|
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.Wait()
|
|
}
|