Documentation ¶
Index ¶
- Constants
- Variables
- func ContextualRules(val []rune, idx int) bool
- func NewMultiValidator(v jsonmap.Validator) jsonmap.TypeMap
- func RFC5891DNS(record string) error
- func RFC5891DNSIgnoreCase(record string) error
- func RFC5892(label string) error
- func ToNFKC(c rune) rune
- func ZeroWidthNonJoiner(val []rune, idx int) (ok bool)
- type HostNameAndPortValidator
- type HostNameValidator
- type HostnameOrIpValidator
- type IPValidator
- type JWTValidator
- type JoinType
- type MultiValidator
- type PortValidator
- type X509CertificateValidator
Constants ¶
const (
// RFC5890_4_2LabelMaxLength defines the maximum length of a single IDNA label
RFC5890_4_2LabelMaxLength = 252
)
Variables ¶
var SimpleCaseFolding = map[rune]rune{}/* 1245 elements not displayed */
SimpleCaseFolding table
Functions ¶
func ContextualRules ¶
ContextualRules is an implementation of the contextual rules registery found in RFC5892 Appendix A.1-A.9 val: a rune-slice of the label being validated idx: the index of the currently considered rune returns: true if pPVALID, false otherwise
func NewMultiValidator ¶
Used for StringsArray, which has a "V" field containing []string. Optionally can take a string validator to apply to each entry.
func RFC5891DNS ¶
RFC5891DNS is the RFC5891 complaint validator for hostnames DNS records, and ensures compliance with IDNA
func RFC5891DNSIgnoreCase ¶
RFC5891DNSIgnoreCase ensures that a label is RFC5891 compliant, while ignoring "case", which is probably useful for validation, since most clients will kindly lowercase things for their users. The strict RFC compliant is used after lowercasing. Both are exposed in case using this turns out to have been a bad idea
func RFC5892 ¶
RFC5892 ensures a label complies with IDNP for labels (less strict than the rules for IDNA DNS records, but used by it)
func ZeroWidthNonJoiner ¶
ZeroWidthNonJoiner Helper for the schematic parsing for zero width non-joiners
Types ¶
type HostNameAndPortValidator ¶
type HostNameAndPortValidator struct{}
HostNameAndPortValidator implements the jsonmap Validator interface.
func (*HostNameAndPortValidator) Validate ¶
func (h *HostNameAndPortValidator) Validate(v interface{}) (munged interface{}, err error)
Validate ensures that the hostname given is a valid unicode hostname and optional port. v: the the value to be verified, should be a string returns:
munged: the, possibly modified, value err: any errors encountered
type HostNameValidator ¶
type HostNameValidator struct{}
HostNameValidator implements the jsonmap Validator interface.
func (*HostNameValidator) Validate ¶
func (h *HostNameValidator) Validate(v interface{}) (munged interface{}, err error)
Validate ensures that the hostname given is a valid unicode hostname v: the the value to be verified, should be a string returns:
munged: the, possibly modified, value err: any errors encountered
type HostnameOrIpValidator ¶
type HostnameOrIpValidator struct{}
IPValidator is a type implementing the jsonmap Validator interface for IP Addresses
func (*HostnameOrIpValidator) Validate ¶
func (h *HostnameOrIpValidator) Validate(v interface{}) (munged interface{}, err error)
Validate confirms that its input is a string, and is a valid IP (IPv4 or IPv6)
type IPValidator ¶
type IPValidator struct{}
IPValidator is a type implementing the jsonmap Validator interface for IP Addresses
func (*IPValidator) Validate ¶
func (h *IPValidator) Validate(v interface{}) (munged interface{}, err error)
Validate confirms that its input is a string, and is a valid IP (IPv4 or IPv6)
type JWTValidator ¶
JWTValidator provides a mechanism to verify that a string is a valid representation of a JWT token, and that it has the required "exp" and "iat" claims, has not expired, and is not in the future. The validate method does *NOT* verfiy that the token's signature is valid
func (*JWTValidator) Validate ¶
func (valid *JWTValidator) Validate(v interface{}) (munged interface{}, err error)
Validate confirms that a JWT can be parsed and isn't expired. it does *NOT* verify the signature.
type JoinType ¶
type JoinType int
JoinType is The unicode joining types
const ( JoinU JoinType = iota // non-joining JoinR // Right-joining JoinL // left-joining JoinD // dual-joining JoinC // join-causing JoinT // transparent )
The unicode joining types
func GetJoinType ¶
GetJoinType takes a rune and returns the joining class for it
type MultiValidator ¶
type MultiValidator struct {
// contains filtered or unexported fields
}
shamelessly stolen from https://github.com/russellhaering/jsonmap/blob/master/validators.go but made to accept any validator instead of explicitely a StringValidator
type PortValidator ¶
type PortValidator struct{}
PortValidator implements the jsonmap Validator interface.
func (*PortValidator) Validate ¶
func (h *PortValidator) Validate(v interface{}) (munged interface{}, err error)
Validate ensures that the port given is valid (empty OR non-zero uint16). 0 ports are legal but will fail this validator. v: the the value to be verified, should be a string returns:
munged: the, possibly modified, value err: any errors encountered
type X509CertificateValidator ¶
func (*X509CertificateValidator) Validate ¶
func (valid *X509CertificateValidator) Validate(v interface{}) (munged interface{}, err error)