mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-18 13:53:03 +01:00
50 lines
1.3 KiB
Go
50 lines
1.3 KiB
Go
package hints
|
|
|
|
import "github.com/nbd-wtf/go-nostr"
|
|
|
|
const END_OF_WORLD nostr.Timestamp = 2208999600 // 2040-01-01
|
|
|
|
type HintKey int
|
|
|
|
const (
|
|
LastFetchAttempt HintKey = iota
|
|
MostRecentEventFetched
|
|
LastInRelayList
|
|
LastInTag
|
|
LastInNprofile
|
|
LastInNevent
|
|
LastInNIP05
|
|
)
|
|
|
|
var KeyBasePoints = [7]int64{
|
|
-500, // attempting has negative power because it may fail
|
|
700, // when it succeeds that should cancel the negative effect of trying
|
|
350, // a relay list is a very strong indicator
|
|
5, // tag hints are often autogenerated so we don't care very much about them (that may change)
|
|
22, // it feels like people take nprofiles slightly more seriously so we value these a bit more
|
|
8, // these are also not often too bad
|
|
7, // nip05 hints should be a strong indicator, although in practice they're kinda bad
|
|
}
|
|
|
|
func (hk HintKey) BasePoints() int64 { return KeyBasePoints[hk] }
|
|
|
|
func (hk HintKey) String() string {
|
|
switch hk {
|
|
case LastFetchAttempt:
|
|
return "last_fetch_attempt"
|
|
case MostRecentEventFetched:
|
|
return "most_recent_event_fetched"
|
|
case LastInRelayList:
|
|
return "last_in_relay_list"
|
|
case LastInTag:
|
|
return "last_in_tag"
|
|
case LastInNprofile:
|
|
return "last_in_nprofile"
|
|
case LastInNevent:
|
|
return "last_in_nevent"
|
|
case LastInNIP05:
|
|
return "last_in_nip05"
|
|
}
|
|
return "<unexpected>"
|
|
}
|