vendor: github.com/moby/buildkit 25bec7145b39 (v0.14.0-dev)

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-03-28 17:43:43 +01:00
parent 8abef59087
commit de5efcb03b
31 changed files with 402 additions and 232 deletions

View File

@ -0,0 +1,8 @@
// Package npipe provides connhelper for npipe://<address>
package npipe
import "github.com/moby/buildkit/client/connhelper"
func init() {
connhelper.Register("npipe", Helper)
}

View File

@ -0,0 +1,14 @@
//go:build !windows
package npipe
import (
"errors"
"net/url"
"github.com/moby/buildkit/client/connhelper"
)
func Helper(u *url.URL) (*connhelper.ConnectionHelper, error) {
return nil, errors.New("npipe connections are only supported on windows")
}

View File

@ -0,0 +1,28 @@
//go:build windows
package npipe
import (
"context"
"net"
"net/url"
"strings"
"github.com/Microsoft/go-winio"
"github.com/moby/buildkit/client/connhelper"
"github.com/pkg/errors"
)
// Helper returns helper for connecting to a url via npipes.
func Helper(u *url.URL) (*connhelper.ConnectionHelper, error) {
addrParts := strings.SplitN(u.String(), "://", 2)
if len(addrParts) != 2 {
return nil, errors.Errorf("invalid address %s", u)
}
address := strings.Replace(addrParts[1], "/", "\\", -1)
return &connhelper.ConnectionHelper{
ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
return winio.DialPipeContext(ctx, address)
},
}, nil
}