Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateConnectionId() string
- func GenerateRandomSubdomain() string
- func GenerateSecretKey() string
- func GenerateSessionToken() string
- func HttpBadRequest(c echo.Context, format string, args ...interface{}) error
- func HttpUnauthorized(c echo.Context, format string, args ...interface{}) error
- func ProxyError(c echo.Context, err error) error
- func ProxyErrorf(c echo.Context, format string, args ...interface{}) error
- func SanitizeString(value string) string
- func UnserializeHTTPRequest(req *HTTPRequest) (r *http.Request, err error)
- func ValidateEmail(input string) error
- func ValidatePassword(input string) error
- func ValidateSubdomain(subdomain string) error
- type HTTPRequest
- type HTTPResponse
Constants ¶
View Source
const ( RANDOM_SUBDOMAIN_LENGTH = 6 CONNECTION_ID_LENGTH = 10 SECRET_KEY_LENGTH = 32 SESSION_ID_LENGTH = 16 NANOID_ALPHABETS = "abcdefghijklmnopqrstuvwxyz0123456789" )
Variables ¶
View Source
var ( ErrPasswordNotLongEnough = errors.New("password must be atleast 6 chars long") ErrInvalidSubdomain = errors.New("subdomain must contain only a-z, 0-9 and `-`(not leading or trailing)") )
Functions ¶
func GenerateConnectionId ¶
func GenerateConnectionId() string
func GenerateRandomSubdomain ¶
func GenerateRandomSubdomain() string
func GenerateSecretKey ¶
func GenerateSecretKey() string
func GenerateSessionToken ¶
func GenerateSessionToken() string
func HttpBadRequest ¶
func HttpUnauthorized ¶
func ProxyError ¶
ProxyError log error and return a HTTP 526 error with the message
func ProxyErrorf ¶
ProxyErrorf log error and return a HTTP 526 error with the message
func SanitizeString ¶
Remove any leading or trailing whitespace
func UnserializeHTTPRequest ¶
func UnserializeHTTPRequest(req *HTTPRequest) (r *http.Request, err error)
UnserializeHTTPRequest create a new http.Request from a HTTPRequest
func ValidateEmail ¶
func ValidatePassword ¶
func ValidateSubdomain ¶
Types ¶
type HTTPRequest ¶
HTTPRequest is a serializable version of http.Request ( with only usefull fields )
func SerializeHTTPRequest ¶
func SerializeHTTPRequest(req *http.Request) (r *HTTPRequest)
SerializeHTTPRequest create a new HTTPRequest from a http.Request
type HTTPResponse ¶
HTTPResponse is a serializable version of http.Response ( with only useful fields )
func NewHTTPResponse ¶
func NewHTTPResponse() (r *HTTPResponse)
NewHTTPResponse creates a new HTTPResponse
func SerializeHTTPResponse ¶
func SerializeHTTPResponse(resp *http.Response) *HTTPResponse
SerializeHTTPResponse create a new HTTPResponse from a http.Response
Click to show internal directories.
Click to hide internal directories.