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

net/http: add Transport.RoundTrip enforcement hook #68

Merged
merged 1 commit into from
Jul 23, 2023

Conversation

bradfitz
Copy link
Member

@bradfitz bradfitz commented Jul 23, 2023

net/http: add enforcement hook to Transport.RoundTrip, like our net ones

Updates #55
Updates https://github.com/tailscale/corp/issues/12702

@bradfitz bradfitz changed the base branch from tailscale.go1.20 to tailscale.go1.21 July 23, 2023 03:13
src/net/http/tailscale.go Show resolved Hide resolved
if f == nil {
panic("nil func")
}
if roundTripEnforcer != nil {
Copy link

Choose a reason for hiding this comment

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

It's useful to be able to set this back to nil after a test runs. I've run into that issue for the other hooks that we have.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's meant to be installed exactly once in init. If we want per-test control, we provide that ourselves in our installed hook.

The other two hooks are like this too.

Updates #55
Updates tailscale/corp#12702

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
@bradfitz bradfitz merged commit a96a9ed into tailscale.go1.21 Jul 23, 2023
2 checks passed
@bradfitz bradfitz deleted the bradfitz/http_enforce branch July 23, 2023 03:31
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