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

net: DefaultResolver.Lookup{Host,IPAddr} and LookupHost fail to parse a literal IPv6 address w/ zone #20790

Closed
mikioh opened this issue Jun 25, 2017 · 1 comment

Comments

Projects
None yet
4 participants
@mikioh
Copy link
Contributor

commented Jun 25, 2017

When GODEBUG=netdns=go or Resolver.PreferGo is true, DefaultResolver.Lookup{IPAddr,Host} and LookupHost fail to parse a literal IPv6 address w/ zone like the following:

% go run x.go 
lookup fe80::1%lo0: no such host
exit status 1

--
package main

import (
	"context"
	"log"
	"net"
)

func main() {
	r := &net.Resolver{PreferGo: true}
	ipas, err := r.LookupIPAddr(context.Background(), "fe80::1%lo0")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(ipas)
}

Hope this is the last one of long standing issues regarding inconsistency between GODEBUG=netdns=cgo and GODEBUG=netdns=go. The fix would be simply to replace the use of ParseIP with a pair of parseIPv4 and parseIPv6, so this is probably a good first contribution issue.

@gopherbot

This comment has been minimized.

Copy link

commented Nov 26, 2017

Change https://golang.org/cl/79935 mentions this issue: net: Parse IPv6 address with zone using DefaultResolver.Lookup{Host,IPAddr}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.