Skip to content

Commit

Permalink
Merge pull request #9501 from profnandaa/release_1_17_backport
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelkarp committed Dec 19, 2023
2 parents 8d0b1c8 + 68d2373 commit 679b52e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/dialer/dialer_windows.go
Expand Up @@ -17,8 +17,11 @@
package dialer

import (
"fmt"
"net"
"os"
"path/filepath"
"strings"
"time"

winio "github.com/Microsoft/go-winio"
Expand All @@ -29,10 +32,16 @@ func isNoent(err error) bool {
}

func dialer(address string, timeout time.Duration) (net.Conn, error) {
address = strings.TrimPrefix(filepath.ToSlash(address), "npipe://")
return winio.DialPipe(address, &timeout)
}

// DialAddress returns the dial address
// DialAddress returns the dial address with npipe:// prepended to the
// provided address
func DialAddress(address string) string {
address = filepath.ToSlash(address)
if !strings.HasPrefix(address, "npipe://") {
address = fmt.Sprintf("npipe://%s", address)
}
return address
}

0 comments on commit 679b52e

Please sign in to comment.