added login filter to filter different peers with the same pub key

This commit is contained in:
crn4
2025-06-12 15:55:50 +01:00
parent bdf2994e97
commit 5b09804a17
7 changed files with 207 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package server
import (
"context"
"errors"
"fmt"
"net"
"net/netip"
@@ -338,6 +339,9 @@ func mapError(ctx context.Context, err error) error {
default:
}
}
if errors.Is(err, internalStatus.ErrPeerAlreadyLoggedIn) {
return status.Error(codes.AlreadyExists, internalStatus.ErrPeerAlreadyLoggedIn.Error())
}
log.WithContext(ctx).Errorf("got an unhandled error: %s", err)
return status.Errorf(codes.Internal, "failed handling request")
}