ban: remove port from DefaultActorFunc

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2022-10-26 12:02:53 +02:00
parent 23f1b78389
commit 1d3d5315a4
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF

View File

@ -2,6 +2,7 @@ package ban
import ( import (
"context" "context"
"net"
"time" "time"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
@ -46,6 +47,9 @@ func DefaultActorFunc(ctx context.Context) (string, bool, error) {
if !ok { if !ok {
return "", false, nil return "", false, nil
} }
if host, _, err := net.SplitHostPort(p.Addr.String()); err == nil {
return host, true, nil
}
return p.Addr.String(), true, nil return p.Addr.String(), true, nil
} }