You could check how violetear handles dynamic + catchall (wildcard) patterns, this is just for complement for example:
uuid := `[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}`
router.AddRegex(":uuid")
router.HandleFunc("/test/:uuid/:uuid", handleUUID, "GET,HEAD")
In this case, the request may have 2 different UUIDS
For a dynamic/wildcard this could apply:
http://api.violetear.org/command/ping/127.0.0.1
\______/\___/\________/
| | |
static |
dynamic
A regex may be used to match the IP:
router.AddRegex(":ip", `^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$`)
router.HandleFunc("/command/ping/:ip", ipHandler, "GET")
Or simply just a catch all allowing GET
and HEAD
methods only:
router.HandleFunc("/command/ping/*", anyHandler, "GET, HEAD")
More examples can be found here: https://violetear.org/post/how-it-works/