1081 Commits

Author SHA1 Message Date
yusing
ddf78aacba perf(logging): optimize multi-line message formatting
- Refactors the fmtMessage function to use strings.Builder
  - Simplifies multi-writer creation with a helper function
  - Updates the new console writer initialization pattern
  - Moves InitLogger function to the top
  - Fixed NewLoggerWithFixedLevel
2025-10-15 21:18:25 +08:00
yusing
290af4e311 perf(mem): replace Scheme and ExcludedReason string with uint8 type to reduce mem usage 2025-10-15 14:35:44 +08:00
yusing
feafdf05f2 fix(validation): correct CustomValidator and strutils.Parser handling, add tests 2025-10-15 14:20:47 +08:00
yusing
b09bfd6c1e fix(serialization): use replace os.LookupEnv with env.LookupEnv 2025-10-15 00:12:17 +08:00
yusing
e13b18621d fix(favicon): add status code in error message 2025-10-15 00:11:38 +08:00
Yuzerion
53f3397b7a feat(rules): add post-request rules system with response manipulation (#160)
* Add comprehensive post-request rules support for response phase
* Enable response body, status, and header manipulation via set commands
* Refactor command handlers to support both request and response phases
* Implement response modifier system for post-request template execution
* Support response-based rule matching with status and header checks
* Add comprehensive benchmarks for matcher performance
* Refactor authentication and proxying commands for unified error handling
* Support negated conditions with !
* Enhance error handling, error formatting and validation
* Routes: add `rule_file` field with rule preset support
* Environment variable substitution: now supports variables without `GODOXY_` prefix

* new conditions:
  * `on resp_header <key> [<value>]`
  * `on status <status>`
* new commands:
  * `require_auth`
  * `set resp_header <key> <template>`
  * `set resp_body <template>`
  * `set status <code>`
  * `log <level> <path> <template>`
  * `notify <level> <provider> <title_template> <body_template>`
2025-10-14 23:53:06 +08:00
yusing
19968834d2 fix(autocert): added back timewebcloud provider 2025-10-13 07:12:38 +08:00
yusing
d41c6f8d77 fix(cookie): net/http: invalid Cookie.Domain .0.0.1:3000 2025-10-13 07:09:17 +08:00
yusing
dcc5ab8952 fix(entrypoint): 404 everything with match_domains 2025-10-13 06:45:29 +08:00
yusing
82f02ea2bf fix(rules): nil panic when only having default rule 2025-10-12 22:21:01 +08:00
yusing
dc9ae32e8f feat(entrypoint): add not found rule to customize 404 behavior 2025-10-12 21:04:49 +08:00
yusing
5640d5d454 fix(serialization): correctly handle json tag 2025-10-12 20:59:12 +08:00
yusing
c66de99fcb perf: further optimize http and body buffer handling 2025-10-12 20:57:51 +08:00
yusing
eef994082c fix(panic): nil panic in IterRoutes 2025-10-12 16:51:52 +08:00
yusing
78aea4b4d2 fix: gopsutil 2025-10-12 13:04:28 +08:00
yusing
80dd142861 refactor(rules): rename Static and Returning commands into Terminating and NonTerminating commands 2025-10-12 09:38:06 +08:00
yusing
92aa61e732 refactor(log): simplify access logger and disable stdout buffering
- Remove MultiWriter complexity and use single writer interface
  - Disable buffering for stdout logging to ensure immediate output
  - Replace slice-based closer/rotate support with type assertions
  - Simplify rotation result handling by passing result pointer
  - Update buffer size constants and improve memory management
  - Remove redundant stdout_logger.go and multi_writer.go files
  - Fix test cases to match new rotation API signature
2025-10-11 19:14:59 +08:00
yusing
848f26aa86 test(list-icon): fix tests regarding previous changes 2025-10-11 19:05:49 +08:00
yusing
81e500fcfc fix(log): stdout logging format 2025-10-11 18:30:38 +08:00
yusing
f417e0fa25 fix(notif): remove test logging 2025-10-11 18:13:19 +08:00
yusing
cb5a8e7b9d fix(acl): correct acl log handling and add country to summary 2025-10-11 17:03:08 +08:00
yusing
16cad11e89 fix(notif): format not being applied correctly 2025-10-11 16:54:52 +08:00
yusing
2bfbdbf519 refactor(acl): adjust summary format and add total count 2025-10-11 16:13:52 +08:00
yusing
d5e9a7b3b6 fix(notif): respect Method and empty content-type 2025-10-11 16:02:18 +08:00
yusing
7ea415078f fix(config): fix error and logging handling 2025-10-11 14:00:04 +08:00
yusing
e67704695b fix(acl): complete tcp and udp wrapper interface 2025-10-11 13:47:13 +08:00
yusing
804c7eec60 fix: env parsing 2025-10-11 13:37:18 +08:00
yusing
20c77edce5 chore: go mod tidy 2025-10-11 13:20:19 +08:00
yusing
4f2f0f58e2 fix(autocert): nil dereference 2025-10-11 13:12:45 +08:00
yusing
ac8ad149b8 fix(icons): list icon logic 2025-10-11 13:07:50 +08:00
yusing
66043e4a26 refactor!: simplify lego generate script; add and drop some dns provider 2025-10-11 12:44:16 +08:00
yusing
b23c3f1c3b refactor(icons): replace mutex-based cache with atomic synk.Value
- Remove sync.RWMutex and Cache struct in favor of atomic Value
  - Implement background goroutine for periodic icon updates
  - Add backward compatibility for old cache format
  - Improve concurrent access to icon cache
  - Simplify ListAvailableIcons()
2025-10-10 23:21:30 +08:00
yusing
38c0419483 feat(config): add temporary logging for failed reloads
- Add tmpLogBuf and tmpLog fields to capture config loading logs
  - Flush temporary logs only when reload succeeds
  - Extract NewLogger function for creating custom loggers
  - Update State interface to include FlushTmpLog method
2025-10-10 22:20:12 +08:00
yusing
357ce38b18 fix(idlewatcher): correctly restart on config reload 2025-10-10 21:57:36 +08:00
yusing
2e411373a2 fix(config): failed reload should not start providers in new state 2025-10-10 21:46:02 +08:00
yusing
3dedd66ad1 test(rules): add tests for glob and regex, remove old path glob test 2025-10-10 21:39:21 +08:00
yusing
98f047d88a fix(rules): correct dollar sign handling 2025-10-10 21:37:54 +08:00
yusing
973a58e982 fix(import): remove unused import in rules/validate.go 2025-10-10 20:49:12 +08:00
yusing
55a74c36b0 refactor(acl): optimize slice allocation in logNotifyLoop 2025-10-10 20:21:53 +08:00
yusing
fbabb7b7fb refactor(acl): default not to notify allowed and skip when total is 0 2025-10-10 20:20:09 +08:00
yusing
7a1841e9a5 fix(acl): add json tag for notify 2025-10-10 15:26:08 +08:00
yusing
d82bfd0ebd feat(acl): add periodic notification system for access summaries
- Add Notify configuration with To field and interval
  - Track allowed/blocked IP counts per address
  - Send periodic summary notifications with access statistics
  - Optimize logging with channel-based processing for concurrent safety
2025-10-10 15:24:48 +08:00
yusing
1f41c035ea feat(notification): add To field to LogMessage 2025-10-10 14:47:20 +08:00
yusing
c2c9f42fb3 feat(rules): glob and regex support, env var substitution
- optimized `remote` rule for ip matching
- updated descriptions
2025-10-10 14:43:48 +08:00
yusing
60cfff3435 refactor(idlewatcher): streamline loading screen favicon handling 2025-10-10 12:55:06 +08:00
yusing
c93a460043 refactor(config): add omitempty on some fields 2025-10-10 10:34:49 +08:00
yusing
9bf7a0beef revert(config): added back pointer for agent and notification config for correct unmarshaling 2025-10-10 10:07:49 +08:00
yusing
c89c737ecd fix(pool): variable shadowing 2025-10-10 10:01:42 +08:00
yusing
382fc61a9c chore: update submodules 2025-10-10 09:57:08 +08:00
yusing
c2dcabe144 refactor(rules): remove 'caller' parameter in BuildHandler 2025-10-10 09:53:44 +08:00