Repository navigation
Fix SNI: Add hostname field to ServiceInfo - #11
Conversation
Add hostname field to ServiceInfo struct to properly support TLS Server Name Indication (SNI). The hostname is used for network addressing and TLS SNI, representing the DNS/mDNS hostname that resolves to the device's IP address. Changes: - Add hostname field to ServiceInfo struct with documentation - Rename service_info_from_mdns_resolved() to service_info_from_mdns() - Extract hostname from mDNS resolved service - Use hostname instead of IP address for QUIC connect() - Update mock publisher and tests to include hostname
Summary of ChangesHello @kaidokert, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively adds support for TLS SNI by introducing a hostname field to ServiceInfo. The changes are well-implemented, especially the extraction of the hostname from mDNS records and the excellent documentation updates for the ServiceInfo struct. The use of the new hostname field in the QUIC client connection is also correct. I have one suggestion regarding the direct connection mode in the app-sender example to improve consistency with the new hostname field's documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly introduces a hostname field to ServiceInfo to support TLS SNI. The changes are well-implemented across the discovery and application layers, including updates to documentation, mocks, and tests. I have a couple of suggestions for improvement: one to make IP address resolution more robust in the sender application, and another to clarify documentation in ServiceInfo.
Replace IP address parsing with tokio::net::lookup_host to support both hostnames and IP addresses for the --direct-host argument. This resolves a semantic inconsistency where ServiceInfo.hostname was documented to hold a "DNS/mDNS hostname" but was actually receiving an IP address string. The implementation prefers IPv4 addresses when available, consistent with the mDNS discovery behavior. This avoids potential connectivity issues on networks with misconfigured IPv6 support.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly adds the hostname field to ServiceInfo to support TLS Server Name Indication (SNI), which is a crucial fix. The changes are well-integrated across the different crates, including the application, mDNS discovery implementation, and mock testing utilities. My review includes a couple of suggestions for improvement: one to correctly parse the user-friendly display_name from the mDNS service name, and another to fix a minor inconsistency in a documentation example.
Implement display name extraction to remove the service suffix from the full mDNS service name, making it more user-friendly for display. The full mDNS service name has the format: <instance>._openscreen._udp.local. For example: - Full: "Living Room TV._openscreen._udp.local." - Display: "Living Room TV"
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly adds support for TLS Server Name Indication (SNI) by introducing a hostname field to ServiceInfo and using it during the QUIC connection. The changes are well-structured, including updates to mDNS discovery logic, mocks, and tests. I've identified a potential bug in the display name extraction logic and a minor documentation inconsistency. Overall, this is a solid improvement for secure connections.
Implement display name extraction to remove the service suffix from the full mDNS service name, making it more user-friendly for display. The full mDNS service name has the format: <instance>.<service> For example: - Full: "Living Room TV._openscreen._udp.local." - Display: "Living Room TV"
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly implements support for TLS Server Name Indication (SNI) by adding a hostname field to the ServiceInfo struct and using it during the QUIC connection process. The changes are consistently applied across all relevant crates, including application logic, mDNS discovery, and mock implementations. The documentation has been significantly improved, clarifying the different name and identifier fields. The addition of new tests for the display name extraction logic is also a welcome improvement. My review found one minor issue where an unwrap_or could be simplified to unwrap for better clarity and idiomatic code, but overall this is a high-quality contribution that addresses an important feature.
Add hostname field to ServiceInfo struct to properly support TLS Server Name Indication (SNI). The hostname is used for network addressing and TLS SNI, representing the DNS/mDNS hostname that resolves to the device's IP address.
Changes:
Fixes #3