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 overriding tailscaled transport #11

Merged
merged 1 commit into from
Jun 8, 2024
Merged

allow overriding tailscaled transport #11

merged 1 commit into from
Jun 8, 2024

Conversation

willnorris
Copy link
Member

This allows callers an alternative to overriding the tailcaled dialer.

Example of how this will be used can be seen in tailscale/caddy-tailscale#67

Updates tailscale/caddy-tailscale#66

tscert.go Outdated
tsClient = &http.Client{
Transport: &http.Transport{
if TailscaledTransport == nil {
TailscaledTransport = &http.Transport{
Copy link
Member

Choose a reason for hiding this comment

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

This package global's fine and defining its nil to mean automatic is fine, but let's not write back to this global.

   tr := TrailscaledTransport
   if tr == nil { 
       tr = &http.Transport{DialContext: TailscaledDialer}
   }
   tsClient = &http.Client{Transport: tr}

Copy link
Member Author

Choose a reason for hiding this comment

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

done

This allows callers an alternative to overriding the tailcaled dialer.

Updates tailscale/caddy-tailscale#66

Signed-off-by: Will Norris <will@tailscale.com>
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

2 participants