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: convert timeout flag to support time formats (e.g., 5s, 100ms) #1344

Merged
merged 2 commits into from
Jan 20, 2025

Conversation

soonghee2
Copy link
Contributor

@soonghee2 soonghee2 commented Jan 17, 2025

What does this PR do?

  • Converts the timeout flag to use flagSet.DurationVar to support time formats (e.g., 5s, 500ms).
  • Maintains backward compatibility for integer inputs as milliseconds.
  • Applies a default timeout of 100ms for invalid inputs.

Why is this needed?

  • This enhancement improves flexibility for users by allowing them to specify timeouts in a more intuitive way.

Related Issue

detailed

Change the Option.timeout variable type to time.Duration.
Declare a new Option.StrTimeout field as a string to receive the timeout option in string format.
If the string represents an integer, interpret it as milliseconds (as before).
If the string is in formats like 3s or 1m, parse it directly as a time.Duration with time.ParseDuration.

@Mzack9999 Mzack9999 self-requested a review January 19, 2025 10:23
@GeorginaReeder
Copy link

Thanks for your contribution @soonghee2 ! :)

@Mzack9999 Mzack9999 merged commit f334e8d into projectdiscovery:dev Jan 20, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

timeout flag from int to DurationVar
3 participants