directory

package
v0.0.0-...-249e25c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: AGPL-3.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddressSalt    = []byte("directory")
	ConfigSalt     = []byte("directory:config")
	EventSwarmSalt = []byte("directory:events")
	AssetSwarmSalt = []byte("directory:assets")
)
View Source
var (
	ErrListingNotFound = errors.New("listing not found")
	ErrSessionNotFound = errors.New("session not found")
	ErrUserNotFound    = errors.New("user not found")
)

errors

View Source
var (
	ErrNetworkNotFound = errors.New("network not found")
)

errors ...

Functions

This section is empty.

Types

type AssetBundleEvent

type AssetBundleEvent struct {
	NetworkID   uint64
	NetworkKey  []byte
	AssetBundle *networkv1directory.AssetBundle
}

type Control

type Control interface {
	Run()
	PushSnippet(swarmID ppspp.SwarmID, snippet *networkv1directory.ListingSnippet)
	DeleteSnippet(swarmID ppspp.SwarmID)
	Publish(ctx context.Context, listing *networkv1directory.Listing, networkKey []byte) (uint64, error)
	Unpublish(ctx context.Context, id uint64, networkKey []byte) error
	Join(ctx context.Context, query *networkv1directory.ListingQuery, networkKey []byte) (uint64, error)
	Part(ctx context.Context, id uint64, networkKey []byte) error
	ModerateListing(ctx context.Context, id uint64, moderation *networkv1directory.ListingModeration, networkKey []byte) error
	ModerateUser(ctx context.Context, peerKey []byte, moderation *networkv1directory.UserModeration, networkKey []byte) error
	GetListingsByPeerKey(peerKey []byte) []NetworkListings
	GetUsersByNetworkID(id uint64) []User
	GetListingsByNetworkID(id uint64) []Listing
	GetListingByQuery(networkID uint64, query *networkv1directory.ListingQuery) (Listing, bool)
	NotifyListingEvent(networkID uint64, ch chan ListingEvent) ([]Listing, error)
	StopNotifyingListingEvent(networkID uint64, ch chan ListingEvent)
	NotifyListingUserEvent(networkID, listingID uint64, ch chan UserEvent) ([]User, error)
	StopNotifyingListingUserEvent(networkID, listingID uint64, ch chan UserEvent)
	WatchAssetBundles(ctx context.Context) <-chan AssetBundleEvent
}

func NewControl

func NewControl(
	ctx context.Context,
	logger *zap.Logger,
	vpn *vpn.Host,
	store dao.Store,
	observers *event.Observers,
	network network.Control,
	transfer transfer.Control,
) Control

NewControl ...

type Listing

type Listing struct {
	ID              uint64
	Listing         *networkv1directory.Listing
	Snippet         *networkv1directory.ListingSnippet
	Moderation      *networkv1directory.ListingModeration
	UserCount       uint32
	RecentUserCount uint32
}

func (Listing) MarshalLogObject

func (l Listing) MarshalLogObject(e zapcore.ObjectEncoder) error

type ListingEvent

type ListingEvent struct {
	Type    ListingEventType
	Listing Listing
}

type ListingEventType

type ListingEventType int
const (
	ChangeListingEventType ListingEventType
	UnpublishListingEventType
	UserCountChangeListingEventType
)

type NetworkListings

type NetworkListings struct {
	NetworkKey []byte
	Listings   []Listing
}

type User

type User struct {
	ID      uint64
	Alias   string
	PeerKey []byte
}

func (User) MarshalLogObject

func (u User) MarshalLogObject(e zapcore.ObjectEncoder) error

type UserEvent

type UserEvent struct {
	Type    UserEventType
	User    User
	Listing Listing
}

type UserEventType

type UserEventType int
const (
	JoinUserEventType UserEventType
	PartUserEventType
	RenameUserEventType
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL