Documentation
¶
Index ¶
- func CalculatePage(ordinal, perPage int) int
- func Decode(r io.ReadCloser, body any) error
- func DecodeValidate(r io.ReadCloser, body any) error
- func GenerateConfirmationCode(length int) string
- func GenerateRandomEmail() string
- func GenerateRandomString(length int, charset string) string
- func GetIP(r *http.Request) (string, error)
- func GetPage(r *http.Request) int
- func HashSHA256(input string) string
- func IntPtr(i int) *int
- func WriteErrorAndStatusCode(w http.ResponseWriter, err error)
- type AllowedSources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePage ¶
CalculatePage calculates the page number for a message given its ordinal and messages per page. Formula: page = (ordinal - 1) / perPage + 1
func DecodeValidate ¶
func DecodeValidate(r io.ReadCloser, body any) error
func GenerateRandomEmail ¶
func GenerateRandomEmail() string
GenerateRandomEmail creates a random @invited.ru email address Format: {random_12_chars}@invited.ru This is used for invite-based registration to prevent email spoofing and ensure users don't get access to private boards
func GenerateRandomString ¶
GenerateRandomString generates a cryptographically secure random string using the provided charset and length
func GetPage ¶ added in v0.1.1
GetPage extracts the "page" query parameter from the request, defaulting to 1.
func HashSHA256 ¶
func WriteErrorAndStatusCode ¶
func WriteErrorAndStatusCode(w http.ResponseWriter, err error)
Types ¶
type AllowedSources ¶ added in v0.1.3
type AllowedSources map[string]struct{}
AllowedSources holds a set of permitted referral source identifiers for O(1) membership tests. An empty AllowedSources means no filtering — all sources are accepted.
func NewAllowedSources ¶ added in v0.1.3
func NewAllowedSources(sources []string) AllowedSources
NewAllowedSources builds an AllowedSources from a slice of permitted identifiers.
func (AllowedSources) IsAllowed ¶ added in v0.1.3
func (a AllowedSources) IsAllowed(ref string) bool
IsAllowed reports whether ref is a permitted source.