Create & Init Project...
This commit is contained in:
45
app/service/live/live-dm/cmd/BUILD
Normal file
45
app/service/live/live-dm/cmd/BUILD
Normal file
@ -0,0 +1,45 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "cmd",
|
||||
embed = [":go_default_library"],
|
||||
tags = ["automanaged"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["main.go"],
|
||||
data = ["test.toml"],
|
||||
importpath = "go-common/app/service/live/live-dm/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/service/live/live-dm/conf:go_default_library",
|
||||
"//app/service/live/live-dm/server/grpc:go_default_library",
|
||||
"//app/service/live/live-dm/server/http:go_default_library",
|
||||
"//app/service/live/live-dm/service:go_default_library",
|
||||
"//library/ecode/tip:go_default_library",
|
||||
"//library/log:go_default_library",
|
||||
"//library/net/trace:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
49
app/service/live/live-dm/cmd/main.go
Normal file
49
app/service/live/live-dm/cmd/main.go
Normal file
@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go-common/app/service/live/live-dm/conf"
|
||||
"go-common/app/service/live/live-dm/server/grpc"
|
||||
"go-common/app/service/live/live-dm/server/http"
|
||||
"go-common/app/service/live/live-dm/service"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
"go-common/library/net/trace"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := conf.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Init(conf.Conf.Log)
|
||||
defer log.Close()
|
||||
log.Info("dm-service start")
|
||||
trace.Init(conf.Conf.Tracer)
|
||||
defer trace.Close()
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
svc := service.New(conf.Conf)
|
||||
grpc.Init(conf.Conf)
|
||||
http.Init(conf.Conf)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
svc.Close()
|
||||
log.Info("dm-service exit")
|
||||
time.Sleep(time.Second)
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
118
app/service/live/live-dm/cmd/test.toml
Normal file
118
app/service/live/live-dm/cmd/test.toml
Normal file
@ -0,0 +1,118 @@
|
||||
[HTTPClient]
|
||||
key = "e7482d29be4a95b8"
|
||||
secret = "9e803791cdef756e75faee68e12b7442"
|
||||
dial = "100ms"
|
||||
timeout = "5s"
|
||||
keepAlive = "60s"
|
||||
[HTTPClient.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[Redis]
|
||||
name = "dm-service"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.171:6379"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "1m"
|
||||
|
||||
|
||||
[WhiteListRedis]
|
||||
name = "dm-service"
|
||||
proto = "tcp"
|
||||
addr = "172.16.38.166:10028"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "1m"
|
||||
|
||||
[BNJRoomList]
|
||||
544641 = true
|
||||
2233 = true
|
||||
|
||||
[BNDatabus]
|
||||
key = "ec4c0820d525d67b"
|
||||
secret = "e20f8f664bf10722efeb6aac0cc16011"
|
||||
group = "LiveDanmuSend-LiveLive-P"
|
||||
topic = "LiveDanmuSend-T"
|
||||
action = "pub"
|
||||
buffer = 128
|
||||
name = "live-dm/databus"
|
||||
proto = "tcp"
|
||||
addr = "172.16.33.50:6205"
|
||||
active = 1
|
||||
idle = 1
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
|
||||
[CacheDatabus]
|
||||
Size = 1024
|
||||
|
||||
[LiveRPC.bannedService]
|
||||
AppID = "live.bannedservice"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.room]
|
||||
AppID = "live.room"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.liveUser]
|
||||
AppID = "live.liveuser"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.activity]
|
||||
AppID = "live.activity"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.avService]
|
||||
AppID = "live.av"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.fansMedal]
|
||||
AppID = "live.fansmedal"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.rc]
|
||||
AppID = "live.rc"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.rankdbService]
|
||||
AppID = "live.rankdb"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.userext]
|
||||
AppID = "live.userext"
|
||||
ConnTimeout = "50ms"
|
||||
[LiveRPC.user]
|
||||
AppID = "live.user"
|
||||
ConnTimeout = "50ms"
|
||||
|
||||
|
||||
[DmRules]
|
||||
AreaLimit = false
|
||||
RealName = false
|
||||
PhoneLimit = true
|
||||
AllUserLimit = false
|
||||
LevelLimitStatus = false
|
||||
LevelLimit = -1
|
||||
MsgLength = 20
|
||||
DmNum = 20
|
||||
DMPercent = 25
|
||||
[DmRules.Nixiang]
|
||||
[DmRules.Color]
|
||||
|
||||
|
||||
[Lancer.DMsend]
|
||||
taskID = "000582"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.124:15140"
|
||||
chanSize = 10240
|
||||
|
||||
[Lancer.DMErr]
|
||||
taskID = "001409"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.124:15140"
|
||||
chanSize = 10240
|
Reference in New Issue
Block a user