You've already forked directdnsonly-go
35 lines
830 B
Go
35 lines
830 B
Go
package handlers
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/guisea/directdnsonly/internal/util"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func DNSAdmin(c echo.Context) error {
|
|
// Implementation still to come
|
|
if c.Request().Method == "POST" {
|
|
action := c.QueryParam("action")
|
|
c.Logger().Debug("Action received via querystring: " + action)
|
|
body := c.Request().Body
|
|
respBytes, err := io.ReadAll(body)
|
|
if err != nil {
|
|
c.Logger().Error(err)
|
|
}
|
|
c.Logger().Debugf("Body of request: %s", respBytes)
|
|
if action == "" {
|
|
c.Logger().Debug("Action was not found, check body")
|
|
decoded_params := util.DecodeParams(string(respBytes))
|
|
|
|
c.Logger().Debugf("Parameters decoded: %s", decoded_params)
|
|
action = decoded_params["action"]
|
|
}
|
|
// zone_file := body
|
|
}
|
|
if c.Request().Method == "GET" {
|
|
// Implement some stuff
|
|
}
|
|
return nil
|
|
}
|