// GetPortHTTP returns the network port the server listens to.
337638
func (s *Server) GetPortHTTP() string {
	hostPort := s.HostPortHTTP
	hostPortSplit := strings.Split(hostPort, ":")
	port := hostPortSplit[len(hostPortSplit)-1]
	return port
}
838947
func (r RandomPortListenerSource) GetListener() (net.Listener, string, error) {
	localhost := "127.0.0.1"
	listener, err := net.Listen("tcp", fmt.Sprintf("%s:0", localhost))
	if err != nil {
		return nil, "", err
	}
	port := listener.Addr().(*net.TCPAddr).Port
	address := fmt.Sprintf("%s:%d", localhost, port)
	return listener, address, nil
}
486733
func (_class ClusterHostClass) GetHost(sessionID SessionRef, self ClusterHostRef) (_retval HostRef, _err error) {
	_method := "Cluster_host.get_host"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertClusterHostRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostRefToGo(_method + " -> ", _result.Value)
	return
}
492594
func (h *Handler) handleGetExport(w http.ResponseWriter, r *http.Request) {
	switch r.Header.Get("Accept") {
	case "text/csv":
		h.handleGetExportCSV(w, r)
	default:
		http.Error(w, "Not acceptable", http.StatusNotAcceptable)
	}
}
643376
func (s *Server) getPortForward(request *restful.Request, response *restful.Response) {
	params := getPortForwardRequestParams(request)

	portForwardOptions, err := portforward.NewV4Options(request.Request)
	if err != nil {
		utilruntime.HandleError(err)
		response.WriteError(http.StatusBadRequest, err)
		return
	}
	pod, ok := s.host.GetPodByName(params.podNamespace, params.podName)
	if !ok {
		response.WriteError(http.StatusNotFound, fmt.Errorf("pod does not exist"))
		return
	}
	if len(params.podUID) > 0 && pod.UID != params.podUID {
		response.WriteError(http.StatusNotFound, fmt.Errorf("pod not found"))
		return
	}

	url, err := s.host.GetPortForward(pod.Name, pod.Namespace, pod.UID, *portForwardOptions)
	if err != nil {
		streaming.WriteError(err, response.ResponseWriter)
		return
	}
	if s.redirectContainerStreaming {
		http.Redirect(response.ResponseWriter, request.Request, url.String(), http.StatusFound)
		return
	}
	proxyStream(response.ResponseWriter, request.Request, url)
}
257839
func getTransportDial(t *http.Transport) func(network, addr string) (net.Conn, error) {
	if t.Dial != nil {
		return t.Dial
	}
	return defaultDialer.Dial
}
541021
func DialHTTP(network, address string) (*Client, error) {
	return DialHTTPPath(network, address, DefaultRPCPath, nil)
}
446802
func GetVHost(conn client.Connection, key VHostKey) (string, string, error) {
	pth := path.Join("/net/vhost", key.HostID, key.Subdomain)

	logger := plog.WithFields(log.Fields{
		"hostid":    key.HostID,
		"subdomain": key.Subdomain,
		"zkpath":    pth,
	})

	vhost := &VHost{}
	err := conn.Get(pth, vhost)
	if err == client.ErrNoNode {
		logger.WithError(err).Debug("Virtual host subdomain not found")
		return "", "", nil
	} else if err != nil {
		logger.WithError(err).Debug("Could not look up virtual host subdomain")
		return "", "", &RegistryError{
			Action:  "get",
			Path:    pth,
			Message: "could not look up virtual host subdomain",
		}
	}

	logger.WithFields(log.Fields{
		"tenantid":    vhost.TenantID,
		"application": vhost.Application,
	}).Debug("Found vhost subdomain")

	return vhost.ServiceID, vhost.Application, nil
}
1332621
func (c *Client) doHTTPGet(url string, data url.Values) (*http.Response, error) {
	if data != nil {
		url = url + "?" + data.Encode()
	}
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return nil, err
	}

	return c.doHTTP(req)
}
828585
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	r.Router.ServeHTTP(w, req)
}
131339
func (h HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	h(C{}, w, r)
}
278892
func (p *Plugin) GetPort() int {
	if p.Config != nil {
		return p.Config.GetPort()
	}
	return 0
}
131476
func GetFreePort() (int, error) {
	addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
	if err != nil {
		return 0, err
	}

	l, err := net.ListenTCP("tcp", addr)
	if err != nil {
		return 0, err
	}
	defer l.Close()
	return l.Addr().(*net.TCPAddr).Port, nil
}
1052542
func getHost(r *http.Request) string {
	if r.Host != "" {
		return r.Host
	}

	return r.URL.Host
}
307508
func (r Network_Interconnect_Tenant) GetPorts(provider *string) (resp string, err error) {
	params := []interface{}{
		provider,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Interconnect_Tenant", "getPorts", params, &r.Options, &resp)
	return
}
716983
func (i *Import) GetHTMLURL() string {
	if i == nil || i.HTMLURL == nil {
		return ""
	}
	return *i.HTMLURL
}
1264954
func getEndpointsAndPort(endpoints []string) (endpointsR []string, portR int, err error) {
	var resultEndpoints []string
	var resultPort int

	if len(endpoints) > 1 {
		return nil, 0, ErrInvalidEndpointConfig
	}

	if len(endpoints[0]) > 0 {
		v := endpoints[0]

		if !strings.Contains(v, ":") {
			return nil, 0, ErrInvalidEndpointConfig
		}

		if strings.Contains(v, ",") {
			endpointsAndPort := strings.Split(v, ",")
			for _, val := range endpointsAndPort {
				endpointAndPort := strings.Split(val, ":")
				resultEndpoints = append(resultEndpoints, endpointAndPort[0])
				resultPort, err = strconv.Atoi(endpointAndPort[1])
				if err != nil {
					return nil, 0, err
				}
			}

		} else {
			endpointAndPort := strings.Split(v, ":")
			resultEndpoints = append(resultEndpoints, endpointAndPort[0])
			resultPort, err = strconv.Atoi(endpointAndPort[1])
			if err != nil {
				return nil, 0, err
			}
		}
	} else {
		return nil, 0, ErrInvalidEndpointConfig
	}

	return resultEndpoints, resultPort, nil
}