Skip to content

Tor relay spec flags - #142

Draft
1aeo wants to merge 2 commits into
masterfrom
cursor/tor-relay-spec-flags-91e2
Draft

Tor relay spec flags#142
1aeo wants to merge 2 commits into
masterfrom
cursor/tor-relay-spec-flags-91e2

Conversation

@1aeo

@1aeo 1aeo commented Jan 13, 2026

Copy link
Copy Markdown
Owner

Document Tor relay flag specifications and proposals for UI integration.

This PR provides a comprehensive analysis of Tor relay flags from the official spec and outlines 5 detailed proposals for enhancing the relay details page with more flag eligibility information, including code snippets and table previews.


Open in Cursor Open in Web

Per Tor dir-spec Section 3.4.2, Guard flag requires:
- Fast flag (prerequisite)
- Stable flag (prerequisite)
- V2Dir flag (prerequisite)
- WFU >= 98%
- TK >= 8 days
- Bandwidth >= 2 MB/s OR in top 25%

The code was only checking WFU, TK, and bandwidth requirements,
but NOT the prerequisite flags. This caused the "Eligible Flags"
display to show "Guard: 9/9" when the relay met WFU/TK/BW thresholds,
but the Guard flag wasn't actually assigned because the relay
was missing Fast, Stable, or V2Dir flags.

Changes:
- collector_fetcher.py: _analyze_flag_eligibility() now checks
  for Fast, Stable, and V2Dir flags before marking a relay as
  Guard eligible
- consensus_evaluation.py: _format_flag_summary() now includes
  prereqs_met check when recalculating Guard eligibility
- Added comprehensive tests for Guard prerequisite checking

Fixes: relay not showing Guard flag despite meeting vote requirements
Analysis of all flags defined in Tor dir-spec (spec.torproject.org):
- Valid, Running, Stable, Fast, Guard, Exit, Authority, V2Dir, HSDir
- BadExit, MiddleOnly, StaleDesc, Sybil, NoEdConsensus
- Detailed requirements for each flag from Section 3.4.2

5 proposals for adding flags to eligibility table:
1. Exit flag - exit policy analysis (ports 80+443)
2. Running flag - IPv4/IPv6 reachability breakdown
3. Valid flag - version check and blacklist status
4. V2Dir flag - directory capability requirements
5. MiddleOnly flag - new security restriction (Tor 0.4.7+)

Each proposal includes:
- Implementation code following existing patterns
- Table row preview matching current format
- Priority/effort/value assessment
@cursor

cursor Bot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@1aeo
1aeo force-pushed the cursor/relay-guard-flag-issue-9f3c branch 3 times, most recently from 504eefb to 56dbb6f Compare January 14, 2026 06:24
Base automatically changed from cursor/relay-guard-flag-issue-9f3c to master January 14, 2026 08:11
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