2016-09-21 08:16:01 +00:00
|
|
|
package sockets
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
2016-11-22 19:32:10 +00:00
|
|
|
"net/http"
|
2016-09-21 08:16:01 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/Microsoft/go-winio"
|
|
|
|
)
|
|
|
|
|
2016-11-22 19:32:10 +00:00
|
|
|
func configureUnixTransport(tr *http.Transport, proto, addr string) error {
|
|
|
|
return ErrProtocolNotAvailable
|
|
|
|
}
|
|
|
|
|
|
|
|
func configureNpipeTransport(tr *http.Transport, proto, addr string) error {
|
|
|
|
// No need for compression in local communications.
|
|
|
|
tr.DisableCompression = true
|
|
|
|
tr.Dial = func(_, _ string) (net.Conn, error) {
|
|
|
|
return DialPipe(addr, defaultTimeout)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-09-21 08:16:01 +00:00
|
|
|
// DialPipe connects to a Windows named pipe.
|
|
|
|
func DialPipe(addr string, timeout time.Duration) (net.Conn, error) {
|
|
|
|
return winio.DialPipe(addr, &timeout)
|
|
|
|
}
|