Skip to content

feat: add support dns#22

Merged
GrapeBaBa merged 1 commit intomainfrom
dns
Oct 18, 2025
Merged

feat: add support dns#22
GrapeBaBa merged 1 commit intomainfrom
dns

Conversation

@GrapeBaBa
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Chen Kai <281165273grape@gmail.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @GrapeBaBa, 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 introduces new functionality to handle DNS-based addresses within the multiaddr parsing system. This enhancement allows the application to correctly interpret and process multiaddresses that specify DNS hostnames, including those explicitly for IPv4 and IPv6 DNS records, thereby expanding the range of network addresses that can be represented and utilized.

Highlights

  • New Multiaddr Protocols: Added support for /dns, /dns4, and /dns6 protocols within the Multiaddr parsing logic, allowing for the interpretation of DNS hostnames in multiaddresses.
  • Test Coverage: Included new test cases to validate the correct parsing of the newly supported DNS multiaddr formats, ensuring their proper functionality.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for dns, dns4, and dns6 multiaddr protocols. The implementation correctly adds parsing logic for these new protocols and includes corresponding test cases to ensure correctness. My review identifies an opportunity to refactor duplicated code in the parsing logic for better maintainability. Overall, a good addition to the library.

Comment thread src/multiaddr.zig
Comment on lines +667 to +678
.dns => blk: {
const host = parts.next() orelse return Error.InvalidProtocolString;
break :blk Protocol{ .Dns = host };
},
.dns4 => blk: {
const host = parts.next() orelse return Error.InvalidProtocolString;
break :blk Protocol{ .Dns4 = host };
},
.dns6 => blk: {
const host = parts.next() orelse return Error.InvalidProtocolString;
break :blk Protocol{ .Dns6 = host };
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The parsing logic for dns, dns4, and dns6 protocols is duplicated. You can combine these cases to reduce code duplication and improve maintainability, similar to how tcp and udp are handled.

            .dns, .dns4, .dns6 => blk: {
                const host = parts.next() orelse return Error.InvalidProtocolString;
                break :blk if (proto_name.len == 3) // "dns"
                    Protocol{ .Dns = host }
                else if (proto_name[3] == '4') // "dns4"
                    Protocol{ .Dns4 = host }
                else // "dns6"
                    Protocol{ .Dns6 = host };
            },

@GrapeBaBa GrapeBaBa merged commit e20ee5a into main Oct 18, 2025
3 checks passed
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.

1 participant