containerd/dialer_unix.go
Kenfe-Mickael Laventure c42f56b3a1
Move unix specific tidbits into dialer_unix.go
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-09-25 09:30:09 -07:00

35 lines
592 B
Go

// +build !windows
package containerd
import (
"fmt"
"net"
"os"
"strings"
"syscall"
"time"
)
func isNoent(err error) bool {
if err != nil {
if nerr, ok := err.(*net.OpError); ok {
if serr, ok := nerr.Err.(*os.SyscallError); ok {
if serr.Err == syscall.ENOENT {
return true
}
}
}
}
return false
}
func dialer(address string, timeout time.Duration) (net.Conn, error) {
address = strings.TrimPrefix(address, "unix://")
return net.DialTimeout("unix", address, timeout)
}
func DialAddress(address string) string {
return fmt.Sprintf("unix://%s", address)
}