func RegisterHandlerDirective(dir string, setupFunc UnmarshalHandlerFunc) {
	RegisterDirective(dir, func(h Helper) ([]ConfigValue, error) {
		if !h.Next() {
			return nil, h.ArgErr()
		}
		matcherSet, err := h.ExtractMatcherSet()
		if err != nil {
			return nil, err
		}
		val, err := setupFunc(h)
		if err != nil {
			return nil, err
		}
		return h.NewRoute(matcherSet, val), nil
	})
}
RegisterHandlerDirective is like RegisterDirective, but for
directives which specifically output only an HTTP handler.
Directives registered with this function will always have
an optional matcher token as the first argument.
package httpcaddyfile
import (
	"encoding/json"
	"net"
	"sort"
	"strconv"
	"strings"
	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
	"github.com/caddyserver/caddy/v2/modules/caddyhttp"
)
var directiveOrder = []string{
	"map",
	"root",
	"header",
	"request_body",
	"redir",
	"rewrite",
	"uri",
	"try_files",
	"basicauth",
	"request_header",
	"encode",
	"push",
	"templates",
	"handle",
	"handle_path",
	"route",
	"abort",
	"error",
	"respond",
	"metrics",
	"reverse_proxy",
	"php_fastcgi",
	"file_server",
	"acme_server",
}
func directiveIsOrdered(dir string) bool {
	for _, d := range directiveOrder {
		if d == dir {
			return true
		}
	}
	return false
}
func RegisterDirective(dir string, setupFunc UnmarshalFunc) {
	if _, ok := registeredDirectives[dir]; ok {
		panic("directive " + dir + " already registered")
	}
	registeredDirectives[dir] = setupFunc
}