cmd/wol-proxy: add wol-proxy (#352)

add a wake-on-lan proxy for llama-swap. When the target llama-swap server is unreachable it will send hold a request, send a WoL packet and proxy the request when llama-swap is available.
This commit is contained in:
Benson Wong
2025-10-20 20:55:02 -07:00
committed by GitHub
parent 7ff50631e0
commit c07179d6e2
4 changed files with 297 additions and 1 deletions

View File

@@ -131,7 +131,15 @@ func New(config config.Config) *ProxyManager {
}
func (pm *ProxyManager) setupGinEngine() {
pm.ginEngine.Use(func(c *gin.Context) {
// don't log the Wake on Lan proxy health check
if c.Request.URL.Path == "/wol-health" {
c.Next()
return
}
// Start timer
start := time.Now()
@@ -235,6 +243,11 @@ func (pm *ProxyManager) setupGinEngine() {
c.String(http.StatusOK, "OK")
})
// see cmd/wol-proxy/wol-proxy.go, not logged
pm.ginEngine.GET("/wol-health", func(c *gin.Context) {
c.String(http.StatusOK, "OK")
})
pm.ginEngine.GET("/favicon.ico", func(c *gin.Context) {
if data, err := reactStaticFS.ReadFile("ui_dist/favicon.ico"); err == nil {
c.Data(http.StatusOK, "image/x-icon", data)