Skip to content

Commit

Permalink
fix: detect ad-hoc node clients
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Feb 3, 2025
1 parent 94b4c05 commit 7bb23dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions acme/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,22 @@ func agentType(agentVersion string) string {
switch {
case strings.HasPrefix(agentVersion, "kubo/"):
return "kubo"
case strings.HasPrefix(agentVersion, "go-ipfs/"): // not kubo, but maybe storm ;)
return "go-ipfs"
case strings.HasPrefix(agentVersion, "helia/"):
return "helia"
case strings.HasPrefix(agentVersion, "libp2p/") || strings.HasPrefix(agentVersion, "js-libp2p/"): // TODO: revisit once js0libp2p cleans up default user agents to something unique and not "libp2p/"
case strings.HasPrefix(agentVersion, "libp2p/") || strings.Contains(agentVersion, "js-libp2p/"):
return "js-libp2p"
case strings.Contains(agentVersion, "go-libp2p"):
return "go-libp2p"
case strings.Contains(agentVersion, "Go-http-client"):
return "go-http-client"
case strings.Contains(agentVersion, "python-requests"):
return "python-requests"
case strings.HasPrefix(agentVersion, "curl"):
case strings.HasPrefix(agentVersion, "curl/"):
return "curl"
case agentVersion == "node": // sent when running via 'node poc.js' (not matching prefix as it is too generic, could match node-foo)
return "node"
case strings.HasPrefix(agentVersion, "Mozilla/"): // most of browsers make requests with user-agent header value starting with
return "browser"
}
Expand Down

0 comments on commit 7bb23dc

Please sign in to comment.