Skip to content

Commit

Permalink
fix nimbus client id parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
angaz committed Oct 31, 2024
1 parent 255819b commit 0a938c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/common/parse_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ func handleLen5(parts []string) (*Client, error) {
var arch Arch
userData := Unknown

if parts[0] == "nimbus-eth1" {
versionStr = parts[1]
os, arch, _ = parseOSArch(parts[2])
lang = "nim"
} else
// handle geth/v1.2.11-e3acd735-20231031/linux-amd64/go1.20.5/{d+}
if strings.TrimFunc(parts[4], unicode.IsDigit) == "" {
versionStr = parts[1]
Expand Down Expand Up @@ -650,7 +655,7 @@ func ParseClientID(clientName *string) *Client {
return nil
}

if strings.HasPrefix(name, "nimbus-eth1") {
if strings.HasPrefix(name, "nimbus-eth1") && !strings.Contains(name, "/") {
client, err := handleNimbus(name)
if err != nil {
slog.Error("parse nimbus failed", "err", err, "name", name)
Expand Down
13 changes: 13 additions & 0 deletions pkg/common/parse_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ func TestParseClientID(t *testing.T) {
ci string
client *Client
}{
{
name: "numbus slash 5 parts",
ci: "nimbus-eth1/v0.1.0-94198bcf/linux-amd64/Nim-2.0.10/nimvm",
client: &Client{
Name: "nimbus-eth1",
UserData: Unknown,
Version: "v0.1.0",
Build: "94198bcf",
OS: OSLinux,
Arch: ArchAMD64,
Language: "nim",
},
},
{
name: "nimbus 6 parts",
ci: "nimbus-eth1 v0.1.0 [linux: amd64, nimvm, c0d52b]",
Expand Down

0 comments on commit 0a938c1

Please sign in to comment.