code: func translateServicePortToTargetPort(ports []string, svc corev1.Service, pod corev1.Pod) ([]string, error) {
  	var translated []string
  	for _, port := range ports {
  		localPort, remotePort := splitPort(port)
  
  		portnum, err := strconv.Atoi(remotePort)
  		if err != nil {
  			svcPort, err := util.LookupServicePortNumberByName(svc, remotePort)
  			if err != nil {
  				return nil, err
  			}
  			portnum = int(svcPort)
  
  			if localPort == remotePort {
  				localPort = strconv.Itoa(portnum)
  			}
  		}
  		containerPort, err := util.LookupContainerPortNumberByServicePort(svc, pod, int32(portnum))
  		if err != nil {
  			// can't resolve a named port, or Service did not declare this port, return an error
  			return nil, err
  		}
  
  		if int32(portnum) != containerPort {
  			translated = append(translated, fmt.Sprintf("%s:%d", localPort, containerPort))
  		} else {
  			translated = append(translated, port)
  		}
  	}
  	return translated, nil
  }
docs: // Translates service port to target port
  // It rewrites ports as needed if the Service port declares targetPort.
  // It returns an error when a named targetPort can't find a match in the pod, or the Service did not declare
  // the port.