// Returns the protocol component of the string.
345294
func (self *ConnectionString) Protocol(defaults ...string) string {

	if _, protocol := self.Scheme(); protocol != `` {
		return protocol
	} else if len(defaults) > 0 {
		return defaults[0]
	} else {
		return ``
	}
}
811962
func (cp ClientProtocol) String() string {
	switch cp {
	case MySQL:
		return "mysql"
	case GRPCVtgate:
		return "grpc-vtgate"
	case GRPCVttablet:
		return "grpc-vttablet"
	default:
		return fmt.Sprintf("unknown-protocol-%d", cp)
	}
}
51759
func (_class SDNControllerClass) GetProtocol(sessionID SessionRef, self SDNControllerRef) (_retval SdnControllerProtocol, _err error) {
	_method := "SDN_controller.get_protocol"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertSDNControllerRefToXen(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 = convertEnumSdnControllerProtocolToGo(_method + " -> ", _result.Value)
	return
}
15758
func (s *Stream) Protocol() protocol.ID {
	// Ignore type error. It means that the protocol is unset.
	p, _ := s.protocol.Load().(protocol.ID)
	return p
}
1223407
func protocolToString(proto Protocol) string {
	switch proto {
	case syscall.IPPROTO_TCP:
		return "TCP"
	case syscall.IPPROTO_UDP:
		return "UDP"
	case syscall.IPPROTO_SCTP:
		return "SCTP"
	}
	return ""
}
381727
func (self *ConnectionString) Scheme() (string, string) {
	backend, protocol := stringutil.SplitPair(self.URI.Scheme, `+`)
	return backend, strings.Trim(protocol, `/`)
}
152687
func (v *Xtruct2) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.ByteThing != nil {
		fields[i] = fmt.Sprintf("ByteThing: %v", *(v.ByteThing))
		i++
	}
	if v.StructThing != nil {
		fields[i] = fmt.Sprintf("StructThing: %v", v.StructThing)
		i++
	}
	if v.I32Thing != nil {
		fields[i] = fmt.Sprintf("I32Thing: %v", *(v.I32Thing))
		i++
	}

	return fmt.Sprintf("Xtruct2{%v}", strings.Join(fields[:i], ", "))
}
690045
func (i IPv4) String() string {
	ip := make(net.IP, 4)
	binary.BigEndian.PutUint32(ip, uint32(i))
	return ip.String()
}
803307
func (v *RPC) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [10]string
	i := 0
	fields[i] = fmt.Sprintf("SpanContext: %v", v.SpanContext)
	i++
	fields[i] = fmt.Sprintf("CallerName: %v", v.CallerName)
	i++
	fields[i] = fmt.Sprintf("ServiceName: %v", v.ServiceName)
	i++
	fields[i] = fmt.Sprintf("Encoding: %v", v.Encoding)
	i++
	fields[i] = fmt.Sprintf("Procedure: %v", v.Procedure)
	i++
	if v.Headers != nil {
		fields[i] = fmt.Sprintf("Headers: %v", v.Headers)
		i++
	}
	if v.ShardKey != nil {
		fields[i] = fmt.Sprintf("ShardKey: %v", *(v.ShardKey))
		i++
	}
	if v.RoutingKey != nil {
		fields[i] = fmt.Sprintf("RoutingKey: %v", *(v.RoutingKey))
		i++
	}
	if v.RoutingDelegate != nil {
		fields[i] = fmt.Sprintf("RoutingDelegate: %v", *(v.RoutingDelegate))
		i++
	}
	if v.Body != nil {
		fields[i] = fmt.Sprintf("Body: %v", v.Body)
		i++
	}

	return fmt.Sprintf("RPC{%v}", strings.Join(fields[:i], ", "))
}
351380
func (c *Controller) ProtocolInfo() ([]string, string, string, error) {
	// We'll start off by sending the "PROTOCOLINFO" command to the Tor
	// server. We should receive a reply of the following format:
	//
	//	METHODS=COOKIE,SAFECOOKIE
	//	COOKIEFILE="/home/user/.tor/control_auth_cookie"
	//	VERSION Tor="0.3.2.10"
	//
	// We're interested in retrieving all of these fields, so we'll parse
	// our reply to do so.
	cmd := fmt.Sprintf("PROTOCOLINFO %d", ProtocolInfoVersion)
	_, reply, err := c.sendCommand(cmd)
	if err != nil {
		return nil, "", "", err
	}

	info := parseTorReply(reply)
	methods, ok := info["METHODS"]
	if !ok {
		return nil, "", "", errors.New("auth methods not found in " +
			"reply")
	}

	cookieFile, ok := info["COOKIEFILE"]
	if !ok && !strings.Contains(methods, "NULL") {
		return nil, "", "", errors.New("cookie file path not found " +
			"in reply")
	}

	version, ok := info["Tor"]
	if !ok {
		return nil, "", "", errors.New("Tor version not found in reply")
	}

	// Finally, we'll clean up the results before returning them.
	authMethods := strings.Split(methods, ",")
	cookieFilePath := strings.Trim(cookieFile, "\"")
	torVersion := strings.Trim(version, "\"")

	return authMethods, cookieFilePath, torVersion, nil
}
363352
func (p *Prefix) String() (s string) {
	// Benchmarks revealed that in this case simple string concatenation
	// is actually faster than using a ByteBuffer as in (*Message).String()
	s = p.Name
	if len(p.User) > 0 {
		s = s + string(prefixUser) + p.User
	}
	if len(p.Host) > 0 {
		s = s + string(prefixHost) + p.Host
	}
	return
}
611750
func (p *Peer) ProtocolVersion() uint32 {
	p.flagsMtx.Lock()
	protocolVersion := p.protocolVersion
	p.flagsMtx.Unlock()

	return protocolVersion
}
1297543
func (p *peer) String() string {
	return fmt.Sprintf("%x@%s", p.pubKeyBytes, p.conn.RemoteAddr())
}
926082
func (c certificate) String() string {
	b, err := asn1.Marshal(c)
	if err != nil {
		return fmt.Sprintf("Failed marshaling cert: %v", err)
	}
	block := &pem.Block{
		Bytes: b,
		Type:  "CERTIFICATE",
	}
	b = pem.EncodeToMemory(block)
	return string(b)
}
280737
func (u URI) String() string {
	return fmt.Sprintf("%s://%s:%d", u.Scheme, u.Host, u.Port)
}
98398
func (s *PublicEthereumAPI) ProtocolVersion() hexutil.Uint {
	return hexutil.Uint(s.b.ProtocolVersion())
}
1113772
func (c *component) String() string {
	var str string

	for _, fn := range c.fns {
		str += fn.String()
	}
	return str
}