Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteEventFromGroupSearch(event nostr.Event) error
- func EmbeddedLiveKitAvailable() bool
- func EmbeddedLiveKitDNSCheck() (status, serverIP string)
- func EmbeddedLiveKitError() string
- func EmbeddedLiveKitRunning() bool
- func FilterQuery(ctx context.Context, filter nostr.Filter, query iter.Seq[nostr.Event]) iter.Seq[nostr.Event]
- func HandleEventSaved(event nostr.Event)
- func Init(relay *khatru.Relay)
- func IsMemberOfAnyGroup(pubkey nostr.PubKey) bool
- func LiveKitProxyHandler(w http.ResponseWriter, r *http.Request)
- func QuerySearch(ctx context.Context, filter nostr.Filter) iter.Seq[nostr.Event]
- func RejectEvent(ctx context.Context, event nostr.Event) (reject bool, msg string)
- func RequestAuthWhenNecessary(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
- func ResolveNickname(nickname string) (string, bool)
- func ShouldPreventBroadcast(evt nostr.Event, filter nostr.Filter, authed []nostr.PubKey) bool
- func ShutdownEmbeddedLiveKit()
- func StartEmbeddedLiveKit() error
- func StopEmbeddedLiveKit() error
- func WebAddressHandler(w http.ResponseWriter, r *http.Request)
- type Group
- type GroupsState
- func (s *GroupsState) GetGroupFromEvent(event nostr.Event) *Group
- func (s *GroupsState) ImportGroup(ctx context.Context, caller nostr.PubKey, ...) (*importResult, error)
- func (s *GroupsState) NewGroup(id string) *Group
- func (s *GroupsState) ProcessEvent(ctx context.Context, event nostr.Event) (groupsAffected []*Group)
- func (s *GroupsState) SyncGroupMetadataEvents(group *Group) iter.Seq2[nostr.Event, error]
- func (s *GroupsState) WipeGroup(groupId string) error
- type MuxHandler
- type TokenSourceResponse
Constants ¶
const ( PRIMARY_ROLE_NAME = "admin" SECONDARY_ROLE_NAME = "moderator" )
const GROUP_LANGUAGE_MESSAGE_THRESHOLD = 15
Variables ¶
var LiveKitEmbedded bool
Functions ¶
func DeleteEventFromGroupSearch ¶ added in v1.2.7
func EmbeddedLiveKitAvailable ¶ added in v1.1.0
func EmbeddedLiveKitAvailable() bool
func EmbeddedLiveKitDNSCheck ¶ added in v1.2.10
func EmbeddedLiveKitDNSCheck() (status, serverIP string)
func EmbeddedLiveKitError ¶ added in v1.1.0
func EmbeddedLiveKitError() string
func EmbeddedLiveKitRunning ¶ added in v1.1.0
func EmbeddedLiveKitRunning() bool
func FilterQuery ¶ added in v1.3.0
func HandleEventSaved ¶ added in v1.2.7
func IsMemberOfAnyGroup ¶ added in v1.3.0
IsMemberOfAnyGroup returns whether the pubkey is a member of any group on this relay
func LiveKitProxyHandler ¶ added in v1.1.0
func LiveKitProxyHandler(w http.ResponseWriter, r *http.Request)
func QuerySearch ¶ added in v1.3.0
func RejectEvent ¶ added in v1.2.7
func RequestAuthWhenNecessary ¶ added in v1.2.7
func ResolveNickname ¶ added in v1.3.4
ResolveNickname returns the group id registered for the given NIP-AD nickname, if any.
func ShouldPreventBroadcast ¶ added in v1.2.7
func ShutdownEmbeddedLiveKit ¶ added in v1.1.0
func ShutdownEmbeddedLiveKit()
func StartEmbeddedLiveKit ¶ added in v1.1.0
func StartEmbeddedLiveKit() error
func StopEmbeddedLiveKit ¶ added in v1.1.0
func StopEmbeddedLiveKit() error
func WebAddressHandler ¶ added in v1.3.4
func WebAddressHandler(w http.ResponseWriter, r *http.Request)
WebAddressHandler serves NIP-AD resolution for group URLs. a request to /.well-known/nostr.json?path=/groups/<id> returns a filter that fetches the group's kind:39000 metadata event from this relay.
Types ¶
type Group ¶
func LoadDeletedGroup ¶ added in v1.3.2
LoadDeletedGroup rebuilds a read-only *Group from the events archived in IL.DeletedGroups. the returned group is not stored in State.Groups.
func (*Group) AnyOfTheseIsAMember ¶
type GroupsState ¶
type GroupsState struct {
Groups *xsync.MapOf[string, *Group]
// contains filtered or unexported fields
}
var ( Handler = &MuxHandler{} State *GroupsState )
func NewGroupsState ¶
func NewGroupsState() *GroupsState
func (*GroupsState) GetGroupFromEvent ¶
func (s *GroupsState) GetGroupFromEvent(event nostr.Event) *Group
func (*GroupsState) ImportGroup ¶ added in v1.3.3
func (s *GroupsState) ImportGroup(ctx context.Context, caller nostr.PubKey, address, adminMode, primaryFrom, secondaryFrom, bunkerURL string) (*importResult, error)
ImportGroup pulls a NIP-29 group from a remote relay into this one. It fetches the group's admin list (kind 39001) to learn the role names, then downloads the moderation events tagged with the group's `h` tag and replays them locally to rebuild the state. Role assignments are cleared and rebuilt from the 39001 list: source roles matching our PRIMARY/SECONDARY (or the caller-specified primaryFrom / secondaryFrom rename mapping) are kept under our role names, anything else is dropped, and the caller becomes the PRIMARY admin. If the source group uses roles other than our admin/moderator and no mapping was provided, the import fails so the caller can specify how to rename them.
func (*GroupsState) NewGroup ¶
func (s *GroupsState) NewGroup(id string) *Group
NewGroup creates a new group from scratch (but doesn't store it in the groups map)
func (*GroupsState) ProcessEvent ¶
func (*GroupsState) SyncGroupMetadataEvents ¶ added in v1.0.20
SyncGroupMetadataEvents tries to save new versions of metadata events to the database. if they are new enough (<3s) they are returned in the iterator, otherwise not.
func (*GroupsState) WipeGroup ¶ added in v1.0.9
func (s *GroupsState) WipeGroup(groupId string) error
type MuxHandler ¶ added in v1.0.4
type MuxHandler struct {
// contains filtered or unexported fields
}
func (*MuxHandler) ServeHTTP ¶ added in v1.0.4
func (mh *MuxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)