Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View 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/xcaptcha/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/live/xcaptcha/conf:go_default_library",
"//app/service/live/xcaptcha/server/grpc:go_default_library",
"//app/service/live/xcaptcha/server/http:go_default_library",
"//app/service/live/xcaptcha/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"],
)

View File

@@ -0,0 +1,49 @@
package main
import (
"flag"
"go-common/app/service/live/xcaptcha/conf"
"go-common/app/service/live/xcaptcha/server/grpc"
"go-common/app/service/live/xcaptcha/server/http"
"go-common/app/service/live/xcaptcha/service"
ecode "go-common/library/ecode/tip"
"go-common/library/log"
"go-common/library/net/trace"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Log)
defer log.Close()
log.Info("xcaptcha-service start")
trace.Init(conf.Conf.Tracer)
defer trace.Close()
ecode.Init(conf.Conf.Ecode)
svc := service.New(conf.Conf)
http.Init(conf.Conf)
grpc.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("xcaptcha-service exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,53 @@
[redis]
name = "xcaptcha"
proto = "tcp"
addr = "127.0.0.1:6379"
idle = 10
active = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "1m"
[databus]
[databus.captchaAnti]
key = "ec4c0820d525d67b"
secret= "e20f8f664bf10722efeb6aac0cc16011"
group = "CaptchaAnti-LiveLive-P"
topic = "CaptchaAnti-T"
action = "pub"
buffer = 1024
name = "live.xcaptcha"
proto = "tcp"
addr = "172.18.33.50:6205"
idle = 1
active = 1
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[geeTest]
on = 1
id = "902f4c9b1b89198603fd65bf5a72553e"
key = "1e37837a105a80fb52150ad2d72bc114"
Timeout = 500
Qps = 100
Slice = 10
[geeTest.Get]
Timeout = 400
KeepAlive = 60
[geeTest.Post]
Timeout = 50
KeepAlive = 60
[logStream]
LogId = "001741"
Token = "1234567844"
Address = "172.18.33.125:15140"
Capacity = 10240
Timeout = "5s"
[liverpc]
[liverpc.captcha]
Addr = "172.22.37.80:20825"
[log]
stdout = true