David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 1 | package sockets |
| 2 | |
| 3 | import ( |
| 4 | "net" |
| 5 | "net/http" |
| 6 | "time" |
| 7 | |
| 8 | "github.com/Microsoft/go-winio" |
| 9 | ) |
| 10 | |
| 11 | func configureUnixTransport(tr *http.Transport, proto, addr string) error { |
| 12 | return ErrProtocolNotAvailable |
| 13 | } |
| 14 | |
| 15 | func configureNpipeTransport(tr *http.Transport, proto, addr string) error { |
| 16 | // No need for compression in local communications. |
| 17 | tr.DisableCompression = true |
| 18 | tr.Dial = func(_, _ string) (net.Conn, error) { |
| 19 | return DialPipe(addr, defaultTimeout) |
| 20 | } |
| 21 | return nil |
| 22 | } |
| 23 | |
| 24 | // DialPipe connects to a Windows named pipe. |
| 25 | func DialPipe(addr string, timeout time.Duration) (net.Conn, error) { |
| 26 | return winio.DialPipe(addr, &timeout) |
| 27 | } |