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

tunnel: introduce custom Duration for time fields #1303

Merged
merged 1 commit into from Jun 19, 2023

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Jun 8, 2023

All Tunnel timeout values are based on seconds however, there isn't a great way to do this in a flexible way with Go due to time.Duration not having marshal/unmarshal support in Go 1. Instead, we introduce a custom TunnelDuration value here and ensure it always converts durations into seconds without impacting other users of time.Duration.

This is similarly handled in cloudflared too.

@jacobbednarz
Copy link
Member Author

cc @obezuk

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

changelog detected ✅

@codecov-commenter
Copy link

Codecov Report

Merging #1303 (81cb9bc) into master (5584c5b) will increase coverage by 0.00%.
The diff coverage is 66.66%.

@@           Coverage Diff           @@
##           master    #1303   +/-   ##
=======================================
  Coverage   49.07%   49.08%           
=======================================
  Files         134      134           
  Lines       13090    13099    +9     
=======================================
+ Hits         6424     6429    +5     
- Misses       5162     5165    +3     
- Partials     1504     1505    +1     
Impacted Files Coverage Δ
access_application.go 76.52% <ø> (ø)
load_balancing.go 59.40% <ø> (ø)
stream.go 64.91% <ø> (ø)
tunnel.go 42.41% <66.66%> (+1.01%) ⬆️

... and 1 file with indirect coverage changes

tunnel_test.go Outdated Show resolved Hide resolved
tunnel_test.go Outdated Show resolved Hide resolved
All Tunnel timeout values are based on seconds however, there isn't a great way
to do this in a flexible way with Go due to `time.Duration` not having
marshal/unmarshal support in Go 1[1]. Instead, we introduce a custom
`TunnelDuration` value here and ensure it always converts durations into
seconds without impacting other users of `time.Duration`.

[1]: golang/go#10275
@jacobbednarz jacobbednarz merged commit 7142ade into cloudflare:master Jun 19, 2023
11 checks passed
@jacobbednarz jacobbednarz deleted the refine-tunnel-duration branch June 19, 2023 23:32
@github-actions github-actions bot added this to the v0.70.0 milestone Jun 19, 2023
github-actions bot pushed a commit that referenced this pull request Jun 19, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v0.70.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants