Debian Codegraph @

buildkit/frontend/gateway/container/util.go

raw
1 package container
2
3 import (
4 "net"
5
6 "github.com/moby/buildkit/executor"
7 "github.com/moby/buildkit/solver/pb"
8 "github.com/pkg/errors"
9 )
10
11 func ParseExtraHosts(ips []*pb.HostIP) ([]executor.HostIP, error) {
12 out := make([]executor.HostIP, len(ips))
13 for i, hip := range ips {
14 ip := net.ParseIP(hip.IP)
15 if ip == nil {
16 return nil, errors.Errorf("failed to parse IP %s", hip.IP)
17 }
18 out[i] = executor.HostIP{
19 IP: ip,
20 Host: hip.Host,
21 }
22 }
23 return out, nil
24 }