mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
chore: add patch for debug api,better workflow.
This commit is contained in:
parent
ee21b7bc37
commit
884db8a8b5
23
.github/workflows/prerelease.yml
vendored
23
.github/workflows/prerelease.yml
vendored
|
@ -63,17 +63,16 @@ jobs:
|
|||
id: "8",
|
||||
}
|
||||
- { type: "WithCGO", target: "windows/*", id: "1" }
|
||||
- { type: "WithCGO", target: "linux/386,linux/amd64", id: "2" }
|
||||
- { type: "WithCGO", target: "linux/arm64,linux/riscv64", id: "3" }
|
||||
- {
|
||||
type: "WithCGO",
|
||||
target: "linux/arm,linux/arm-6,linux/arm-7",
|
||||
id: "4",
|
||||
}
|
||||
- { type: "WithCGO", target: "linux/mips,linux/mipsle", id: "5" }
|
||||
- { type: "WithCGO", target: "linux/mips64,linux/mips64le", id: "6" }
|
||||
- { type: "WithCGO", target: "darwin-10.16/*", id: "7" }
|
||||
- { type: "WithCGO", target: "android", id: "8" }
|
||||
- { type: "WithCGO", target: "linux/386", id: "2" }
|
||||
- { type: "WithCGO", target: "linux/amd64", id: "3" }
|
||||
- { type: "WithCGO", target: "linux/arm64,linux/riscv64", id: "4" }
|
||||
- { type: "WithCGO", target: "linux/arm,", id: "5" }
|
||||
- { type: "WithCGO", target: "linux/arm-6,linux/arm-7", id: "6" }
|
||||
- { type: "WithCGO", target: "linux/mips,linux/mipsle", id: "7" }
|
||||
- { type: "WithCGO", target: "linux/mips64", id: "8" }
|
||||
- { type: "WithCGO", target: "linux/mips64le", id: "9" }
|
||||
- { type: "WithCGO", target: "darwin-10.16/*", id: "10" }
|
||||
- { type: "WithCGO", target: "android", id: "11" }
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
|
@ -287,4 +286,4 @@ jobs:
|
|||
linux/amd64
|
||||
linux/arm64/v8
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
|
53
patch/add_debug_api.patch
Normal file
53
patch/add_debug_api.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
Subject: [PATCH] Chore: add debug api
|
||||
---
|
||||
Index: hub/route/debug.go
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/hub/route/debug.go b/hub/route/debug.go
|
||||
new file mode 100644
|
||||
--- /dev/null (revision df1007e2b14f7a526d176410995998bf06054657)
|
||||
+++ b/hub/route/debug.go (revision df1007e2b14f7a526d176410995998bf06054657)
|
||||
@@ -0,0 +1,21 @@
|
||||
+package route
|
||||
+
|
||||
+import (
|
||||
+ "github.com/Dreamacro/clash/log"
|
||||
+ "github.com/go-chi/chi/v5"
|
||||
+ "github.com/go-chi/chi/v5/middleware"
|
||||
+ "net/http"
|
||||
+ "runtime"
|
||||
+)
|
||||
+
|
||||
+func debugRouter() http.Handler {
|
||||
+ handler := middleware.Profiler()
|
||||
+ r := chi.NewRouter()
|
||||
+ r.Mount("/", handler)
|
||||
+ r.Put("/gc", func(writer http.ResponseWriter, request *http.Request) {
|
||||
+ log.Debugln("trigger GC")
|
||||
+ runtime.GC()
|
||||
+ })
|
||||
+
|
||||
+ return r
|
||||
+}
|
||||
Index: hub/route/server.go
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/hub/route/server.go b/hub/route/server.go
|
||||
--- a/hub/route/server.go (revision f83fd6c690928ca7861196e3ca5af566303f95d5)
|
||||
+++ b/hub/route/server.go (revision df1007e2b14f7a526d176410995998bf06054657)
|
||||
@@ -59,6 +59,11 @@
|
||||
MaxAge: 300,
|
||||
})
|
||||
r.Use(corsM.Handler)
|
||||
+
|
||||
+ r.Group(func(r chi.Router) {
|
||||
+ r.Mount("/debug", debugRouter())
|
||||
+ })
|
||||
+
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(authentication)
|
||||
r.Get("/", hello)
|
Loading…
Reference in New Issue
Block a user