mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
remote: use winio DialPipeContext for named pipes
Signed-off-by: Ian King'ori <kingorim.ian@gmail.com>
This commit is contained in:
23
driver/remote/util/dialer_windows.go
Normal file
23
driver/remote/util/dialer_windows.go
Normal file
@ -0,0 +1,23 @@
|
||||
package remote
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
)
|
||||
|
||||
func DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
|
||||
var conn net.Conn
|
||||
var err error
|
||||
|
||||
// dial context doesn't support named pipes
|
||||
if network == "npipe" {
|
||||
conn, err = winio.DialPipeContext(ctx, addr)
|
||||
} else {
|
||||
dialer := &net.Dialer{}
|
||||
conn, err = dialer.DialContext(ctx, network, addr)
|
||||
}
|
||||
|
||||
return conn, err
|
||||
}
|
Reference in New Issue
Block a user