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

proposal: net: Add LookupHTTPS() #72110

Open
Fangliding opened this issue Mar 5, 2025 · 7 comments
Open

proposal: net: Add LookupHTTPS() #72110

Fangliding opened this issue Mar 5, 2025 · 7 comments
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Milestone

Comments

@Fangliding
Copy link

Proposal Details

Golang 1.23+already supports ECH, and the main way to obtain ECH config list is through DNS. However, there is no query function for HTTPS records (type65) in the net package, For now, we need manually handle DNS responses

Type65 not only include the ECH config list, so the func should return a structure slice containing priority (int) alpn ([]string) ECH config list ([]byte) ipv4hint ([]string)... (Other specified in RFC 9460)

@gopherbot gopherbot added this to the Proposal milestone Mar 5, 2025
@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label Mar 5, 2025
@ianlancetaylor
Copy link
Member

Can you write down the doc comment and function signature for what you are proposing? Thanks.

@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Mar 6, 2025
@Fangliding
Copy link
Author

Can you write down the doc comment and function signature for what you are proposing? Thanks.

Fine

// LookupHTTPS returns the DNS HTTPS records for the given domain name.
//
// LookupHTTPS uses [context.Background] internally; to specify the context, use
// [Resolver.LookupHTTPS].
func LookupHTTPS(name string) ([]*HTTPSRecord, error) {
}

// An HTTPSRecord represents a single DNS HTTPSRecord record.
type HTTPSRecord struct {
	Priority uint16
	Target   string
	Param    map[string][]string
}

Params can be customized, so unlike my previous description, this should be a map

According to the naming style of other records (MX & NS), HTTPSRecord should be named HTTPS, but this name is quite ambiguous and I don't know how to decide

@ianlancetaylor
Copy link
Member

Thanks. I now understand that this is a request to implement RFC 9460. That will require changes in the x/net/dns/dnsmessage package as well. Presumably we should also handle SVCB records.

CC @neild

@seankhliao
Copy link
Member

The proposal for dnsmessage is #43790

I think if we add it, it should be a method on Resolver https://pkg.go.dev/net#Resolver
Is it necessary to add a global? I somehow doubt usage will be high enough to justify it.

@Fangliding
Copy link
Author

I think if we add it, it should be a method on Resolver https://pkg.go.dev/net#Resolver Is it necessary to add a global? I somehow doubt usage will be high enough to justify it.

The lookup method in Resolver seems to be basically the same as the global lookup function, and it's just a function created for the convenience of calling, and there will not be too many differences regardless of the decision

I just think this function might be a part of ECH support. If others think this is unnecessary or could be merged into that proposal, this issue can be closed.

@mateusz834
Copy link
Member

mateusz834 commented Mar 7, 2025

Are these DNS records types directly supported in windows DNS apis?

@mateusz834
Copy link
Member

Also the name makes me a bit uncomfortable, "https", when I saw the title of this issue I thought that it is something for net/http. This might be a reason not to make it a global function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Projects
Status: Incoming
Development

No branches or pull requests

6 participants