-
Notifications
You must be signed in to change notification settings - Fork 577
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
feat(agent): expose HTTP debug server over tailnet API #12582
Conversation
@@ -36,6 +36,8 @@ func (a *agent) apiHandler() http.Handler { | |||
cacheDuration: cacheDuration, | |||
} | |||
r.Get("/api/v0/listening-ports", lp.handler) | |||
r.Get("/debug/magicsock", a.HandleHTTPDebugMagicsock) | |||
r.Get("/debug/magicsock/debug-logging/{state}", a.HandleHTTPMagicsockDebugLoggingState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: /debug/magicsock/debug...
sounds weird. Maybe POST /debug/magicsock/enable-logger
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep this the same for consistency purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
agent/agent.go
Outdated
func (a *agent) HandleHTTPDebugMagicsock(w http.ResponseWriter, r *http.Request) { | ||
network, ok := a.requireNetwork() | ||
if !ok { | ||
w.WriteHeader(http.StatusNotFound) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't that be a different HTTP status? 503?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make the arguemnt yeah, but I didn't see a huge need to change it in this PR. Since it's a debug endpoint though, it's probably fine to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Related to #12161
Exposes the agent magicsock handler over tailnet so you can just dial it over an agent conn.