Add darwin support

Updates golang/go#27613
Updates tailscale/tailscale#1347
Updates tailscale/tailscale#1348
This commit is contained in:
Brad Fitzpatrick
2021-02-16 15:17:19 -08:00
parent 37235d97ae
commit 993aa01eac
4 changed files with 75 additions and 4 deletions
+10 -3
View File
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build go1.15
// +build linux
// +build linux darwin
package peercred // import "inet.af/peercred"
@@ -15,7 +15,7 @@ import (
"testing"
)
func TestUnix(t *testing.T) {
func TestUnixSock(t *testing.T) {
d := t.TempDir()
path := filepath.Join(d, "foo.sock")
sock, err := net.Listen("unix", path)
@@ -24,14 +24,21 @@ func TestUnix(t *testing.T) {
}
defer sock.Close()
clientConnCh := make(chan net.Conn, 1)
go func() {
defer close(clientConnCh)
c, err := net.Dial("unix", path)
if err != nil {
t.Error(err)
return
}
c.Close()
clientConnCh <- c
}()
clientConn, ok := <-clientConnCh
if !ok {
return
}
defer clientConn.Close()
c, err := sock.Accept()
if err != nil {