Browse code

Windows CI: Allow npipe protocol for sock requests

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/03/03 07:14:14
Showing 3 changed files
... ...
@@ -577,6 +577,8 @@ func sockConn(timeout time.Duration) (net.Conn, error) {
577 577
 
578 578
 	var c net.Conn
579 579
 	switch daemonURL.Scheme {
580
+	case "npipe":
581
+		return npipeDial(daemonURL.Path, timeout)
580 582
 	case "unix":
581 583
 		return net.DialTimeout(daemonURL.Scheme, daemonURL.Path, timeout)
582 584
 	case "tcp":
583 585
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+// +build !windows
1
+
2
+package main
3
+
4
+import (
5
+	"net"
6
+	"time"
7
+)
8
+
9
+func npipeDial(path string, timeout time.Duration) (net.Conn, error) {
10
+	panic("npipe protocol only supported on Windows")
11
+}
0 12
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+package main
1
+
2
+import (
3
+	"net"
4
+	"time"
5
+
6
+	"github.com/Microsoft/go-winio"
7
+)
8
+
9
+func npipeDial(path string, timeout time.Duration) (net.Conn, error) {
10
+	return winio.DialPipe(path, &timeout)
11
+}