mirror of
				https://github.com/golang/go.git
				synced 2025-11-04 10:40:57 +00:00 
			
		
		
		
	net: fix parsing literal IP address in builtin dns stub resolver
This CL fixes a bug introduced by CL 128820043 which is that builtin dns stub resolver doesn't work well with literal IPv6 address namesever entries in /etc/resolv.conf. Also simplifies resolv.conf parser and adds more test cases. LGTM=iant R=golang-codereviews, bradfitz, iant CC=golang-codereviews https://golang.org/cl/140040043
This commit is contained in:
		
							parent
							
								
									55fa7659c9
								
							
						
					
					
						commit
						ced0ba5628
					
				
					 7 changed files with 83 additions and 63 deletions
				
			
		| 
						 | 
				
			
			@ -204,7 +204,7 @@ func TestReloadResolvConfChange(t *testing.T) {
 | 
			
		|||
	if _, err := goLookupIP("golang.org"); err != nil {
 | 
			
		||||
		t.Fatalf("goLookupIP(good) failed: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	r.WantServers([]string{"[8.8.8.8]"})
 | 
			
		||||
	r.WantServers([]string{"8.8.8.8"})
 | 
			
		||||
 | 
			
		||||
	// Using a bad resolv.conf when we had a good one
 | 
			
		||||
	// before should not update the config
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +215,7 @@ func TestReloadResolvConfChange(t *testing.T) {
 | 
			
		|||
 | 
			
		||||
	// A new good config should get picked up
 | 
			
		||||
	r.SetConf("nameserver 8.8.4.4")
 | 
			
		||||
	r.WantServers([]string{"[8.8.4.4]"})
 | 
			
		||||
	r.WantServers([]string{"8.8.4.4"})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func BenchmarkGoLookupIP(b *testing.B) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue