From e6559f59c0090dcba00d942523a559a018eeb606 Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 29 Jul 2020 20:04:52 +0300 Subject: [PATCH] make peer score inspect function types aliases --- score.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/score.go b/score.go index 778d833..deb4945 100644 --- a/score.go +++ b/score.go @@ -114,8 +114,8 @@ const ( deliveryThrottled // we can't tell if it is valid because validation throttled ) -type PeerScoreInspectFn func(map[peer.ID]float64) -type ExtendedPeerScoreInspectFn func(map[peer.ID]*PeerScoreSnapshot) +type PeerScoreInspectFn = func(map[peer.ID]float64) +type ExtendedPeerScoreInspectFn = func(map[peer.ID]*PeerScoreSnapshot) type PeerScoreSnapshot struct { Score float64 @@ -155,12 +155,8 @@ func WithPeerScoreInspect(inspect interface{}, period time.Duration) Option { switch i := inspect.(type) { case PeerScoreInspectFn: gs.score.inspect = i - case func(map[peer.ID]float64): - gs.score.inspect = PeerScoreInspectFn(i) case ExtendedPeerScoreInspectFn: gs.score.inspectEx = i - case func(map[peer.ID]*PeerScoreSnapshot): - gs.score.inspectEx = ExtendedPeerScoreInspectFn(i) default: return fmt.Errorf("unknown peer score insector type: %v", inspect) }