2017-04-17 18:08:24 -04:00
|
|
|
package sockets
|
|
|
|
|
|
|
|
import (
|
2023-11-10 09:56:11 -05:00
|
|
|
"context"
|
2017-04-17 18:08:24 -04:00
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/Microsoft/go-winio"
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2023-11-10 09:56:11 -05:00
|
|
|
tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) {
|
|
|
|
return winio.DialPipeContext(ctx, addr)
|
2017-04-17 18:08:24 -04:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// DialPipe connects to a Windows named pipe.
|
|
|
|
func DialPipe(addr string, timeout time.Duration) (net.Conn, error) {
|
|
|
|
return winio.DialPipe(addr, &timeout)
|
|
|
|
}
|