Conversation
db50946 to
48d1add
Compare
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
|
自顶 |
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
|
自顶 |
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
|
自顶 |
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
|
自顶 |
a0384f4 to
0a04e9e
Compare
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
|
挖一下,已经rebase并适配新的unsafe特性 |
|
PRs go stale after 14d of inactivity. Stale PRs rot after an additional 3d of inactivity and eventually close. |
…ndant base64 encode/decode (fatedier#5198)
…tedier#5200) Fix two bugs in TCPGroup.Listen(): - Release acquired port when net.Listen fails to prevent port leak - Use realPort instead of port for net.Listen to ensure consistency between port manager records and actual listening port
…dier#5202) Fix connection leaks in multiple error paths across client and server: - server/proxy/http: close tmpConn when WithEncryption fails - client/proxy: close localConn when ProxyProtocol WriteTo fails - client/visitor/sudp: close visitorConn on all error paths in getNewVisitorConn - client/visitor/xtcp: close tunnelConn when WithEncryption fails - client/visitor/xtcp: close lConn when NewKCPConnFromUDP fails - pkg/plugin/client/unix_domain_socket: close localConn and connInfo.Conn when WriteTo fails, close connInfo.Conn when DialUnix fails - pkg/plugin/client/tls2raw: close tlsConn when Handshake or Dial fails
…edier#5203) - pkg/nathole/nathole.go: add pool.PutBuf(buf) on ReadFromUDP error and DecodeMessageInto error paths in waitDetectMessage - pkg/proto/udp/udp.go: add defer pool.PutBuf(buf) in writerFn to ensure buffer is returned when the goroutine exits
- pkg/util/net/websocket.go: store ln parameter in struct to prevent nil pointer panic when Addr() is called - pkg/auth/oidc.go: replace unsynchronized []string with map + RWMutex for subjectsFromLogin to fix data race across concurrent connections
…dier#5205) - pkg/transport/tls.go: check AppendCertsFromPEM return value and return clear error when CA file contains no valid PEM certificates - pkg/plugin/client/http2http.go: set ReadHeaderTimeout to 60s to match other plugins and prevent slow header attacks - pkg/plugin/client/http2https.go: same ReadHeaderTimeout fix
…e value copy (fatedier#5206) In AddPrefix, the loop `for _, p := range l.prefixes` creates a copy of each element. Assignments to p.Value and p.Priority only modify the local copy, not the original slice element, causing updates to existing prefixes to be silently lost. This affects client/service.go where AddPrefix is called with Name:"runID" on reconnection — the old runID value would persist in log output instead of being updated to the new one. Fix by using index-based access `l.prefixes[i]` to modify the original slice element, and add break since prefix names are unique.
…licate loop (fatedier#5207) The Run() method had two nearly identical loop blocks for registering custom domains and subdomain, with the same group/non-group registration logic copy-pasted (~30 lines of duplication). Consolidate by collecting all domains into a single slice first, then iterating once with the shared registration logic. Also fixes a minor inconsistency where the custom domain block used routeConfig.Domain in CanonicalAddr but the subdomain block used tmpRouteConfig.Domain.
…tedier#5208) Consolidate the separate custom-domain loop and subdomain block into a single unified loop, matching the pattern already applied to HTTPProxy in PR fatedier#5207. No behavioral change.
- strings.CutPrefix instead of HasPrefix+TrimPrefix (naming, legacy) - slices.Contains instead of manual loop (plugin/server) - min/max builtins instead of manual comparisons (nathole)
…atedier#5210) - slices.SortedFunc + maps.Values + cmp.Compare instead of manual map-to-slice collection + sort.Slice (source/aggregator.go) - strings.CutSuffix instead of HasSuffix+TrimSuffix, and deduplicate error handling in BandwidthQuantity.UnmarshalString (types/types.go)
…er#5212) * client/proxy: extract wrapWorkConn to deduplicate UDP/SUDP connection wrapping Move the repeated rate-limiting, encryption, and compression wrapping logic from UDPProxy and SUDPProxy into a shared BaseProxy.wrapWorkConn method, reducing ~18 lines of duplication in each proxy type. * client/proxy: unify work conn wrapping with pooled compression for all proxy types Refactor wrapWorkConn to accept encKey parameter and return (io.ReadWriteCloser, recycleFn, error), enabling HandleTCPWorkConnection to reuse the same limiter/encryption/compression pipeline. Switch all proxy types from WithCompression to WithCompressionFromPool. TCP non-plugin path calls recycleFn via defer after Join; plugin and UDP/SUDP paths skip recycle (objects are GC'd safely, per golib contract).
…atedier#5213) - Replace duplicate parseBasicAuth with existing httppkg.ParseBasicAuth - Extract buildDomains helper in BaseProxy for HTTP/HTTPS/TCPMux proxies - Extract toProxyStats helper to deduplicate ProxyStats construction - Extract startVisitorListener helper in BaseProxy for STCP/SUDP proxies - Extract acceptLoop helper in BaseVisitor for STCP/XTCP visitors
…atedier#5214) - pkg/nathole: add RLock when reading clientCfgs map in PreCheck path to prevent concurrent map read/write crash - server/proxy: fix error variable shadowing in GetWorkConnFromPool that could return a closed connection with nil error - pkg/util/net: check ListenUDP error before spawning goroutines and assign readConn to struct field so Close() works correctly
…fatedier#5217) Replace 10 positional parameters in NewControl() with a single SessionContext struct, matching the client-side pattern. This also eliminates the post-construction mutation of clientRegistry and removes two TODO comments.
…on (fatedier#5218) Extract closeProxy() helper to eliminate duplicated 4-step cleanup sequence (Close, PxyManager.Del, metrics, plugin notify) between worker() and CloseProxy(). Extract loginUserInfo() helper to eliminate 4 repeated plugin.UserInfo constructions using LoginMsg fields. Optimize worker() to snapshot and clear the proxies map under lock, then perform cleanup outside the lock to reduce lock hold time.
…fatedier#5219) Extract two shared helpers to eliminate duplicated code across STCP, SUDP, and XTCP visitors: - dialRawVisitorConn: handles ConnectServer + NewVisitorConn handshake (auth, sign key, 10s read deadline, error check) - wrapVisitorConn: handles encryption + pooled compression wrapping, returning a recycleFn for pool resource cleanup SUDP is upgraded from WithCompression to WithCompressionFromPool, aligning with the pooled compression used by STCP and XTCP.
…lookup (fatedier#5221) Remove 4 redundant pointer map write-backs in OpenConnection, CloseConnection, AddTrafficIn, and AddTrafficOut since the map stores pointers and mutations are already visible without reassignment. Optimize GetProxiesByTypeAndName from O(n) full map scan to O(1) direct map lookup by proxy name.
…ssues (fatedier#5222) * server/group: refactor group package with shared abstractions and fix concurrency issues Extract common patterns into reusable components: - groupRegistry[G]: generic concurrent map for group lifecycle management - baseGroup: shared plumbing for listener-based groups (TCP, HTTPS, TCPMux) - Listener: unified virtual listener replacing 3 identical implementations Fix concurrency issues: - Stale-pointer race: isCurrent check + errGroupStale + controller retry loops - Worker generation safety: pass realLn and acceptCh as params instead of reading mutable fields - Connection leak: close conn on worker panic recovery path - ABBA deadlock in HTTP UnRegister: consistent lock ordering (group.mu -> registry.mu) - Round-robin overflow in HTTPGroup: use unsigned modulo Add unit tests (17 tests) for registry, listener, and baseGroup. Add TCPMux group load balancing e2e test. * server/group: replace tautological assertion with require.NotPanics * server/group: remove blank line between doc comment and type declaration
…ss checks (fatedier#5223) Replace the fixed 500ms sleep after each frps startup in RunProcesses with a TCP dial-based readiness check that polls the server bind port. This reduces the e2e suite wall time from ~97s to ~43s. Also simplify the RunProcesses API to accept a single server template string instead of a slice, matching how every call site uses it.
…ier#5225) * test/e2e: optimize RunFrps/RunFrpc with process exit detection Refactor Process to track subprocess lifecycle via a done channel, replacing direct cmd.Wait() in Stop() to avoid double-Wait races. RunFrps/RunFrpc now use select on the done channel instead of fixed sleeps, allowing short-lived processes (verify, startup failures) to return immediately while preserving existing timeout behavior for long-running daemons. * test/e2e: guard Process against double-Start and Stop-before-Start Add started flag to prevent double-Start panics and allow Stop to return immediately when the process was never started. Use sync.Once for closing the done channel as defense-in-depth against double close.
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (10 files)
|
|
此PR似乎已无法正常变基到最新dev分支,将会重新创建 |
|
已重新创建为#5227 |
实现 #2468 ,可直接使用
sc.exe(cmd)/New-Service(powershell)/注册表将frps或frpc注册为服务(可使用LocalService、服务账户等提高安全性)计划实现:
golang.org/x/sys/windows/svc包,使frps和frpc符合Windows服务程序规范golang.org/x/sys/windows/svc/eventlog包,为Logger添加Windows事件日志后端(可使用Windows事件查看器查看)为每种日志输出添加独有的event ID(需要定义更多eid;需要改golib那边)暂时搁置-c的参数和install命令间需插入--;使用uninstall命令以卸载;会同时注册/移除事件源;需在管理员cmd/powershell中执行;默认使用LocalSystem身份,restricted模式使用NT AUTHORITY\LocalService和受限SID)