You route as a TREE is an excellent idea. The benchmark too.
This article should interest you: "https://gdstechnology.blog.gov.uk/2013/12/05/building-a-new-router-for-gov-uk/", similar approach, using a TRIE instead (see code on github).
If your tree is not to remained always balanced, a TREAP could enhance your solution further (see example of implementation here: stathat and https://github.com/zond/treap).
I have no time to contribute to gocraft/web now but will when time available.
You route as a TREE is an excellent idea. The benchmark too. This article should interest you: "https://gdstechnology.blog.gov.uk/2013/12/05/building-a-new-router-for-gov-uk/", similar approach, using a TRIE instead (see code on github). If your tree is not to remained always balanced, a TREAP could enhance your solution further (see example of implementation here: stathat and https://github.com/zond/treap). I have no time to contribute to gocraft/web now but will when time available.