// Return server protocol version number.
334986
func Version(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Cache-Control", "must-revalidate")
	w.Header().Set("Content-Type", "text/plain")
	w.Header().Set("Access-Control-Allow-Origin", "*")
	w.Header().Set("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS")
	w.Write([]byte("6"))
}
684105
func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error) {
	reqOpts := h.opts
	for _, opt := range opts {
		opt(&reqOpts)
	}
	req := &rls.GetVersionRequest{}
	ctx := NewContext()

	if reqOpts.before != nil {
		if err := reqOpts.before(ctx, req); err != nil {
			return nil, err
		}
	}
	return h.version(ctx, req)
}
1203213
func Version(version string, h http.Handler) http.Handler {
	fn := func(w http.ResponseWriter, r *http.Request) {
		w.Header().Add("X-Chronograf-Version", version)
		h.ServeHTTP(w, r)
	}
	return http.HandlerFunc(fn)
}
827409
func Protocol(url string) string {
	if index := strings.Index(url, "://"); index > -1 {
		return url[:index]
	}
	return ""
}
638910
func (ds *dockerService) getDockerVersion() (*dockertypes.Version, error) {
	v, err := ds.client.Version()
	if err != nil {
		return nil, fmt.Errorf("failed to get docker version: %v", err)
	}
	// Docker API version (e.g., 1.23) is not semver compatible. Add a ".0"
	// suffix to remedy this.
	v.APIVersion = fmt.Sprintf("%s.0", v.APIVersion)
	return v, nil
}
524807
func (n *managedNode) GetSoftwareVersion() (string, error) {
	n.RLock()
	defer n.RUnlock()
	ctx, _ := context.WithTimeout(context.Background(), DEFAULT_CTX_TIMEOUT)
	version, err := n.client.SoftwareVersion(ctx, &cc.EmptyMsg{})
	return version.Version, err
}
1139106
func (remote *RemoteDebugger) Version() (*Version, error) {
	resp, err := responseError(remote.http.Get("/json/version", nil, nil))
	if err != nil {
		return nil, err
	}

	var version Version

	if err = decode(resp, &version); err != nil {
		return nil, err
	}

	return &version, nil
}
636563
func GetVersionNumber() (int64, int) {
	ver := strings.Replace(GetVersionString(), "-", ".", -1)
	parts := strings.Split(ver, ".")
	multiplier := int64(100 * 100) // major, minor, patch
	version := int64(0)
	buildNum := int(0)
	for i, subVerString := range parts {
		if i == 3 {
			buildNum, _ = strconv.Atoi(subVerString)
			break // done
		}
		subVer, err := strconv.Atoi(subVerString)
		if err != nil {
			break // cannot parse
		}
		version += int64(subVer) * multiplier
		multiplier /= 100

	}
	return version, buildNum
}
1303668
func (rpc *EthRPC) Web3ClientVersion() (string, error) {
	var clientVersion string

	err := rpc.call("web3_clientVersion", &clientVersion)
	return clientVersion, err
}
164704
func (c *Client) Version() (map[string]btcjson.VersionResult, error) {
	return c.VersionAsync().Receive()
}
852012
func (c *Client) DaemonVersion() (string, error) {
	resp, err := c.rpc("daemon.info", rencode.List{}, rencode.Dictionary{})
	if err != nil {
		return "", err
	}
	if resp.IsError() {
		return "", resp.RPCError
	}

	var info string
	err = resp.returnValue.Scan(&info)
	if err != nil {
		return "", err
	}

	return info, nil
}
962885
func (r *Docker) Version() (string, error) {
	// Note: the server daemon has to be running, for this call to return successfully
	ver, err := r.Runner.CombinedOutput("docker version --format '{{.Server.Version}}'")
	if err != nil {
		return "", err
	}

	return strings.Split(ver, "\n")[0], nil
}
640063
func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
	action := testing.ActionImpl{}
	action.Verb = "get"
	action.Resource = schema.GroupVersionResource{Resource: "version"}
	c.Invokes(action, nil)

	if c.FakedServerVersion != nil {
		return c.FakedServerVersion, nil
	}

	versionInfo := kubeversion.Get()
	return &versionInfo, nil
}
162377
func (runner *runner) GetVersion() (string, error) {
	return getIPTablesVersionString(runner.exec, runner.protocol)
}
1274899
func (s *ReleaseServer) GetVersion(c ctx.Context, req *services.GetVersionRequest) (*services.GetVersionResponse, error) {
	v := version.GetVersionProto()
	return &services.GetVersionResponse{Version: v}, nil
}
1027375
func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
	body, err := d.restClient.Get().AbsPath("/version").Do().Raw()
	if err != nil {
		return nil, err
	}
	var info version.Info
	err = json.Unmarshal(body, &info)
	if err != nil {
		return nil, fmt.Errorf("unable to parse the server version: %v", err)
	}
	return &info, nil
}
416292
func (adm *AdminClient) VersionInfo() (verInfo AdminAPIVersionInfo, err error) {
	var resp *http.Response
	resp, err = adm.executeMethod("GET", requestData{relPath: "/version"})
	defer closeResponse(resp)
	if err != nil {
		return verInfo, err
	}

	// Check response http status code
	if resp.StatusCode != http.StatusOK {
		return verInfo, httpRespToErrorResponse(resp)
	}

	respBytes, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return verInfo, err
	}

	// Unmarshal the server's json response
	err = json.Unmarshal(respBytes, &verInfo)
	return verInfo, err
}