func NewDialer(addr string) (*Dialer, error) {
	d := &Dialer{
		ProxyNetwork: "tcp",
		Timeout:      time.Minute,
	}
	u, err := url.Parse(addr)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "socks5":
		d.IsResolve = true
	case "socks5h":
	default:
		return nil, fmt.Errorf("unsupported protocol '%s'", u.Scheme)
	}
	host := u.Host
	port := u.Port()
	if port == "" {
		port = "1080"
		hostname := u.Hostname()
		host = net.JoinHostPort(hostname, port)
	}
	if u.User != nil {
		d.Username = u.User.Username()
		d.Password, _ = u.User.Password()
	}
	d.ProxyAddress = host
	return d, nil
}
// NewDialer returns a new Dialer that dials through the provided
// proxy server's network and address.
NewDialer returns a new Dialer that dials through the provided
proxy server's network and address.
// NewDialer returns a new Dialer that dials through the provided // proxy server ' s network and address .
func NewDialer(addr string) (*Dialer, error) {
	d := &Dialer{
		ProxyNetwork: "tcp",
		Timeout:      time.Minute,
	}
	u, err := url.Parse(addr)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "socks5":
		d.IsResolve = true
	case "socks5h":
	default:
		return nil, fmt.Errorf("unsupported protocol '%s'", u.Scheme)
	}
	host := u.Host
	port := u.Port()
	if port == "" {
		port = "1080"
		hostname := u.Hostname()
		host = net.JoinHostPort(hostname, port)
	}
	if u.User != nil {
		d.Username = u.User.Username()
		d.Password, _ = u.User.Password()
	}
	d.ProxyAddress = host
	return d, nil
}
func NewDialer ( addr string ) ( * Dialer , error ) { d := & Dialer { ProxyNetwork : " " , Timeout : time . Minute , } u , err := url . Parse ( addr ) if err != nil { return nil , err } switch u . Scheme { case " " : d . IsResolve = true case " " : default : return nil , fmt . Errorf ( " " , u . Scheme ) } host := u . Host port := u . Port ( ) if port == " " { port = " " hostname := u . Hostname ( ) host = net . JoinHostPort ( hostname , port ) } if u . User != nil { d . Username = u . User . Username ( ) d . Password , _ = u . User . Password ( ) } d . ProxyAddress = host return d , nil }
NewDialer returns a new Dialer that dials through the provided
proxy server's network and address.
NewDialer returns a new Dialer that dials through the provided proxy server ' s network and address .