Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions speedtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type Server struct {
DLSpeed float64 `json:"dl_speed"`
ULSpeed float64 `json:"ul_speed"`
TestDuration TestDuration `json:"test_duration"`
CC string `json:"cc"`

Context *Speedtest `json:"-"`
}
Expand Down Expand Up @@ -254,6 +255,14 @@ func (s *Speedtest) FetchServerListContext(ctx context.Context) (Servers, error)
if err = decoder.Decode(&servers); err != nil {
return servers, err
}
if s.config.Location != nil {
for _, server := range servers {
if server.CC != strings.ToUpper(s.config.Location.CC) {
servers = append(servers[:0], servers[1:]...)
Comment thread
r3inbowari marked this conversation as resolved.
Outdated
}
}

}
case typeXMLPayload:
var list ServerList
// Decode xml
Expand Down