projectdiscovery / goflags

A go flag wrapper with convenience helpers
MIT License
84 stars 16 forks source link

Add RateLimit flag #122

Closed dogancanbakir closed 1 year ago

dogancanbakir commented 1 year ago

Proposed changes

we can consider adding new flag type in goflags for ratelimit which accepts ratelimit along with unit

type RateLimit struct{
   MaxTokens unit
   Duration    time.Duration
}

rls := []RateLimit{}
flag.RateLimitVar(&rls, "-rls",nil,"rate limit along with unit ex:  10/ms , 30/m, 8/s ")

ref: https://github.com/projectdiscovery/subfinder/pull/891#pullrequestreview-1525004982