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

allow passing context to GetCertificate #9

Merged
merged 1 commit into from
May 17, 2024
Merged

allow passing context to GetCertificate #9

merged 1 commit into from
May 17, 2024

Conversation

willnorris
Copy link
Member

@willnorris willnorris commented May 17, 2024

Add a new GetCertificateWithContext to allow passing an existing context. Also export the default dialer method, so that callers that override TailscaledDialer can fall back to this if other methods fail.

This is being added to support the caddy-tailscale plugin to work with caddy's auto_https functionality. See tailscale/caddy-tailscale#53

/cc @mholt

tscert.go Outdated
)

func defaultDialer(ctx context.Context, network, addr string) (net.Conn, error) {
func DefaultDialer(ctx context.Context, network, addr string) (net.Conn, error) {
Copy link
Member

Choose a reason for hiding this comment

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

this isn't the best name imo. And would need docs.

Copy link
Member

Choose a reason for hiding this comment

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

It sounds like a type or var. A func would sound like a verb.

Copy link
Member Author

Choose a reason for hiding this comment

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

just Dial? DialLocalAPI?

Copy link
Member Author

Choose a reason for hiding this comment

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

went with DialLocalAPI.

Copy link
Member

Choose a reason for hiding this comment

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

Sgtm

Add a new GetCertificateWithContext to allow passing an existing
context.  Also export the default dialer method, so that callers that
override TailscaledDialer can fall back to this if other methods fail.

Signed-off-by: Will Norris <will@tailscale.com>
@willnorris willnorris merged commit bbccfbf into main May 17, 2024
@willnorris willnorris deleted the will/ctx branch May 17, 2024 23:26
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.

None yet

3 participants