Skip to content

fix: improve online IP report handling#11

Merged
besnow merged 2 commits into
dev_newfrom
codex/create-patch-branch-for-online-ip-report
May 19, 2026
Merged

fix: improve online IP report handling#11
besnow merged 2 commits into
dev_newfrom
codex/create-patch-branch-for-online-ip-report

Conversation

@besnow
Copy link
Copy Markdown
Owner

@besnow besnow commented May 19, 2026

Motivation

  • Ensure online-IP reporting errors are not swallowed and avoid POSTing empty online-IP payloads while preserving existing production logic and API contracts.
  • Allow limiter to use real node protocol type to decide online-IP recording entry for certain protocols (hysteria2/tuic) with a minimal, non-invasive change.
  • Risk: enabling hysteria2/tuic in the online-IP path may make DeviceLimit/online-IP behavior more sensitive and should be observed after rollout.

Description

  • Fix ReportNodeOnlineUsers to return err when checkResponse fails by changing api/panel/user.go to return err instead of return nil.
  • Prevent empty online-IP payloads by adding len(data) != 0 guard in node/user.go before calling ReportNodeOnlineUsers and add a concise debug log when filtering results in zero reported entries.
  • Add Nodetype string to Limiter, change AddLimiter signature to AddLimiter(nodetype string, tag string, ...) and initialize Nodetype in limiter/limiter.go.
  • Make CheckLimit consider hysteria2 and tuic for online-IP recording by updating the condition to if noSSUDP || l.Nodetype == "hysteria2" || l.Nodetype == "tuic", and update call sites in node/controller.go and node/task.go to pass node.Type/newN.Type into AddLimiter.
  • Confirmations: the /api/v1/server/UniProxy/alive endpoint and payload type map[int][]string remain unchanged, and no node_type=v2node or large refactors were introduced.

Testing

  • Ran gofmt -w on modified files successfully.
  • Ran go build ./... and the build completed successfully.
  • Verified changes via git diff --stat and ensured the diff shows only the intended minimal modifications and no interface or payload changes.

Codex Task

@besnow besnow merged commit 8cdf54f into dev_new May 19, 2026
23 checks passed
@besnow besnow deleted the codex/create-patch-branch-for-online-ip-report branch May 19, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant