mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	Bump github.com/gogo/googleapis to v1.3.2 Bump github.com/docker/cli to master Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
		
			
				
	
	
		
			25 lines
		
	
	
		
			541 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			541 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package client
 | 
						|
 | 
						|
import (
 | 
						|
	"net"
 | 
						|
	"strings"
 | 
						|
	"time"
 | 
						|
 | 
						|
	winio "github.com/Microsoft/go-winio"
 | 
						|
	"github.com/pkg/errors"
 | 
						|
)
 | 
						|
 | 
						|
func dialer(address string, timeout time.Duration) (net.Conn, error) {
 | 
						|
	addrParts := strings.SplitN(address, "://", 2)
 | 
						|
	if len(addrParts) != 2 {
 | 
						|
		return nil, errors.Errorf("invalid address %s", address)
 | 
						|
	}
 | 
						|
	switch addrParts[0] {
 | 
						|
	case "npipe":
 | 
						|
		address = strings.Replace(addrParts[1], "/", "\\", -1)
 | 
						|
		return winio.DialPipe(address, &timeout)
 | 
						|
	default:
 | 
						|
		return net.DialTimeout(addrParts[0], addrParts[1], timeout)
 | 
						|
	}
 | 
						|
}
 |