start dailymotion support, improve vendor support
This commit is contained in:
@@ -18,10 +18,10 @@ import (
|
||||
type ExpressVPN struct {
|
||||
}
|
||||
|
||||
func (s *ExpressVPN) ServerList() (error, *[]string) {
|
||||
func (s *ExpressVPN) ServerList() (error, *map[string]string) {
|
||||
var mux sync.Mutex
|
||||
requestCount := 0
|
||||
VPNNames := map[string]bool{}
|
||||
VPNNames := map[string]string{}
|
||||
|
||||
// Create HTTP client with timeout
|
||||
client := &http.Client{
|
||||
@@ -67,14 +67,15 @@ func (s *ExpressVPN) ServerList() (error, *[]string) {
|
||||
|
||||
requestCount++
|
||||
go func(line string) {
|
||||
conv := "%s-ca-version-2.expressnetw.com"
|
||||
line = strings.ToLower(line)
|
||||
line = strings.Replace(line, " & ", "", -1)
|
||||
line = strings.Replace(line, " ", "", -1)
|
||||
|
||||
name := fmt.Sprintf("%s-ca-version-2.expressnetw.com", line)
|
||||
name := fmt.Sprintf(conv, line)
|
||||
if _, err := net.ResolveIPAddr("ip4", name); err == nil {
|
||||
mux.Lock()
|
||||
VPNNames[name] = true
|
||||
VPNNames[line] = name
|
||||
mux.Unlock()
|
||||
}
|
||||
requestCount--
|
||||
@@ -90,11 +91,5 @@ func (s *ExpressVPN) ServerList() (error, *[]string) {
|
||||
return errors.New("Can't get a list of VPN endpoints"), nil
|
||||
}
|
||||
|
||||
// add the right values
|
||||
keys := make([]string, 0, len(VPNNames))
|
||||
for k := range VPNNames {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
|
||||
return nil, &keys
|
||||
return nil, &VPNNames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user