refactor and remove unused code

This commit is contained in:
yusing
2025-02-10 09:52:53 +08:00
parent eaf191e350
commit 0a7b28caf5
15 changed files with 24 additions and 52 deletions

View File

@@ -32,7 +32,7 @@ func (NopWriteCloser) Close() error {
return nil
}
func NewHandler(caCertPEM []byte) http.Handler {
func NewHandler() http.Handler {
mux := ServeMux{http.NewServeMux()}
mux.HandleFunc(agent.EndpointProxyHTTP+"/{path...}", ProxyHTTP)
@@ -40,9 +40,6 @@ func NewHandler(caCertPEM []byte) http.Handler {
mux.HandleMethods("GET", agent.EndpointName, func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, env.AgentName)
})
mux.HandleMethods("GET", agent.EndpointCACert, func(w http.ResponseWriter, r *http.Request) {
w.Write(caCertPEM)
})
mux.HandleMethods("GET", agent.EndpointHealth, CheckHealth)
mux.HandleMethods("GET", agent.EndpointLogs, memlogger.LogsWS(nil))
mux.ServeMux.HandleFunc("/", DockerSocketHandler())