Documentation ¶
Overview ¶
Package parser parses and verifies user-sent post data
Index ¶
- Constants
- Variables
- func FormatEmail(email string) string
- func ParseLine(line []byte, board string) (links types.LinkMap, command types.Command, err error)
- func ParseName(name string) (string, string, error)
- func ParseSubject(s string) (string, error)
- func VerifyPostPassword(s string) error
- type ErrTooLong
Constants ¶
View Source
const (
// MaxLengthBody is the maximum allowed length of a post text body
MaxLengthBody = 2000
)
Variables ¶
View Source
var ( // CommandRegexp matches any hash command in a line CommandRegexp = regexp.MustCompile(`^#(flip|\d*d\d+|8ball|pyu|pcount)$`) // ErrBodyTooLong is returned, when a post text body has exceeded // MaxLengthBody ErrBodyTooLong = ErrTooLong("post body") )
Functions ¶
func ParseLine ¶
func ParseLine(line []byte, board string) ( links types.LinkMap, command types.Command, err error, )
ParseLine parses a full text line of a post
func ParseSubject ¶
ParseSubject verifies and trims a thread subject string
func VerifyPostPassword ¶
VerifyPostPassword verifies a post password exists does not surpass the maximum allowed length
Types ¶
type ErrTooLong ¶
type ErrTooLong string
ErrTooLong is passed, when a field exceeds the maximum string length for that specific field
func (ErrTooLong) Error ¶
func (e ErrTooLong) Error() string
Click to show internal directories.
Click to hide internal directories.