Documentation
¶
Overview ¶
Package menfess stores consent and routing for private anonymous conversations. Phone identities are internal routing data and must never be included in relay text.
Index ¶
- Constants
- Variables
- func IsRejection(err error) bool
- func SetDefault(s *Service)
- func ValidateAlias(alias string) error
- func ValidateText(text string) error
- type Relay
- type Service
- func (s *Service) Accept(ctx context.Context, actor, code string) (Relay, error)
- func (s *Service) Block(ctx context.Context, actor string, blocked bool) error
- func (s *Service) Invite(ctx context.Context, sender, recipient, alias, text string) (Session, error)
- func (s *Service) Prune(ctx context.Context) error
- func (s *Service) Reply(ctx context.Context, actor, code, text string) (Relay, error)
- func (s *Service) Stop(ctx context.Context, actor, code string) error
- type Session
Constants ¶
View Source
const ( InvitationTTL = 15 * time.Minute SessionTTL = 24 * time.Hour )
Variables ¶
View Source
var ( ErrSession = errors.New("Sesi tidak ditemukan, sudah berakhir, atau bukan milikmu.") ErrBlocked = errors.New("Undangan tidak dapat dikirim ke tujuan ini.") ErrBusy = errors.New("Salah satu peserta masih memiliki undangan atau sesi Menfess. Selesaikan sesi sebelumnya dahulu.") ErrLimit = errors.New("Batas undangan tercapai. Maksimal 3 per jam untuk pengirim dan 5 per hari untuk penerima.") ErrPending = errors.New("Penerima belum menyetujui undangan Menfess.") ErrCooldown = errors.New("Tunggu 5 detik sebelum mengirim balasan berikutnya.") )
Functions ¶
func IsRejection ¶
IsRejection distinguishes expected refusals from storage failures.
func SetDefault ¶
func SetDefault(s *Service)
func ValidateAlias ¶
func ValidateText ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Accept ¶
Accept is recipient-only and releases the initial message once. Message text is removed from storage after acceptance; subsequent replies are never stored.
func (*Service) Block ¶
Blocking closes existing invitations/conversations and rejects all new invites.
type Session ¶
type Session struct {
Code string `db:"code"`
Sender string `db:"sender"`
Recipient string `db:"recipient"`
Alias string `db:"alias"`
Initial string `db:"initial_text"`
State string `db:"state"`
Created int64 `db:"created_at"`
Expires int64 `db:"expires_at"`
LastSender int64 `db:"last_sender"`
LastRecipient int64 `db:"last_recipient"`
}
Click to show internal directories.
Click to hide internal directories.