重构白银节点分配方式,使用手动接口精确配置节点

This commit is contained in:
2025-12-08 14:22:30 +08:00
parent 9e237be21e
commit 983dbb4564
25 changed files with 651 additions and 630 deletions

4
pkg/env/env.go vendored
View File

@@ -36,7 +36,7 @@ var (
RedisPort = "6379"
RedisPassword = ""
BaiyinAddr = "http://103.139.212.110:9989"
BaiyinCloudUrl string
BaiyinTokenUrl string
IdenCallbackUrl string
@@ -115,7 +115,7 @@ func Init() {
errs = append(errs, parse(&RedisPort, "REDIS_PORT", true, nil))
errs = append(errs, parse(&RedisPassword, "REDIS_PASS", true, nil))
errs = append(errs, parse(&BaiyinAddr, "BAIYIN_ADDR", true, nil))
errs = append(errs, parse(&BaiyinCloudUrl, "BAIYIN_CLOUD_URL", false, nil))
errs = append(errs, parse(&BaiyinTokenUrl, "BAIYIN_TOKEN_URL", false, nil))
errs = append(errs, parse(&IdenCallbackUrl, "IDEN_CALLBACK_URL", false, nil))

View File

@@ -25,6 +25,15 @@ func ElseTo[A any, B any](a *A, f func(A) B) *B {
}
}
// 三元表达式
func Ternary[T any](condition bool, trueValue T, falseValue T) T {
if condition {
return trueValue
} else {
return falseValue
}
}
// ====================
// 指针
// ====================