func NewSimpleServer(addr string) (*SimpleServer, error) {
	s := &SimpleServer{}
	u, err := url.Parse(addr)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "socks5", "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 {
		s.Username = u.User.Username()
		s.Password, _ = u.User.Password()
		s.Authentication = UserAuth(s.Username, s.Password)
	}

	s.Address = host
	s.Network = "tcp"
	return s, nil
}
// NewServer creates a new NewSimpleServer
NewServer creates a new NewSimpleServer
// NewServer creates a new NewSimpleServer
func NewSimpleServer(addr string) (*SimpleServer, error) {
	s := &SimpleServer{}
	u, err := url.Parse(addr)
	if err != nil {
		return nil, err
	}
	switch u.Scheme {
	case "socks5", "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 {
		s.Username = u.User.Username()
		s.Password, _ = u.User.Password()
		s.Authentication = UserAuth(s.Username, s.Password)
	}
	s.Address = host
	s.Network = "tcp"
	return s, nil
}
func NewSimpleServer ( addr string ) ( * SimpleServer , error ) { s := & SimpleServer { } u , err := url . Parse ( addr ) if err != nil { return nil , err } switch u . Scheme { 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 { s . Username = u . User . Username ( ) s . Password , _ = u . User . Password ( ) s . Authentication = UserAuth ( s . Username , s . Password ) } s . Address = host s . Network = " " return s , nil }
NewServer creates a new NewSimpleServer
NewServer creates a new NewSimpleServer