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

DialV2: add support for custom timeouts #64

Merged
merged 5 commits into from
Jan 29, 2024

Conversation

fialhopm
Copy link
Contributor

Add support for custom transport timeouts. Discussed here.

@gebn
Copy link
Owner

gebn commented Jan 26, 2024

What do you think about using the functional options pattern here? It would result in an API like bmc.DialV2(addr, bmc.WithTimeout(timeout)). Those not wanting to specify a timeout would omit the second arg. Admittedly it would be verbose for this, but more extensible for the future, and could be shared between Dial() and DialV2().

@gebn gebn closed this Jan 26, 2024
@gebn gebn reopened this Jan 26, 2024
bmc.go Outdated
@@ -23,36 +23,55 @@ var (
namespace = "bmc"
)

type Config struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a more descriptive name? E.g., V2SessionlessTransportConfig or DialConfig.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree Config is a little too generic. I would use DialConfig and DialConfigOption. I'm not sure what the conventions are around exporting DialConfig - can we get away with dialConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get away with dialConfig?

I believe we can: https://pkg.go.dev/golang.org/x/net/idna#Option

@gebn gebn merged commit f4e873f into gebn:master Jan 29, 2024
1 check 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.

2 participants