Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ua option for cli #186

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Flags:
-m --multi Enable multi-server mode.
-t --thread=THREAD Set the number of concurrent connections.
--search=SEARCH Fuzzy search servers by a keyword.
--ua Set the user-agent header for the speedtest.
--no-download Disable download test.
--no-upload Disable upload test.
--ping-mode Select a method for Ping. (support icmp/tcp/http)
Expand Down
3 changes: 2 additions & 1 deletion speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var (
multi = kingpin.Flag("multi", "Enable multi-server mode.").Short('m').Bool()
thread = kingpin.Flag("thread", "Set the number of concurrent connections.").Short('t').Int()
search = kingpin.Flag("search", "Fuzzy search servers by a keyword.").String()
userAgent = kingpin.Flag("ua", "Set the user-agent header for the speedtest.").String()
noDownload = kingpin.Flag("no-download", "Disable download test.").Bool()
noUpload = kingpin.Flag("no-upload", "Disable upload test.").Bool()
pingMode = kingpin.Flag("ping-mode", "Select a method for Ping. (support icmp/tcp/http)").Default("http").String()
Expand All @@ -42,7 +43,7 @@ func main() {
// 0. speed test setting
var speedtestClient = speedtest.New(speedtest.WithUserConfig(
&speedtest.UserConfig{
UserAgent: speedtest.DefaultUserAgent,
UserAgent: *userAgent,
Proxy: *proxy,
Source: *source,
DnsBindSource: *dnsBindSource,
Expand Down
2 changes: 1 addition & 1 deletion speedtest/speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

var (
version = "1.6.10"
version = "1.6.11"
DefaultUserAgent = fmt.Sprintf("showwin/speedtest-go %s", version)
)

Expand Down
Loading