design-15 S7b: reverse u_name stats into (line, user) accounting - #17
Closed
lr00rl wants to merge 2 commits into
Closed
design-15 S7b: reverse u_name stats into (line, user) accounting#17lr00rl wants to merge 2 commits into
lr00rl wants to merge 2 commits into
Conversation
design-15 §8 server slice: applyProxyUsageSnapshot now folds on-box u_<sha256(user|line_uuid)[:16]> counter names back into (line_hash_id, proxy user id) rows before eligibility checks and monotonic diffing. The per-user total advances through the existing UserBytes path, the line granularity persists in line_user_bytes, and names that match no (bound, migrated) pair degrade to ignored — never zero-filled. Counters from users on multiple lines sum into one proxy-user total while each line keeps its own bucket, so the three-dimensional usage read model (node, line, user) lights up without a contract change.
ADR-004: the vpn-core profiles settings model gains singbox_stats_api (saved/reported/normalized with the same host:port validation as proxy_usage_xray_api), AgentLaunchConfig persists it (lattice-sdk f2a9b0e), and the generated reconfigure command exports LATTICE_SINGBOX_STATS_API.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
design-15 §8 server slice (pairs with lattice-node-agent#6):
userLineNameIndex(): recomputes the §5 on-box names for every (migrated identity × enabled binding) and maps them to (line_hash_id,proxy_user_id).foldUserLineUsage():applyProxyUsageSnapshotfolds matchedu_<hash>counter keys into the proxy user'sUserBytestotal (normal monotonic diff advances it) and intoline_user_bytesline buckets (3-D usage rows). Unmatched names degrade to ignored — never fabricated zero traffic.Stacked on #16.
Verification
gofmt/go vetclean;go test ./...all ok (server pkg 21.4s)Refs LatticeNet/lattice#2, #13–#16, lattice-node-agent#6.