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,46 @@
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 = [
"convey-test.toml",
"credit-test.toml",
],
importpath = "go-common/app/interface/main/credit/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/main/credit/conf:go_default_library",
"//app/interface/main/credit/http: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,188 @@
# This is a TOML document. Boom.
version = "1.0.0"
[host]
MessageURI = "http://message.bilibili.co"
BigDataURI = "http://172.18.33.147:3000"
APICoURI = "http://api.bilibili.co"
ManagersURI = "http://manager.bilibili.co"
[app]
key = "903f486ae7dc87fa"
secret = "6b03fa3e00334166ba3659e2c04201fc"
[xlog]
dir = "/data/log/credit/"
[bm]
[bm.inner]
addr = "0.0.0.0:6827"
maxListen = 10
timeout="1s"
[bm.local]
addr = "0.0.0.0:6828"
maxListen = 10
timeout="1s"
[httpClient]
key = "903f486ae7dc87fa"
secret = "6b03fa3e00334166ba3659e2c04201fc"
dial = "1s"
timeout = "2s"
keepAlive = "60s"
[httpClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[rpcClient2]
[rpcClient2.account]
timeout = "1s"
[rpcClient2.filter]
timeout = "1s"
[rpcClient2.Archive]
timeout = "1s"
[rpcClient2.member]
timeout = "1s"
[grpcClient]
[grpcClient.filter]
dial = "1s"
timeout = "1s"
[identify]
whiteAccessKey = "a2a1eb0ac97d6ba08b85aa0151528f34"
whiteMid = 23675773
csrf = false
[identify.app]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
[identify.memcache]
name = "go-business/identify"
proto = "tcp"
addr = "172.16.33.54:11211"
active = 5
idle = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
[identify.host]
auth = "http://uat-passport.bilibili.co"
secret = "http://uat-open.bilibili.co"
[identify.httpClient]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "1s"
timeout = "1s"
keepAlive = "60s"
[identify.httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[identify.httpClient.url]
"http://uat-passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "100ms"}
"http://uat-passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
"http://uat-open.bilibili.co/api/getsecret" = {timeout = "500ms"}
[mysql]
addr = "172.16.33.205:3306"
dsn = "blocked:mUdFycLKSbvPgdE28lCveqN77SqsGOmy@tcp(172.16.33.205:3306)/blocked?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
IdleTimeout ="4h"
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "5s"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:11211"
idle = 5
active = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
userexpire = "5m"
mincommonexpire = "10m"
commonexpire = "24h"
[redis]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:6379"
idle = 5
active = 5
dialTimeout = "500ms"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
expire = "10m"
[judge]
confTimer="120s"
ReservedTime = "600s"
LoadManagerTime = "1h"
[DataBus]
key = "0QEO9F8JuuIxZzNDvklH"
secret = "0QEO9F8JuuIxZzNDvklI"
group = "AccLabour-Labour-P"
topic = "AccLabour-T"
action = "pub"
name = "credit/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
idle = 5
active = 5
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[antispam]
on=true
second=2
n=1
hour=12
m=5
[antispam.redis]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:6379"
idle = 5
active = 5
dialTimeout = "500ms"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
expire = "10m"
[tagID]
reply = 42
dm = 43
msg = 44
tag = 45
member = 46
archive = 47
music = 48
article = 49
spacetop = 50
[property]
qsnum = 40
perscore = 5

View File

@@ -0,0 +1,190 @@
# This is a TOML document. Boom.
version = "1.0.0"
[host]
MessageURI = "http://message.bilibili.co"
BigDataURI = "http://172.18.33.147:3000"
APICoURI = "http://api.bilibili.co"
ManagersURI = "http://manager.bilibili.co"
[app]
key = "903f486ae7dc87fa"
secret = "6b03fa3e00334166ba3659e2c04201fc"
[xlog]
dir = "/data/log/credit/"
[bm]
[bm.inner]
addr = "0.0.0.0:6827"
maxListen = 10
timeout="1s"
[bm.local]
addr = "0.0.0.0:6828"
maxListen = 10
timeout="1s"
[httpClient]
key = "903f486ae7dc87fa"
secret = "6b03fa3e00334166ba3659e2c04201fc"
dial = "1s"
timeout = "2s"
keepAlive = "60s"
[httpClient.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[rpcClient2]
[rpcClient2.account]
timeout = "1s"
[rpcClient2.filter]
timeout = "1s"
[rpcClient2.Archive]
timeout = "1s"
[rpcClient2.member]
timeout = "1s"
[grpcClient]
[grpcClient.filter]
dial = "1s"
timeout = "1s"
[identify]
whiteAccessKey = "a2a1eb0ac97d6ba08b85aa0151528f34"
whiteMid = 23675773
csrf = false
[identify.app]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
[identify.memcache]
name = "go-business/identify"
proto = "tcp"
addr = "172.16.33.54:11211"
active = 5
idle = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
[identify.host]
auth = "http://uat-passport.bilibili.co"
secret = "http://uat-open.bilibili.co"
[identify.httpClient]
key = "e7482d29be4a95b8"
secret = "9e803791cdef756e75faee68e12b7442"
dial = "1s"
timeout = "1s"
keepAlive = "60s"
[identify.httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[identify.httpClient.url]
"http://uat-passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "100ms"}
"http://uat-passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
"http://uat-open.bilibili.co/api/getsecret" = {timeout = "500ms"}
[mysql]
addr = "172.16.33.205:3306"
dsn = "blocked:mUdFycLKSbvPgdE28lCveqN77SqsGOmy@tcp(172.16.33.205:3306)/blocked?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 2
IdleTimeout ="4h"
queryTimeout = "1s"
execTimeout = "1s"
tranTimeout = "5s"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:11211"
idle = 5
active = 5
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
userexpire = "5m"
mincommonexpire = "10m"
commonexpire = "24h"
[redis]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:6379"
idle = 5
active = 5
dialTimeout = "500ms"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
expire = "10m"
[judge]
confTimer="120s"
ReservedTime = "600s"
LoadManagerTime = "1h"
[DataBus]
key = "0QEO9F8JuuIxZzNDvklH"
secret = "0QEO9F8JuuIxZzNDvklI"
group = "AccLabour-Labour-P"
topic = "AccLabour-T"
action = "pub"
name = "credit/databus"
proto = "tcp"
addr = "172.16.33.158:6205"
idle = 5
active = 5
dialTimeout = "1s"
readTimeout = "60s"
writeTimeout = "1s"
idleTimeout = "10s"
[antispam]
on=true
second=2
n=1
hour=12
m=5
[antispam.redis]
name = "credit"
proto = "tcp"
addr = "172.16.33.54:6379"
idle = 5
active = 5
dialTimeout = "500ms"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "80s"
expire = "10m"
[tagID]
reply = 42
dm = 43
msg = 44
tag = 45
member = 46
archive = 47
music = 48
article = 49
spacetop = 50
[property]
qsnum = 40
perscore = 5

View File

@@ -0,0 +1,48 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/interface/main/credit/conf"
"go-common/app/interface/main/credit/http"
ecode "go-common/library/ecode/tip"
"go-common/library/log"
"go-common/library/net/trace"
)
func main() {
flag.Parse()
// init conf,log,trace,stat,perf.
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Xlog)
defer log.Close()
trace.Init(conf.Conf.Tracer)
defer trace.Close()
// service init
ecode.Init(conf.Conf.Ecode)
http.Init(conf.Conf)
// signal handler
log.Info("credit start")
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("credit get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
time.Sleep(time.Second * 2)
log.Info("credit exit")
return
case syscall.SIGHUP:
// TODO reload
default:
return
}
}
}