2024-10-26 01:56:41 +00:00
|
|
|
package middleware
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2024-10-27 22:42:44 +00:00
|
|
|
"github.com/ekzyis/magicwallet/server/router/context"
|
2024-10-26 01:56:41 +00:00
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
2024-10-27 22:42:44 +00:00
|
|
|
func LndGuard(hc context.Context) echo.MiddlewareFunc {
|
2024-10-26 01:56:41 +00:00
|
|
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
|
|
|
return func(ec echo.Context) error {
|
|
|
|
if hc.Lnd != nil {
|
|
|
|
return next(ec)
|
|
|
|
}
|
|
|
|
return echo.NewHTTPError(http.StatusNotImplemented)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|