mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	vendor: update buildkit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
		
							
								
								
									
										37
									
								
								vendor/github.com/moby/buildkit/client/connhelper/connhelper.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								vendor/github.com/moby/buildkit/client/connhelper/connhelper.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| // Package connhelper provides helpers for connecting to a remote daemon host with custom logic. | ||||
| package connhelper | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"net" | ||||
| 	"net/url" | ||||
|  | ||||
| 	"github.com/docker/cli/cli/connhelper/commandconn" | ||||
| ) | ||||
|  | ||||
| // ConnectionHelper allows to connect to a remote host with custom stream provider binary. | ||||
| type ConnectionHelper struct { | ||||
| 	// ContextDialer can be passed to grpc.WithContextDialer | ||||
| 	ContextDialer func(ctx context.Context, addr string) (net.Conn, error) | ||||
| } | ||||
|  | ||||
| // GetConnectionHelper returns BuildKit-specific connection helper for the given URL. | ||||
| // GetConnectionHelper returns nil without error when no helper is registered for the scheme. | ||||
| // | ||||
| // docker://<container> URL requires BuildKit v0.5.0 or later in the container. | ||||
| func GetConnectionHelper(daemonURL string) (*ConnectionHelper, error) { | ||||
| 	u, err := url.Parse(daemonURL) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	switch scheme := u.Scheme; scheme { | ||||
| 	case "docker": | ||||
| 		container := u.Host | ||||
| 		return &ConnectionHelper{ | ||||
| 			ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) { | ||||
| 				return commandconn.New(ctx, "docker", "exec", "-i", container, "buildctl", "dial-stdio") | ||||
| 			}, | ||||
| 		}, nil | ||||
| 	} | ||||
| 	return nil, err | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Tonis Tiigi
					Tonis Tiigi