mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 10:00:01 +08:00 
			
		
		
		
	fix(deps): update github.com/docker/go-connections digest to fa09c95
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										28
									
								
								vendor/github.com/docker/go-connections/nat/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								vendor/github.com/docker/go-connections/nat/parse.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -6,34 +6,10 @@ import ( | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // PartParser parses and validates the specified string (data) using the specified template | ||||
| // e.g. ip:public:private -> 192.168.0.1:80:8000 | ||||
| // DEPRECATED: do not use, this function may be removed in a future version | ||||
| func PartParser(template, data string) (map[string]string, error) { | ||||
| 	// ip:public:private | ||||
| 	var ( | ||||
| 		templateParts = strings.Split(template, ":") | ||||
| 		parts         = strings.Split(data, ":") | ||||
| 		out           = make(map[string]string, len(templateParts)) | ||||
| 	) | ||||
| 	if len(parts) != len(templateParts) { | ||||
| 		return nil, fmt.Errorf("Invalid format to parse. %s should match template %s", data, template) | ||||
| 	} | ||||
|  | ||||
| 	for i, t := range templateParts { | ||||
| 		value := "" | ||||
| 		if len(parts) > i { | ||||
| 			value = parts[i] | ||||
| 		} | ||||
| 		out[t] = value | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| // ParsePortRange parses and validates the specified string as a port-range (8000-9000) | ||||
| func ParsePortRange(ports string) (uint64, uint64, error) { | ||||
| 	if ports == "" { | ||||
| 		return 0, 0, fmt.Errorf("Empty string specified for ports.") | ||||
| 		return 0, 0, fmt.Errorf("empty string specified for ports") | ||||
| 	} | ||||
| 	if !strings.Contains(ports, "-") { | ||||
| 		start, err := strconv.ParseUint(ports, 10, 16) | ||||
| @ -51,7 +27,7 @@ func ParsePortRange(ports string) (uint64, uint64, error) { | ||||
| 		return 0, 0, err | ||||
| 	} | ||||
| 	if end < start { | ||||
| 		return 0, 0, fmt.Errorf("Invalid range specified for the Port: %s", ports) | ||||
| 		return 0, 0, fmt.Errorf("invalid range specified for port: %s", ports) | ||||
| 	} | ||||
| 	return start, end, nil | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	![29139614+renovate[bot]@users.noreply.github.com](/assets/img/avatar_default.png) renovate[bot]
					renovate[bot]