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

fix proxy setting when ratelimit is 0 #402

Merged
merged 2 commits into from
Aug 8, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ This will display help for the tool. Here are all the switches it supports.
| `-no-color` | disable colors in output | `notify -nc` |
| `-provider-config` | provider config path | `notify -pc provider.yaml` |
| `-provider` | provider to send the notification to (optional) | `notify -p slack,telegram` |
| `-proxy` | http proxy to use with notify | `notify -proxy http://127.0.0.1:8080` |
| `-proxy` | HTTP/SOCKSv5 proxy to use with notify | `notify -proxy http://127.0.0.1:8080` |
| `-rate-limit` | maximum number of HTTP requests to send per second | `notify -rl 1` |
| `-silent` | enable silent mode | `notify -silent` |
| `-verbose` | enable verbose mode | `notify -verbose` |
Expand Down
2 changes: 1 addition & 1 deletion cmd/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func readConfig() {
set.BoolVarP(&options.Verbose, "verbose", "v", false, "enable verbose mode")
set.BoolVar(&options.Version, "version", false, "display version")
set.BoolVarP(&options.NoColor, "no-color", "nc", false, "disable colors in output")
set.StringVar(&options.Proxy, "proxy", "", "HTTP Proxy to use with notify")
set.StringVar(&options.Proxy, "proxy", "", "HTTP/SOCKSv5 proxy to use with notify")
set.CallbackVarP(runner.GetUpdateCallback(), "update", "up", "update notify to latest version")
set.BoolVarP(&options.DisableUpdateCheck, "disable-update-check", "duc", false, "disable automatic notify update check")

Expand Down
1 change: 1 addition & 0 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (r *Runner) Run() error {
}
}

http.DefaultClient.Transport = defaultTransport
if r.options.RateLimit > 0 {
http.DefaultClient.Transport = utils.NewThrottledTransport(time.Second, r.options.RateLimit, defaultTransport)
}
Expand Down
Loading