Skip to content

Conversation

@jay-418
Copy link
Contributor

@jay-418 jay-418 commented Mar 13, 2025

@jay-418 jay-418 requested a review from Copilot March 13, 2025 20:05
Copy link
Contributor

Copilot AI left a 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"))
Copy link
Contributor Author

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?

Comment on lines +112 to +113
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?
Copy link
Contributor Author

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

Comment on lines +218 to +219
// TODO record a connection
common.Debugf("[placeholder] POST new connection for ID: %v", unboundedID)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placeholder: report to redis

Comment on lines +238 to +240
// TODO what is the relationship between a connection and a stream? 1:1?
// if not, should be be recording streams?

Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants