Skip to content
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

Explorer API - add port check and node description/stats proxy #731

Merged
merged 14 commits into from
Aug 10, 2021

Conversation

mmsinclair
Copy link
Contributor

@mmsinclair mmsinclair commented Aug 9, 2021

This PR adds new features to the Explorer API:

  • on-demand cached request to all open ports on a mix node (as defined in the mix node bond fields mix_port,verloc_port, http_api_port)
  • on-demand cached proxy /description and /stats from mix node http API to allow the Network Explorer UI to make requests for these without mixed content errors (http fetches from an app served on https)

The default cache TTL is 30 minutes.

explorer-api/src/http/mod.rs Outdated Show resolved Hide resolved
explorer-api/src/mix_node/http.rs Show resolved Hide resolved
{
self.inner
.get(&identity_key)
.filter(|cache_item| cache_item.valid_until > SystemTime::now())
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a suggestion, perhaps there should be some way of removing stale entries from the cache? Right now everything will just stay there forever

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is a bit wasteful generally - although I'm hoping the memory requirements for thousands of nodes will still be megabytes. I can add a cleanup background task sometime if it becomes a problem.

explorer-api/src/mix_node/http.rs Outdated Show resolved Hide resolved
explorer-api/src/mix_nodes/mod.rs Outdated Show resolved Hide resolved
explorer-api/src/state.rs Outdated Show resolved Hide resolved
explorer-api/src/state.rs Show resolved Hide resolved
explorer-api/src/mix_nodes/mod.rs Show resolved Hide resolved
explorer-api/src/mix_node/http.rs Outdated Show resolved Hide resolved
explorer-api/src/mix_node/http.rs Show resolved Hide resolved
@mmsinclair mmsinclair merged commit 4ac95ad into develop Aug 10, 2021
@mmsinclair mmsinclair deleted the feature/explorer-api-port-check branch August 10, 2021 14:27
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