
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
github.com/valstack-dev/go-trie-url-route
A very efficient and minimal HTTP Go router, using a Trie data structure for efficiency.
Based on https://github.com/ant0ine/go-json-rest with the kitchen-sink philosophy stuff removed (so much that I wouldn't particularly consider it a fork).
It aims to be the innermost handler in a composition of handlers. It doesn't require methods to have http.HandlerFunc signature, as route paths are interface{}.
go get github.com/mantasmatelis/go-route
import(
"net/http"
"github.com/mantasmatelis/go-trie-url-route")
var router route.Router
func main() {
router.SetRoutes(
route.Route{"POST", "/count/:Count", SetCount},
route.Route{"GET", "/count" GetCount},
route.Route{"POST", "/count", IncrementCount},
route.Route{"POST", "/reset", ResetCount},
)
http.ListenAndServe(":3000", http.HandlerFunc(handler))
}
func handler(w http.ResponseWriter, r *http.Request) {
route, params, pathMatched := router.FindRouteFromURL(r.Method, r.URL)
if route != nil {
route.Func.(func(http.ResponseWriter, *http.Request, map[string]string))(w, r, params)
}
}
...
How is this different from ant0ine/go-json-rest? This doesn't:
route.Func
is typecast before being called. Use this feature to pass a "Context" struct containing request information, like the authenticated user object, or pass the "params" in the url string.)It exposes the basic router so that your own stack of handlers can be easily written, customized to specific needs.
Enjoy! Pull requests maintaining the basic above philosophy are welcomed.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.