Documentation
¶
Index ¶
- Variables
- func GetBodyBytes(req *http.Request) ([]byte, error)
- func GetIPAddress(r *http.Request) string
- func GetReferrer(r *http.Request, config *conf.GlobalConfiguration) string
- func GetRequestID(ctx context.Context) string
- func IsRedirectURLValid(config *conf.GlobalConfiguration, redirectURL string) bool
- func SafeClose(closer io.Closer)
- func WaitForCleanup(ctx context.Context, wg *sync.WaitGroup)
- func WithRequestID(ctx context.Context, id string) context.Context
- type HIBPBloomCache
- type PostgresError
Constants ¶
This section is empty.
Variables ¶
View Source
var Version string
Version is git commit or release tag from which this binary was built.
Functions ¶
func GetBodyBytes ¶
GetBodyBytes reads the whole request body properly into a byte array.
func GetIPAddress ¶
GetIPAddress returns the real IP address of the HTTP request. It parses the X-Forwarded-For header.
func GetReferrer ¶
func GetReferrer(r *http.Request, config *conf.GlobalConfiguration) string
func GetRequestID ¶
GetRequestID reads the request ID from the context.
func IsRedirectURLValid ¶
func IsRedirectURLValid(config *conf.GlobalConfiguration, redirectURL string) bool
func WaitForCleanup ¶
WaitForCleanup waits until all long-running goroutines shut down cleanly or until the provided context signals done.
Types ¶
type HIBPBloomCache ¶
func NewHIBPBloomCache ¶
func NewHIBPBloomCache(n uint, fp float64) *HIBPBloomCache
func (*HIBPBloomCache) Cap ¶
func (c *HIBPBloomCache) Cap() uint
type PostgresError ¶
type PostgresError struct {
Code string `json:"code"`
HttpStatusCode int `json:"-"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
Detail string `json:"detail,omitempty"`
}
PostgresError is a custom error struct for marshalling Postgres errors to JSON.
func NewPostgresError ¶
func NewPostgresError(err error) *PostgresError
NewPostgresError returns a new PostgresError if the error was from a publicly accessible Postgres error.
func (*PostgresError) IsUniqueConstraintViolated ¶
func (pg *PostgresError) IsUniqueConstraintViolated() bool
Click to show internal directories.
Click to hide internal directories.