[优化] 添加 Relay frps 连接和代理计数字段,重构相关逻辑以支持监控和可观测性

This commit is contained in:
ryan
2026-06-01 14:26:43 +08:00
parent 394e3c4855
commit 054dc1a8a8
22 changed files with 716 additions and 26 deletions
+5 -1
View File
@@ -1,5 +1,9 @@
ARG VERSION=dev
FROM golang:1.25-alpine AS builder
ARG VERSION
WORKDIR /build
COPY openflared/go.mod openflared/go.sum ./
@@ -8,7 +12,7 @@ RUN go mod download
COPY openflare_server/ ../openflare_server/
COPY openflared/ .
RUN CGO_ENABLED=0 GOOS=linux go build -o flared ./cmd/flared
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w -X 'openflare-flared/internal/config.Version=$VERSION'" -o flared ./cmd/flared
# Final runtime image
FROM fatedier/frpc:v0.69.0
+3
View File
@@ -0,0 +1,3 @@
package config
var Version = "dev"
+1 -1
View File
@@ -46,7 +46,7 @@ func (s *Service) doHeartbeat(ctx context.Context) {
slog.Debug("sending flared heartbeat")
payload := service.FlaredHeartbeatPayload{
ClientVersion: "0.1.0", // TODO dynamically inject build version
ClientVersion: config.Version,
FrpVersion: s.frpcManager.GetVersion(),
TunnelStatus: "running", // TODO implement proper status tracking
ConnectedRelays: s.frpcManager.GetConnectedRelays(),