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

Default dns addr doesn't work on ubuntu 16.04 #10

Open
dolanor opened this issue Jun 30, 2019 · 1 comment
Open

Default dns addr doesn't work on ubuntu 16.04 #10

dolanor opened this issue Jun 30, 2019 · 1 comment

Comments

@dolanor
Copy link

dolanor commented Jun 30, 2019

Hi,

I tried to use spilld, but I got this error on ubuntu 16.04, and I don't understand why it does that.
I tried to investigate to understand, and it seems the type switch in *net.ListenConfig.Listen() can't distinguish which type of addr it is.

spilld -dev -debug_addr :22222
spilld, version unknown, starting at 2019-06-30 13:18:52.717845551 +0000 UTC m=+0.005995874
***DEVELOPMENT MODE***
temp dir /tmp/spilld-425601882
listen tcp :53: address :53: unexpected address type

I added some debug fmt.Println in the src/net/dial.go to see what was wrong:

diff /tmp/dial-dbg.go /usr/local/go-1.12.6/src/net/dial.go 
11,12d10
< 	"log"
< 	"reflect"
619,620d616
< 	log.Println("addr:", reflect.TypeOf(la),
< 		reflect.ValueOf(la))

And the output is now:

spilld -debug_addr :22222 -dev -dns_addr :8888 -imap_addr :9943 -smtp_addr :2525 -msa_addr :1465
spilld, version unknown, starting at 2019-06-30 22:38:14.890883754 +0200 CEST m=+0.003851093
***DEVELOPMENT MODE***
temp dir /tmp/spilld-843824628
addr: *net.TCPAddr :9943
addr: *net.TCPAddr :2525
addr: *net.TCPAddr :1465
addr: *net.TCPAddr :8888
listen tcp :8888: address :8888: unexpected address type

I don't get why it fails for this special case.

@dolanor
Copy link
Author

dolanor commented Jun 30, 2019

I added a test in the log reflect.TypeOf(la) == reflect.TypeOf(&TCPAddr{})

--- dial.go	2019-06-30 23:09:27.680602947 +0200
+++ dial.go.ori	2019-06-11 19:27:51.000000000 +0200
@@ -8,8 +8,6 @@
 	"context"
 	"internal/nettrace"
 	"internal/poll"
-	"log"
-	"reflect"
 	"syscall"
 	"time"
 )
@@ -616,9 +614,6 @@
 	}
 	var l Listener
 	la := addrs.first(isIPv4)
-	log.Println("addr:", reflect.TypeOf(la),
-		reflect.ValueOf(la), reflect.TypeOf(la) == reflect.TypeOf(&TCPAddr{}))
-
 	switch la := la.(type) {
 	case *TCPAddr:
 		l, err = sl.listenTCP(ctx, la)

And now I get:

spilld -debug_addr :22222 -dev -dns_addr :8888 -imap_addr :9943 -smtp_addr :2525 -msa_addr :1465
spilld, version unknown, starting at 2019-06-30 23:09:39.38378492 +0200 CEST m=+0.005742067
***DEVELOPMENT MODE***
temp dir /tmp/spilld-171764129
addr: *net.TCPAddr :9943 true
addr: *net.TCPAddr :2525 true
addr: *net.TCPAddr :1465 true
addr: *net.TCPAddr :8888 true
listen tcp :8888: address :8888: unexpected address type

la is of the right reflect.Type, but the type switch didn't think it was. Could it be a bug in Go directly?
Why on that case?

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

No branches or pull requests

1 participant