func (pods Pods) AsStrings() []string {
	converted := make([]string, 0, len(pods))
	for _, pod := range pods {
		converted = append(converted, pod.String())
	}
	return converted
}
AsStrings converts a list of fully-qualified pod names into a string list.
package kubernetes
import (
	"regexp"
	"strconv"
	"strings"
	"github.com/pkg/errors"
)
var Forwarding = regexp.MustCompile(`^\d+(?::\d+)?$`)
const portSeparator = ":"
func NewMapping(args ...string) (Mapping, error) {
	mapping := make(Mapping, len(args))
	for _, arg := range args {
		if !Forwarding.MatchString(arg) {
			return nil, errors.Errorf("expected port forwarding in format [local:]remote, obtained %s", arg)
		}
		ports := strings.Split(arg, portSeparator)
		converted := make([]int16, 0, len(ports))
		for _, port := range ports {
			value, err := strconv.ParseInt(port, 10, 16)
			if err != nil {
				return nil, errors.Errorf("expected a valid 16-bit port number, obtained %s: %+v", port, err)
			}
			converted = append(converted, int16(value))
		}
		var (
			local  = Local(converted[0])
			remote = Remote(converted[0])
		)
		if len(ports) == 2 {
			remote = Remote(converted[1])
		}
		if _, exists := mapping[local]; exists {
			return nil, errors.Errorf("the local port number %d is already used for forwarding", local)
		}
		mapping[local] = remote
	}
	return mapping, nil
}
type (
	Pod string
	Pods []Pod
	Port int16
	Local Port
	Remote Port
	Mapping map[Local]Remote
)
func (pod Pod) Like(pattern string) bool {
	return strings.Contains(pod.String(), pattern)
}
func (pod Pod) String() string {
	return string(pod)
}