-
Notifications
You must be signed in to change notification settings - Fork 1
pass team member ID to proxy through header #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR passes a team member ID through the proxy header to support donor connection crediting. Key changes include:
- Adding a new diagram file with updated mermaid diagrams.
- Generating a mock team member ID in the Broflake initialization.
- Updating both the egress consumer and proxy listener to include the team member ID in WebSocket headers and logging.
- Extending EgressOptions with a new TeamMemberID field.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| diagrams.md | Added updated mermaid diagrams for version-controlled tracking |
| clientcore/broflake.go | Injects a mock team member ID for donors in the Broflake options |
| clientcore/egress_consumer.go | Adds header injection of the team member ID for WebSocket dialing |
| egress/egresslib.go | Logs the team member ID from the header and adds stub functions for reporting metrics |
| clientcore/settings.go | Extends default EgressOptions with a new TeamMemberID field |
| ui/src/utils/wasmInterface.ts | Minor whitespace adjustment after connection mapping update |
Comments suppressed due to low confidence (2)
egress/egresslib.go:112
- [nitpick] Consider refactoring ReportConnection (and ReportBytes) into methods on the proxyListener if shared behavior is required, which can improve consistency and reduce the risk of misconfiguration.
ReportConnection func(ctx context.Context) error // TODO should we use a method here?
egress/egresslib.go:197
- Define the header name 'X-Unbounded' as a constant to avoid duplication and reduce potential typos across the codebase.
unboundedID := r.Header.Get("X-Unbounded")
|
|
||
| // obtain the donor's team member ID if they are a donor seeking "credit" for their facilitated connections | ||
| // TODO this is a mock/placeholder, replace with real value | ||
| egOpt.TeamMemberID = fmt.Sprintf("MOCK-TEAM-ID-%v", time.Now().UTC().Format("2006-01-02T15:04:05")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A contributing team member's ID could be obtained when the user logs in, and set somewhere that it can be read and added to egress websocket connections.
How should that ID be known here?
| ReportConnection func(ctx context.Context) error // TODO should we use a method here? | ||
| ReportBytes func(ctx context.Context) error // TODO same, and do we have a way to track bytes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently unused, but kept in as a placeholder for a "insert reporting func" structure that isn't too specifically tied to lantern-cloud
| // TODO record a connection | ||
| common.Debugf("[placeholder] POST new connection for ID: %v", unboundedID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder: report to redis
| // TODO what is the relationship between a connection and a stream? 1:1? | ||
| // if not, should be be recording streams? | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it matter to count streams?
fixes: