ba8c746a2e
perf(matcher): eliminate heap allocations in RadixTree search with sync.Pool
...
RadixTree.searchLongest previously allocated &MatchResult{} on the
heap every time it encountered a handler-bearing node during tree
traversal — potentially N allocations per lookup with only 1 surviving.
Changes:
- searchLongest now tracks best *RadixNode (stack pointer) instead of
allocating MatchResult at every handler node
- FindLongestPrefix allocates a single pooled MatchResult via sync.Pool
only when returning a match
- Add ReleaseMatchResult() for callers to return MatchResult to pool
- LocationEngine.Match releases pooled results after use
Result: 0 B/op, 0 allocs/op on tree traversal benchmarks (sequential
and parallel).
2026-06-04 00:12:52 +08:00
d03c180f62
perf(loadbalance): replace failMu mutex with atomic operations in Target
...
Remove sync.Mutex from Target's failure tracking hot path:
- failCount int64 → atomic.Int64
- failedUntil int64 → atomic.Int64
- IsAvailable(): Load() instead of Lock/Unlock, eliminating mutex
from every per-target check in every LB Select() call
- RecordFailure(): Add(1) + Store() instead of Lock/Unlock
- RecordSuccess(): Store(0) instead of Lock/Unlock
This removes the only mutex acquisition in the load balancing
selection path. Every Select() call iterates targets and calls
IsAvailable() on each — previously acquiring failMu per target
when MaxFails > 0. Now fully lock-free.
2026-06-04 00:12:29 +08:00
d8a0818ab2
feat: add golang-pro agent skill
2026-06-04 00:07:55 +08:00
2ad056d0ca
fix(config): supplement missing fields and fix comments in -g template
...
Add missing fields to GenerateConfigYAML output:
- proxy.timeout.dial (TCP dial timeout)
- health_check.slow_start and health_check.match (status/body/headers)
- proxy.buffering.buffers (multi-buffer config)
- lua.scripts[].route and route_type (routing mode)
Fix coroutine_stack_size comment to show actual default (64).
2026-06-04 00:04:13 +08:00
9bdb8b24a7
chore: replace lib/ with others/ in gitignore
2026-06-03 23:49:52 +08:00
6612819f3a
chore: remove stale AGENTS.md files, rewrite root AGENTS.md
2026-06-03 23:47:29 +08:00
29752f62bd
fix: resolve golangci-lint issues across multiple packages
...
- stream: fix atomic.Int64 usage in tests and benchmarks
- server: fix errcheck, goconst ("tcp" -> constant), and govet shadow
- app: add missing ServerModeAuto case in requiresFullRestart
- lua: fix nolintlint unused directive warnings
- proxy: use `any` instead of `interface{}`
2026-06-03 18:17:07 +08:00
6f17bbad7e
chore: remove trailing blank lines and clean up whitespace
2026-06-03 18:08:34 +08:00
5ee83f6a69
refactor: extract common functions from server startup modes
2026-06-03 18:03:23 +08:00
c1796dadc5
refactor: eliminate redundant switch blocks in router.go LocationEngine functions
2026-06-03 17:54:51 +08:00
6e481c36c5
refactor: simplify CheckIPAccess by reusing IPInAllowList
2026-06-03 17:53:00 +08:00
66f608f25b
refactor: remove redundant generateETag wrappers, use utils.GenerateETag directly
2026-06-03 17:51:50 +08:00
ae3c167cd6
refactor: remove extractHostFromURL, use netutil.ParseTargetURL
2026-06-03 17:50:06 +08:00
041bc97578
refactor: remove unused code identified by staticcheck
2026-06-03 17:46:58 +08:00
13547ec63e
fix: use defaultMIME fallback in DetectContentType
2026-06-03 17:44:16 +08:00
a3b4507be0
refactor: remove unused variable pool statistics dead code
2026-06-03 17:42:48 +08:00
a3bc453fbf
refactor: remove unused stream SSL dead code
2026-06-03 17:41:14 +08:00
a919369ca4
refactor: remove dead code package internal/middleware/limitrate
2026-06-03 17:39:03 +08:00
5066a1a64c
feat(utils): add GetInternalRedirectPath function
2026-06-03 16:39:36 +08:00
1a6b5f9166
Merge origin/master into master
2026-06-03 16:36:23 +08:00
856b46fd6d
refactor: remove unused ParseTLSVersion and app setter tests
...
- Remove sslutil.ParseTLSVersion (singular): unused, ParseTLSVersions (plural) is used
- Remove TestSetPidFile and TestSetLogFile: trivial setter tests
2026-06-03 16:32:15 +08:00
d0867bfe3e
refactor(lua): remove unused mock engine and filter writer subsystem
...
- Delete mock_engine.go (331 lines): unused MockLuaEngine/MockCoroutine
- Delete filter_writer.go (811 lines): DelayedResponseWriter not integrated
- Delete filter_phase_test.go (1466 lines): tests for removed filter code
- Total: 2608 lines of dead code removed
2026-06-03 16:31:18 +08:00
2734b04d8f
refactor: remove 16.8k lines of dead code across all internal packages
...
- Delete unused files: tempfile subsystem, matcher variants, server/internal
- Remove 200+ unused functions across proxy, ssl, lua, http2/3, stream, variable
- Fix proxy test type errors (backgroundRefresh ctx→Request)
- Move bench/tools mock backend into internal/testutil
- Remove corresponding test functions for all deleted code
2026-06-03 16:15:43 +08:00
5dec128510
Merge pull request #3 from xfy911/improve-comments
...
docs: add comprehensive documentation comments
2026-06-03 15:41:36 +08:00
xfy911
a6152d4dc1
docs: add documentation comments for method implementations and test utilities
...
- Add GoDoc for Warning.String, ParseError.Error
- Add GoDoc for ngxReqAPILayer.String, Phase.String, SocketState.String
- Add GoDoc for ConflictError.Error
- Add GoDoc for noopResolver methods (LookupHost, LookupHostWithCache, Refresh, Start, Stop, Stats)
- Add GoDoc for load balancer Select methods (roundRobin, weightedRoundRobin, ipHash)
- Add GoDoc for WithWSHeaders test utility
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
a136b07bb9
docs: add documentation comments for exported constants and variables
...
- Fix gjson/gjson.go package comments and constant documentation
- Fix internal/config/config.go constant documentation
- Fix internal/utils/httperror.go variable documentation
- Fix internal/matcher/matcher.go constant documentation
- Fix internal/middleware/compression/compression.go constant documentation
- Fix internal/middleware/limitrate/limitrate.go constant documentation
- Fix internal/middleware/rewrite/rewrite.go constant documentation
- Fix internal/middleware/security/access.go and auth.go constant documentation
- Fix internal/ssl/client_verify.go constant documentation
- Fix internal/variable/builtin.go and ssl.go constant documentation
- Fix internal/lua/api_log.go HTTP and log level constant documentation
- Fix internal/benchmark/tools/tools.go constant documentation
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
fc1de2d445
docs: add documentation comments for more exported constants and variables
...
- Add comments for ssl/client_verify.go verification modes
- Add comments for security/auth.go hash algorithms
- Add comments for rewrite/rewrite.go flags
- Add comments for compression/compression.go algorithms
- Add comments for limitrate/limitrate.go strategies
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
396a466de1
docs: add documentation comments for exported constants and variables
...
- Add comments for lua/api_log.go HTTP status codes and log levels
- Add comments for variable/builtin.go and ssl.go constants
- Add comments for utils/httperror.go error variables
- Add comments for matcher/matcher.go location types
- Add comments for compression/compression.go algorithms
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
0b5b0eb747
docs(loadbalance): add package comments for loadbalance module
...
- Add package documentation for random load balancing file
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
57d4d3ba3c
docs(app): add package comments for app module
...
- Add package documentation for app, app_common, import, app_windows, and testutil files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
63ce8ecd2a
docs(lua): add package comments for lua module
...
- Add package documentation for ip_guard file
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
4a53d3032a
docs(utils): add package comments for utils module
...
- Add package documentation for internal, etag, and bytes files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
c33adeb296
docs(middleware/limitrate): add package comments for rate limiter
...
- Add package documentation for limitrate and writer files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
05f434d5e5
docs(server): add package comments for server module
...
- Add package documentation for router, internal, lifecycle, and middleware_builder files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
dc54d3822f
docs(proxy): add package comments for proxy module
...
- Add package documentation for target_selector, utils, validate,
cache_handler, and header_modifier files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
xfy911
65aaba4e59
docs(config): add package comments for config module
...
- Add package documentation for cache, monitoring, performance, proxy,
security, server, ssl, and variable config files
- Include author attribution (xfy)
2026-06-03 15:28:53 +08:00
863456f7b4
chore: add docs/superpowers to gitignore
...
Ignore agent-generated planning and specification documents.
2026-06-03 14:41:27 +08:00
8ae4add922
fix: address code review feedback
...
- proxyDebugLog: move Enabled() guard to call sites to avoid allocations
- proxyDebugLog: add default case for unsupported types
- static routes: remove unintended regex support to match original behavior
2026-06-03 14:29:30 +08:00
4678cb5483
refactor: use testutil helpers in server tests
2026-06-03 14:19:22 +08:00
8681472c4b
refactor: use testutil helpers in proxy tests
2026-06-03 14:10:07 +08:00
094976df2b
feat: add testutil package for proxy config helpers
2026-06-03 14:00:07 +08:00
1ce42c039b
refactor: extract proxyDebugLog helper for repeated debug logging
2026-06-03 13:57:55 +08:00
684122dbf7
refactor: extract registerRoute helper to reduce repetition
2026-06-03 13:55:18 +08:00
37e20ae9a0
refactor: remove unused extractCertificates function and tests
2026-06-03 13:51:55 +08:00
bc0bc5fbbb
refactor: remove unused security header preset functions and tests
2026-06-03 13:49:57 +08:00
e3c6cb61f0
refactor: remove unused bodylimit.formatSize function and test
2026-06-03 13:48:10 +08:00
596237e484
refactor: remove unused connectionPool.get and connectionPool.count methods
2026-06-03 13:46:25 +08:00
caae75ff96
refactor: remove unused validateStatic function and its test
2026-06-03 13:44:22 +08:00
634fc5b51b
Merge pull request #2 from DefectingCat/fix/identified-issues
...
fix/identified issues
2026-06-03 13:24:15 +08:00
728a9f454b
fix(server,app,config): address code review findings
...
- Fix FD leak in DupListener: close *os.File after net.FileListener
- Add cleanup of partially-duped listeners on DupListener failure
- Make reload timeout configurable via shutdown.reload_timeout
- Handle filepath.Abs errors in processIncludes instead of ignoring
- Use net.ParseIP in isAnyAddr for robust IPv6 support
2026-06-03 13:16:05 +08:00