[PR #5213] [MERGED] deduplicate common logic across proxy, visitor, and metrics modules #5178

Closed
opened 2026-05-05 14:56:09 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/5213
Author: @fatedier
Created: 3/7/2026
Status: Merged
Merged: 3/7/2026
Merged by: @fatedier

Base: devHead: new


📝 Commits (1)

  • 0a820af deduplicate common logic across proxy, visitor, and metrics modules

📊 Changes

11 files changed (+74 additions, -177 deletions)

View changed files

📝 client/visitor/stcp.go (+2 -26)
📝 client/visitor/visitor.go (+12 -0)
📝 client/visitor/xtcp.go (+2 -26)
📝 pkg/metrics/mem/server.go (+22 -49)
📝 pkg/util/vhost/http.go (+1 -19)
📝 server/proxy/http.go (+1 -9)
📝 server/proxy/https.go (+1 -9)
📝 server/proxy/proxy.go (+30 -0)
📝 server/proxy/stcp.go (+1 -15)
📝 server/proxy/sudp.go (+1 -15)
📝 server/proxy/tcpmux.go (+1 -9)

📄 Description

Summary

  • Replace duplicate parseBasicAuth in pkg/util/vhost/http.go with existing httppkg.ParseBasicAuth
  • Extract buildDomains helper in BaseProxy for HTTP/HTTPS/TCPMux domain construction
  • Extract toProxyStats helper to deduplicate ProxyStats struct construction in metrics
  • Extract startVisitorListener helper in BaseProxy for STCP/SUDP visitor proxy setup
  • Extract acceptLoop helper in BaseVisitor for STCP/XTCP connection accept loops

11 files changed, 74 insertions(+), 177 deletions(-) — net -103 lines

Test plan

  • make build passes
  • make test passes
  • make fmt / make vet clean
  • Reviewed by 3 independent agents (correctness, naming, style)
  • Reviewed by Codex — no findings

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/5213 **Author:** [@fatedier](https://github.com/fatedier) **Created:** 3/7/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@fatedier](https://github.com/fatedier) **Base:** `dev` ← **Head:** `new` --- ### 📝 Commits (1) - [`0a820af`](https://github.com/fatedier/frp/commit/0a820aff462d3eb582d4cb48c7ed710ad191608a) deduplicate common logic across proxy, visitor, and metrics modules ### 📊 Changes **11 files changed** (+74 additions, -177 deletions) <details> <summary>View changed files</summary> 📝 `client/visitor/stcp.go` (+2 -26) 📝 `client/visitor/visitor.go` (+12 -0) 📝 `client/visitor/xtcp.go` (+2 -26) 📝 `pkg/metrics/mem/server.go` (+22 -49) 📝 `pkg/util/vhost/http.go` (+1 -19) 📝 `server/proxy/http.go` (+1 -9) 📝 `server/proxy/https.go` (+1 -9) 📝 `server/proxy/proxy.go` (+30 -0) 📝 `server/proxy/stcp.go` (+1 -15) 📝 `server/proxy/sudp.go` (+1 -15) 📝 `server/proxy/tcpmux.go` (+1 -9) </details> ### 📄 Description ## Summary - Replace duplicate `parseBasicAuth` in `pkg/util/vhost/http.go` with existing `httppkg.ParseBasicAuth` - Extract `buildDomains` helper in `BaseProxy` for HTTP/HTTPS/TCPMux domain construction - Extract `toProxyStats` helper to deduplicate `ProxyStats` struct construction in metrics - Extract `startVisitorListener` helper in `BaseProxy` for STCP/SUDP visitor proxy setup - Extract `acceptLoop` helper in `BaseVisitor` for STCP/XTCP connection accept loops 11 files changed, 74 insertions(+), 177 deletions(-) — net **-103 lines** ## Test plan - [x] `make build` passes - [x] `make test` passes - [x] `make fmt` / `make vet` clean - [x] Reviewed by 3 independent agents (correctness, naming, style) - [x] Reviewed by Codex — no findings --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:56:09 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#5178
No description provided.