Compare commits
26 Commits
972dc9d90f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2850fc7cd8 | |||
| df59ebf0b4 | |||
| 74a06e9982 | |||
| caf99f962e | |||
| f11eadb0e8 | |||
| ed87f5a72e | |||
| e00b0be83d | |||
| cbf98bf556 | |||
| b648ee3d92 | |||
| 907980c85c | |||
| 75b8c315db | |||
| 8b5cdd1f93 | |||
| bcc53fab01 | |||
| ec3182db40 | |||
| 0ef2a5d426 | |||
| 9b2d0874fb | |||
| 6f9f40c6f5 | |||
| e611074cac | |||
| 92c4915304 | |||
| 99720e194d | |||
| a0b66c635f | |||
| 1469418579 | |||
| 6e14bbc09f | |||
| 8a78344eb7 | |||
| f53659579e | |||
| e1c22c5132 |
34
.gitea/workflows/deploy.yml
Normal file
34
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: 全局K3s部署
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# 从组织级Secrets读取,不用在仓库重复配置
|
||||
K3S_HOST: ${{ secrets.K3S_HOST }}
|
||||
APP_NAME: ${{ gitea.repo_name }}
|
||||
steps:
|
||||
- name: 拉取代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: SSH部署K3s
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
# 写入组织配置的SSH私钥
|
||||
echo "${{ secrets.K3S_SSH_KEY }}" > k3s.pem
|
||||
chmod 600 k3s.pem
|
||||
# 调试:验证私钥是否正确写入
|
||||
echo "私钥文件权限:"
|
||||
ls -l k3s.pem
|
||||
echo "私钥头部(仅前5行):"
|
||||
head -5 k3s.pem
|
||||
# 测试连接(会输出服务器主机名和kubectl版本)
|
||||
ssh -i k3s.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 root@${K3S_HOST} "hostname && kubectl version --client"
|
||||
# 正式执行部署命令
|
||||
ssh -i k3s.pem -o StrictHostKeyChecking=no root@${K3S_HOST} << CMD
|
||||
kubectl apply -f /k8s/deploy.yaml
|
||||
kubectl rollout restart deployment ${APP_NAME}
|
||||
CMD
|
||||
40
Dockerfile
40
Dockerfile
@@ -1,53 +1,43 @@
|
||||
# 阶段1: 构建
|
||||
FROM golang:1.26-alpine AS builder
|
||||
# 多阶段构建 - 第一阶段:编译(使用已安装的镜像)
|
||||
FROM golang:1.26-alpine3.23 AS builder
|
||||
|
||||
RUN apk add --no-cache git ca-certificates tzdata
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOTOOLCHAIN=auto
|
||||
ENV GOPRIVATE=gitea.com/red-future/common
|
||||
|
||||
# 配置git使用私有Gitea仓库
|
||||
RUN git config --global url."http://116.204.74.41:3000/red-future/common.git".insteadOf "https://gitea.com/red-future/common.git" && \
|
||||
# 配置git使用私有Gitea仓库(带Token认证)
|
||||
RUN git config --global url."http://x-token-auth:619679cd366aefea3a50f0622d842a41f2209e08595767bba49c3836ef57d415@116.204.74.41:3000/red-future/common.git".insteadOf "https://gitea.com/red-future/common.git" && \
|
||||
git config --global credential.helper store
|
||||
|
||||
# 设置GIT凭据
|
||||
RUN echo "http://x-token-auth:9b31146aa8c10a7cb4f2e49dcee0934a223be1076289810e1ad98b968066c2bc@116.204.74.41:3000" > ~/.git-credentials
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY main.go ./
|
||||
COPY config.yml ./
|
||||
# 复制父目录的 common 模块(因为 go.mod 中使用了本地 replace)
|
||||
#COPY ../common /build/common
|
||||
COPY . .
|
||||
|
||||
RUN go mod download && go mod tidy
|
||||
|
||||
RUN go build -ldflags="-s -w" -o main ./main.go
|
||||
|
||||
# 阶段2: 运行
|
||||
FROM alpine:3.19
|
||||
# 第二阶段:运行
|
||||
FROM alpine:3.23
|
||||
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
ENV TIME_ZONE=Asia/Shanghai
|
||||
RUN apk add --no-cache ca-certificates tzdata && \
|
||||
ln -sf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制编译好的二进制文件
|
||||
COPY --from=builder /build/main .
|
||||
COPY --from=builder /build/config.yml ./
|
||||
|
||||
RUN mkdir -p /app/resource/log/run \
|
||||
/app/resource/log/server \
|
||||
&& adduser -D -u 1000 appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
USER appuser
|
||||
# 创建日志目录
|
||||
RUN mkdir -p /logs /app/resource/log/run /app/resource/log/server
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
166
config-dev.yml
Normal file
166
config-dev.yml
Normal file
@@ -0,0 +1,166 @@
|
||||
server:
|
||||
address : ":8000"
|
||||
name: "gateway"
|
||||
rate:
|
||||
limit: 800
|
||||
burst: 2000
|
||||
# IP限流配置
|
||||
ip:
|
||||
limit: 100 # IP限流: 100 req/s
|
||||
burst: 200 # IP突发: 200
|
||||
# 用户限流配置
|
||||
user:
|
||||
limit: 50 # 已登录用户: 50 req/s
|
||||
burst: 100 # 已登录用户突发: 100
|
||||
# 服务维度限流配置
|
||||
services:
|
||||
# 高频业务服务 - 需要更高配置
|
||||
customerService:
|
||||
limit: 500 # 客服服务: 500 req/s (高频对话)
|
||||
burst: 700 # 突发: 700
|
||||
order:
|
||||
limit: 450 # 订单服务: 450 req/s (高频交易)
|
||||
burst: 600 # 突发: 600
|
||||
assets:
|
||||
limit: 400 # 资产服务: 400 req/s (高频访问)
|
||||
burst: 600 # 突发: 600 (有Stream削峰)
|
||||
cid:
|
||||
limit: 350 # 证书服务: 350 req/s (高频证书请求)
|
||||
burst: 500 # 突发: 500
|
||||
|
||||
# 中频基础服务
|
||||
oss:
|
||||
limit: 300 # 文件服务: 300 req/s (通用文件上传,可能被多个服务调用)
|
||||
burst: 450 # 突发: 450
|
||||
|
||||
# 低频业务服务
|
||||
wallet:
|
||||
limit: 120 # 钱包服务: 120 req/s (低频转账)
|
||||
burst: 200 # 突发: 200
|
||||
market:
|
||||
limit: 100 # 市场服务: 100 req/s (低频交易)
|
||||
burst: 180 # 突发: 180
|
||||
knapsack:
|
||||
limit: 80 # 背包服务: 80 req/s (低频功能)
|
||||
burst: 150 # 突发: 150
|
||||
|
||||
# 熔断器配置 - 每个服务独立配置
|
||||
circuitBreaker:
|
||||
# 高频业务服务 - 更严格的熔断策略
|
||||
customerService:
|
||||
enabled: true # 是否启用熔断器
|
||||
maxFailures: 5 # 连续失败5次触发熔断
|
||||
timeout: 30s # 30秒后尝试恢复
|
||||
successStatusCodes: 200,201,204 # 视为成功的HTTP状态码
|
||||
slowRequestThreshold: 3s # 慢请求阈值(超过此时间视为失败)
|
||||
enableSlidingWindow: true # 是否启用滑动窗口
|
||||
failureRateThreshold: 0.5 # 失败率阈值(0.0-1.0)
|
||||
enableFallback: false # 是否启用降级
|
||||
fallbackMessage: "" # 降级提示消息
|
||||
requestTimeout: 30000 # 请求超时时间(毫秒),0表示不设置
|
||||
distributedTTL: 300 # 分布式熔断状态TTL(秒),0表示不启用分布式熔断
|
||||
statIntervalMs: 1000 # 统计窗口时长(毫秒),默认1000ms
|
||||
minRequestAmount: 5 # 最小请求数量,默认与maxFailures相同
|
||||
order:
|
||||
enabled: true
|
||||
maxFailures: 3 # 订单服务更敏感
|
||||
timeout: 60s # 60秒后尝试恢复
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 2s # 订单服务要求更快的响应
|
||||
enableSlidingWindow: true
|
||||
failureRateThreshold: 0.6 # 订单服务对失败率更敏感
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 300
|
||||
assets:
|
||||
enabled: true
|
||||
maxFailures: 10 # 资产服务更宽松
|
||||
timeout: 60s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 5s # 资产服务可能较慢,给更多时间
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
cid:
|
||||
enabled: true
|
||||
maxFailures: 8
|
||||
timeout: 45s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
|
||||
# 中频基础服务
|
||||
oss:
|
||||
enabled: true
|
||||
maxFailures: 15
|
||||
timeout: 120s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 10s # 文件上传可能较慢
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 60000 # 文件服务可能需要更长时间
|
||||
distributedTTL: 0
|
||||
|
||||
# 低频业务服务 - 最宽松的熔断策略
|
||||
wallet:
|
||||
enabled: true
|
||||
maxFailures: 5
|
||||
timeout: 120s # 2分钟
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 5s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: true # 启用降级
|
||||
fallbackMessage: "钱包服务暂时繁忙,请稍后再试" # 降级提示消息
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 300 # 钱包服务启用分布式熔断
|
||||
adminIPs: "127.0.0.1,116.204.74.41" # 允许重置熔断器的管理员IP列表(逗号分隔)
|
||||
market:
|
||||
enabled: true
|
||||
maxFailures: 5
|
||||
timeout: 90s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
knapsack:
|
||||
enabled: false # 背包服务暂时不启用熔断
|
||||
maxFailures: 5
|
||||
timeout: 90s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
|
||||
redis:
|
||||
# 集群模式配置方法
|
||||
default:
|
||||
address: 116.204.74.41:6379
|
||||
db: 0
|
||||
idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/1m/1d
|
||||
maxConnLifetime: "90s" #连接最长存活时间,使用时间字符串例如30s/1m/1d
|
||||
waitTimeout: "60s" #等待连接池连接的超时时间,使用时间字符串例如30s/1m/1d
|
||||
dialTimeout: "30s" #TCP连接的超时时间,使用时间字符串例如30s/1m/1d
|
||||
readTimeout: "30s" #TCP的Read操作超时时间,使用时间字符串例如30s/1m/1d
|
||||
writeTimeout: "30s" #TCP的Write操作超时时间,使用时间字符串例如30s/1m/1d
|
||||
maxActive: 100
|
||||
consul:
|
||||
address: 116.204.74.41:8500
|
||||
services:
|
||||
- name: customerService
|
||||
- name: test111
|
||||
jaeger: #链路追踪
|
||||
addr: 116.204.74.41:4318
|
||||
166
config-master.yml
Normal file
166
config-master.yml
Normal file
@@ -0,0 +1,166 @@
|
||||
server:
|
||||
address : ":8000"
|
||||
name: "gateway"
|
||||
rate:
|
||||
limit: 800
|
||||
burst: 2000
|
||||
# IP限流配置
|
||||
ip:
|
||||
limit: 100 # IP限流: 100 req/s
|
||||
burst: 200 # IP突发: 200
|
||||
# 用户限流配置
|
||||
user:
|
||||
limit: 50 # 已登录用户: 50 req/s
|
||||
burst: 100 # 已登录用户突发: 100
|
||||
# 服务维度限流配置
|
||||
services:
|
||||
# 高频业务服务 - 需要更高配置
|
||||
customerService:
|
||||
limit: 500 # 客服服务: 500 req/s (高频对话)
|
||||
burst: 700 # 突发: 700
|
||||
order:
|
||||
limit: 450 # 订单服务: 450 req/s (高频交易)
|
||||
burst: 600 # 突发: 600
|
||||
assets:
|
||||
limit: 400 # 资产服务: 400 req/s (高频访问)
|
||||
burst: 600 # 突发: 600 (有Stream削峰)
|
||||
cid:
|
||||
limit: 350 # 证书服务: 350 req/s (高频证书请求)
|
||||
burst: 500 # 突发: 500
|
||||
|
||||
# 中频基础服务
|
||||
oss:
|
||||
limit: 300 # 文件服务: 300 req/s (通用文件上传,可能被多个服务调用)
|
||||
burst: 450 # 突发: 450
|
||||
|
||||
# 低频业务服务
|
||||
wallet:
|
||||
limit: 120 # 钱包服务: 120 req/s (低频转账)
|
||||
burst: 200 # 突发: 200
|
||||
market:
|
||||
limit: 100 # 市场服务: 100 req/s (低频交易)
|
||||
burst: 180 # 突发: 180
|
||||
knapsack:
|
||||
limit: 80 # 背包服务: 80 req/s (低频功能)
|
||||
burst: 150 # 突发: 150
|
||||
|
||||
# 熔断器配置 - 每个服务独立配置
|
||||
circuitBreaker:
|
||||
# 高频业务服务 - 更严格的熔断策略
|
||||
customerService:
|
||||
enabled: true # 是否启用熔断器
|
||||
maxFailures: 5 # 连续失败5次触发熔断
|
||||
timeout: 30s # 30秒后尝试恢复
|
||||
successStatusCodes: 200,201,204 # 视为成功的HTTP状态码
|
||||
slowRequestThreshold: 3s # 慢请求阈值(超过此时间视为失败)
|
||||
enableSlidingWindow: true # 是否启用滑动窗口
|
||||
failureRateThreshold: 0.5 # 失败率阈值(0.0-1.0)
|
||||
enableFallback: false # 是否启用降级
|
||||
fallbackMessage: "" # 降级提示消息
|
||||
requestTimeout: 30000 # 请求超时时间(毫秒),0表示不设置
|
||||
distributedTTL: 300 # 分布式熔断状态TTL(秒),0表示不启用分布式熔断
|
||||
statIntervalMs: 1000 # 统计窗口时长(毫秒),默认1000ms
|
||||
minRequestAmount: 5 # 最小请求数量,默认与maxFailures相同
|
||||
order:
|
||||
enabled: true
|
||||
maxFailures: 3 # 订单服务更敏感
|
||||
timeout: 60s # 60秒后尝试恢复
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 2s # 订单服务要求更快的响应
|
||||
enableSlidingWindow: true
|
||||
failureRateThreshold: 0.6 # 订单服务对失败率更敏感
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 300
|
||||
assets:
|
||||
enabled: true
|
||||
maxFailures: 10 # 资产服务更宽松
|
||||
timeout: 60s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 5s # 资产服务可能较慢,给更多时间
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
cid:
|
||||
enabled: true
|
||||
maxFailures: 8
|
||||
timeout: 45s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
|
||||
# 中频基础服务
|
||||
oss:
|
||||
enabled: true
|
||||
maxFailures: 15
|
||||
timeout: 120s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 10s # 文件上传可能较慢
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 60000 # 文件服务可能需要更长时间
|
||||
distributedTTL: 0
|
||||
|
||||
# 低频业务服务 - 最宽松的熔断策略
|
||||
wallet:
|
||||
enabled: true
|
||||
maxFailures: 5
|
||||
timeout: 120s # 2分钟
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 5s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: true # 启用降级
|
||||
fallbackMessage: "钱包服务暂时繁忙,请稍后再试" # 降级提示消息
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 300 # 钱包服务启用分布式熔断
|
||||
adminIPs: "127.0.0.1,192.168.0.169" # 允许重置熔断器的管理员IP列表(逗号分隔)
|
||||
market:
|
||||
enabled: true
|
||||
maxFailures: 5
|
||||
timeout: 90s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
knapsack:
|
||||
enabled: false # 背包服务暂时不启用熔断
|
||||
maxFailures: 5
|
||||
timeout: 90s
|
||||
successStatusCodes: 200,201,204
|
||||
slowRequestThreshold: 3s
|
||||
enableSlidingWindow: false
|
||||
enableFallback: false
|
||||
fallbackMessage: ""
|
||||
requestTimeout: 30000
|
||||
distributedTTL: 0
|
||||
|
||||
redis:
|
||||
# 集群模式配置方法
|
||||
default:
|
||||
address: 192.168.0.169:6379
|
||||
db: 0
|
||||
idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/1m/1d
|
||||
maxConnLifetime: "90s" #连接最长存活时间,使用时间字符串例如30s/1m/1d
|
||||
waitTimeout: "60s" #等待连接池连接的超时时间,使用时间字符串例如30s/1m/1d
|
||||
dialTimeout: "30s" #TCP连接的超时时间,使用时间字符串例如30s/1m/1d
|
||||
readTimeout: "30s" #TCP的Read操作超时时间,使用时间字符串例如30s/1m/1d
|
||||
writeTimeout: "30s" #TCP的Write操作超时时间,使用时间字符串例如30s/1m/1d
|
||||
maxActive: 100
|
||||
consul:
|
||||
address: 192.168.0.169:8500
|
||||
services:
|
||||
- name: customerService
|
||||
- name: test111
|
||||
jaeger: #链路追踪
|
||||
addr: 192.168.0.169:4318
|
||||
17
go.mod
17
go.mod
@@ -3,10 +3,12 @@ module gateway
|
||||
go 1.26.0
|
||||
|
||||
require (
|
||||
gitea.com/red-future/common v0.0.11
|
||||
gitea.com/red-future/common v0.0.19
|
||||
github.com/gogf/gf/v2 v2.10.0
|
||||
)
|
||||
|
||||
//replace gitea.com/red-future/common v0.0.19 => ../common
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
@@ -23,6 +25,7 @@ require (
|
||||
github.com/emirpasic/gods/v2 v2.0.0-alpha // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/go-ego/gse v1.0.2 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
@@ -37,7 +40,7 @@ require (
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/flatbuffers v1.12.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
|
||||
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
|
||||
github.com/hashicorp/consul/api v1.26.1 // indirect
|
||||
@@ -64,12 +67,15 @@ require (
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.48.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/r3labs/diff/v2 v2.15.1 // indirect
|
||||
github.com/redis/go-redis/v9 v9.12.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||
github.com/tiger1103/gfast-token v1.0.10 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
github.com/vcaesar/cedar v0.30.0 // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||
go.mongodb.org/mongo-driver/v2 v2.4.0 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
@@ -81,9 +87,10 @@ require (
|
||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
|
||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
|
||||
google.golang.org/grpc v1.75.0 // indirect
|
||||
|
||||
46
go.sum
46
go.sum
@@ -1,7 +1,7 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
gitea.com/red-future/common v0.0.11 h1:AV7W3G0uZ8aPpHHSHd4ZHmLWe5+2STPKe/AYPoPCWVc=
|
||||
gitea.com/red-future/common v0.0.11/go.mod h1:B8syUI4XbLCDQSeRHURYxEwnWw8mEFgmqCxjC+lM+NU=
|
||||
gitea.com/red-future/common v0.0.19 h1:9/WrfCFUCeFUYwuhBYF+JOQi5F5xuOy+gVnf2ZvHZu4=
|
||||
gitea.com/red-future/common v0.0.19/go.mod h1:6/nqIucVzmjOyqDTIq71feYBXXFNBy0rFwzaQ0/Ueoo=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
@@ -102,6 +102,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-ego/gse v1.0.2 h1:+27lYFPhQEhA9igtdOsJPRKYL/k3TwYsxBF5jr6KFv4=
|
||||
github.com/go-ego/gse v1.0.2/go.mod h1:Fy35G+q7VV7Et1zIKO8o/sW1kkugV3znXap/lF/11zc=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
|
||||
@@ -184,8 +186,8 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
|
||||
github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4=
|
||||
github.com/grokify/html-strip-tags-go v0.1.0/go.mod h1:ZdzgfHEzAfz9X6Xe5eBLVblWIxXfYSQ40S/VKrAOGpc=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
@@ -403,6 +405,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
|
||||
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
||||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/r3labs/diff/v2 v2.15.1 h1:EOrVqPUzi+njlumoqJwiS/TgGgmZo83619FNDB9xQUg=
|
||||
github.com/r3labs/diff/v2 v2.15.1/go.mod h1:I8noH9Fc2fjSaMxqF3G2lhDdC0b+JXCfyx85tWFM9kc=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg=
|
||||
github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||
@@ -440,6 +444,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
@@ -454,6 +459,12 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/vcaesar/cedar v0.30.0 h1:9fSDpM7FTjjUdPiBUUa0MWYMRGSEcqgFXvppZcZ4d7Y=
|
||||
github.com/vcaesar/cedar v0.30.0/go.mod h1:lyuGvALuZZDPNXwpzv/9LyxW+8Y6faN7zauFezNsnik=
|
||||
github.com/vcaesar/tt v0.20.1 h1:D/jUeeVCNbq3ad8M7hhtB3J9x5RZ6I1n1eZ0BJp7M+4=
|
||||
github.com/vcaesar/tt v0.20.1/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
@@ -515,8 +526,8 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
|
||||
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
|
||||
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -540,8 +551,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -552,8 +563,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -592,15 +603,15 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
@@ -620,8 +631,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
|
||||
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
|
||||
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
|
||||
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -632,6 +643,9 @@ google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMt
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
|
||||
38
main.go
38
main.go
@@ -26,14 +26,14 @@ func StartServerProxy() {
|
||||
panic("熔断器初始化失败")
|
||||
}
|
||||
|
||||
// 绑定中间件:CORS -> IP限流 -> 用户限流 -> 熔断降级 -> 服务限流 -> 全局限流
|
||||
// 绑定中间件:CORS跨域 -> IP限流 -> 用户限流 -> 熔断降级 -> 服务限流 -> 全局限流
|
||||
http.Httpserver.BindMiddlewareDefault(
|
||||
ghttp.MiddlewareCORS,
|
||||
middleware.IPLimiter, // IP限流(防DDoS)
|
||||
middleware.UserLimiter, // 用户限流(防止单用户滥用)
|
||||
middleware.CircuitBreakerMiddleware, // ⭐ 熔断降级(保护后端服务)
|
||||
middleware.ServiceLimiter, // 服务限流(保护微服务)
|
||||
middleware.GlobalLimiter, // Redis全局限流(分布式支持)
|
||||
//middleware.IPLimiter, // IP限流(防DDoS)
|
||||
//middleware.UserLimiter, // 用户限流(防止单用户滥用)
|
||||
//middleware.CircuitBreakerMiddleware, // ⭐ 熔断降级(保护后端服务)
|
||||
//middleware.ServiceLimiter, // 服务限流(保护微服务)
|
||||
//middleware.GlobalLimiter, // Redis全局限流(分布式支持)
|
||||
) //使用默认http返回结构
|
||||
|
||||
// 熔断器健康检查接口
|
||||
@@ -59,6 +59,28 @@ func StartServerProxy() {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 1. 解析 consul 配置地址
|
||||
//consulAddr := g.Cfg().MustGet(r.GetCtx(), "consul.address").String()
|
||||
//consulAddrList := strings.Split(consulAddr, ":")
|
||||
//if len(consulAddrList) < 1 {
|
||||
// g.Log().Error(r.GetCtx(), "consul.address 配置格式错误")
|
||||
// r.Response.WriteJsonExit(map[string]interface{}{
|
||||
// "success": false,
|
||||
// "code": 500,
|
||||
// "message": fmt.Sprintf("consul.address 配置格式错误:%s", consulAddr),
|
||||
// })
|
||||
// return
|
||||
//}
|
||||
//ipStr := instanceAddr
|
||||
//if strings.Contains(instanceAddr, ":") {
|
||||
// ipStr = strings.Split(instanceAddr, ":")[0]
|
||||
//}
|
||||
//// 2. 如果不是本地IP,则替换为consul配置的IP
|
||||
//if !utils.IsLocalIP(ipStr) {
|
||||
// instanceAddr = strings.Replace(instanceAddr, ipStr, consulAddrList[0], 1)
|
||||
//}
|
||||
|
||||
r.Request.URL.Path = strings.Replace(r.Request.URL.Path, fmt.Sprintf("%s/", serverName), "", 1)
|
||||
r.MakeBodyRepeatableRead(false)
|
||||
u, _ := url.Parse(fmt.Sprintf("%s://%s", "http", instanceAddr))
|
||||
@@ -70,10 +92,10 @@ func StartServerProxy() {
|
||||
user, err := utils.GetUserInfo(r.GetCtx())
|
||||
if err != nil {
|
||||
g.Log().Errorf(r.GetCtx(), "获取用户信息失败: %v", err)
|
||||
r.Response.Status = 500
|
||||
r.Response.Status = 401
|
||||
r.Response.WriteJsonExit(map[string]interface{}{
|
||||
"success": false,
|
||||
"code": 500,
|
||||
"code": 401,
|
||||
"message": "获取用户信息失败",
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user