// Transport returns the protocol of the string s
490415
func Transport(s string) string {
	switch {
	case strings.HasPrefix(s, TransportTLS+"://"):
		return TransportTLS
	case strings.HasPrefix(s, TransportDNS+"://"):
		return TransportDNS
	case strings.HasPrefix(s, TransportGRPC+"://"):
		return TransportGRPC
	}
	return TransportDNS
}
827409
func Protocol(url string) string {
	if index := strings.Index(url, "://"); index > -1 {
		return url[:index]
	}
	return ""
}
848229
func (a *adapter) Send(res *hal.Response, strings ...string) error {
	for _, str := range strings {
		err := a.writeString(str)
		if err != nil {
			log.Println("error: ", err)
			return err
		}
	}

	return nil
}
337998
func (a *adapter) Send(res *hal.Response, strings ...string) error {
	hal.Logger.Debug("irc - sending IRC response")
	for _, str := range strings {
		s := &ircPayload{
			Channel: res.Message.Room,
			Text:    str,
		}
		a.conn.Privmsg(s.Channel, s.Text)
	}
	hal.Logger.Debug("irc - sent IRC response")
	return nil
}
610532
func (c *Client) send(name string, value interface{}, suffix []byte, tags []string, rate float64) error {
	if c == nil {
		return fmt.Errorf("Client is nil")
	}
	if rate < 1 && rand.Float64() > rate {
		return nil
	}
	data := c.format(name, value, suffix, tags, rate)
	return c.sendMsg(data)
}
408347
func (t *AsyncTransport) Send(body map[string]interface{}) error {
	if len(t.bodyChannel) < t.Buffer {
		t.waitGroup.Add(1)
		p := payload{
			body:        body,
			retriesLeft: t.RetryAttempts,
		}
		t.bodyChannel <- p
	} else {
		err := ErrBufferFull{}
		rollbarError(t.Logger, err.Error())
		if t.PrintPayloadOnError {
			writePayloadToStderr(t.Logger, body)
		}
		return err
	}
	return nil
}
1017631
func Transport(modifyTransport func(*http.Transport)) ConfigOpt {
	return func(c *Config) {
		if modifyTransport != nil {
			modifyTransport(c.transport)
		}
	}
}
538553
func Transport(t transport.Transport) Option {
	return func(o *Options) {
		o.Transport = t
	}
}
549435
func (conn *UDPConn) Send(p Packet) error {
	_, err := conn.Write(p.Bytes())
	return err
}
1310528
func transportFromEnv() http.RoundTripper {
	for _, v := range []string{"HTTPS_PROXY", "HTTP_PROXY"} {
		if proxy := os.Getenv(v); proxy != "" {
			if u, err := url.Parse(proxy); err == nil {
				return &http.Transport{
					Proxy: http.ProxyURL(u),
				}
			}
		}
	}
	return nil
}
738145
func (c *TCPConnection) String() string {

	return fmt.Sprintf("state:%d auth: %+v", c.state, c.Auth)
}
809902
func NewTransport(opts ...Option) *Transport {
	t := &Transport{}
	for _, o := range opts {
		o(t)
	}
	return t
}
1143743
func (u *Endpoint) String() string {
	var buf bytes.Buffer
	if u.Protocol != "" {
		buf.WriteString(u.Protocol)
		buf.WriteByte(':')
	}

	if u.Protocol != "" || u.Host != "" || u.User != "" || u.Password != "" {
		buf.WriteString("//")

		if u.User != "" || u.Password != "" {
			buf.WriteString(url.PathEscape(u.User))
			if u.Password != "" {
				buf.WriteByte(':')
				buf.WriteString(url.PathEscape(u.Password))
			}

			buf.WriteByte('@')
		}

		if u.Host != "" {
			buf.WriteString(u.Host)

			if u.Port != 0 {
				port, ok := defaultPorts[strings.ToLower(u.Protocol)]
				if !ok || ok && port != u.Port {
					fmt.Fprintf(&buf, ":%d", u.Port)
				}
			}
		}
	}

	if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
		buf.WriteByte('/')
	}

	buf.WriteString(u.Path)
	return buf.String()
}
758164
func (ctx *Context) Protocol() string {
	if ctx.Req.TLS != nil {
		return "https"
	}
	switch p := ctx.GetHeader(HeaderXForwardedProto); p {
	case "http", "https":
		return p
	default:
		return "http"
	}
}
795462
func (r *reply) send(bv uint64) error {
	type resp struct {
		ReqID, BV uint64
		Data      rlp.RawValue
	}
	return p2p.Send(r.w, r.msgcode, resp{r.reqID, bv, r.data})
}
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 ``
	}
}
1372838
func (b *IrcBot) String() string {
	s := fmt.Sprintf("server: %s\n", b.server)
	s += fmt.Sprintf("port: %s\n", b.port)
	s += fmt.Sprintf("ssl: %t\n", b.encrypted)

	if len(b.channels) > 0 {
		s += "channels: "
		for _, v := range b.channels {
			s += fmt.Sprintf("%s ", v)
		}
	}

	return s
}