func connectURL(u url.URL, timeout time.Duration) (net.Conn, error) {
	req, err := http.NewRequest("GET", rpcPrefix, nil)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var conn net.Conn
	switch u.Scheme {
	case "unix", "unixs":
		conn, err = net.DialTimeout("unix", u.Host, timeout)
	default:
		conn, err = net.DialTimeout("tcp", u.Host, timeout)
	}
	if err != nil {
		return nil, errors.Trace(err)
	}

	if err = req.Write(conn); err != nil {
		conn.Close()
		return nil, errors.Trace(err)
	}

	return conn, nil
}
// connectURL returns a rpc connection to the url.
connectURL returns a rpc connection to the url.
// connectURL returns a rpc connection to the url .
func connectURL(u url.URL, timeout time.Duration) (net.Conn, error) {
	req, err := http.NewRequest("GET", rpcPrefix, nil)
	if err != nil {
		return nil, errors.Trace(err)
	}
	var conn net.Conn
	switch u.Scheme {
	case "unix", "unixs":
		conn, err = net.DialTimeout("unix", u.Host, timeout)
	default:
		conn, err = net.DialTimeout("tcp", u.Host, timeout)
	}
	if err != nil {
		return nil, errors.Trace(err)
	}
	if err = req.Write(conn); err != nil {
		conn.Close()
		return nil, errors.Trace(err)
	}
	return conn, nil
}
func connectURL ( u url . URL , timeout time . Duration ) ( net . Conn , error ) { req , err := http . NewRequest ( " " , rpcPrefix , nil ) if err != nil { return nil , errors . Trace ( err ) } var conn net . Conn switch u . Scheme { case " " , " " : conn , err = net . DialTimeout ( " " , u . Host , timeout ) default : conn , err = net . DialTimeout ( " " , u . Host , timeout ) } if err != nil { return nil , errors . Trace ( err ) } if err = req . Write ( conn ) ; err != nil { conn . Close ( ) return nil , errors . Trace ( err ) } return conn , nil }
connectURL returns a rpc connection to the url.
connectURL returns a rpc connection to the url .