Documentation ¶
Index ¶
- func ValidBareJID(s string) bool
- func ValidDomain(s string) bool
- func ValidDomainWithResource(s string) bool
- func ValidFullJID(s string) bool
- func ValidJID(s string) bool
- func ValidLocal(s string) bool
- func ValidResource(s string) bool
- func WithAndWithout(peer Any) (WithResource, WithoutResource)
- type Any
- type Bare
- type Domain
- func (j Domain) AddLocal(l Local) Bare
- func (j Domain) Host() Domain
- func (j Domain) MaybeWithResource(r Resource) Any
- func (j Domain) NoResource() WithoutResource
- func (j Domain) PotentialResource() Resource
- func (j Domain) PotentialSplit() (WithoutResource, Resource)
- func (j Domain) String() string
- func (j Domain) Valid() bool
- func (j Domain) WithResource(r Resource) WithResource
- type Full
- type Local
- type Resource
- type WithBare
- type WithLocal
- type WithResource
- type WithoutResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidBareJID ¶
ValidBareJID returns true if the given string is a valid bare JID. This function will true for full JIDs as well as bare JIDs
func ValidDomain ¶
ValidDomain returns true if the given string is a valid domain part for a JID
func ValidDomainWithResource ¶
ValidDomainWithResource returns true if the given string a valid domain with resource part. This wil return true for a full JID, as well as a domain with JID
func ValidFullJID ¶
ValidFullJID returns true if the given string is a valid full JID
func ValidLocal ¶
ValidLocal checks whether the given string is a valid local part of a JID A localpart is defined to be any string of length 1 to 1023, matching the UsernameCaseMapped profile from RFC7613, and excluding a few more characters
func ValidResource ¶
ValidResource returns true if the given string is a valid resource part for a JID. Note that a resource part is allowed to contain / and @ characters
func WithAndWithout ¶
func WithAndWithout(peer Any) (WithResource, WithoutResource)
WithAndWithout will return the JID with the resource, and without the resource
Types ¶
type Any ¶
type Any interface { // Host will always return the domain component, since all JIDs have one Host() Domain // String will return the natural string representation of the JID String() string // WithResource will return a new JID containing the resource component specified. If the JID already had a resource, it will be replaced WithResource(Resource) WithResource // MaybeWithResource will act like WithResource, if the argument is anything but a blank resource. // Otherwise it will return itself without a resource MaybeWithResource(Resource) Any // NoResource will ensure that the JID returned doesn't have a resource NoResource() WithoutResource // Potential resource returns the resource if one exists, or the blank resource otherwise PotentialResource() Resource // PotentialSplit will return the result of calling WithoutResource and PotentialResource PotentialSplit() (WithoutResource, Resource) // Valid returns true if this is a valid JID Valid() bool }
Any represents any valid JID, including just a hostname, a bare jid, and a jid with a resource
type Bare ¶
type Bare interface { WithoutResource WithLocal WithBare }
Bare represents a JID containing both a local component and a host component, but no resource component. A Bare is an Any
func NewBareFromStrings ¶
NewBareFromStrings generate a new Bare from local and domain as strings
func ParseBare ¶
ParseBare returns a bare JID. It will fail if the given string isn't at least a bare
func TryParseBare ¶
TryParseBare returns a bare JID if it can.
type Domain ¶
type Domain struct {
// contains filtered or unexported fields
}
Domain represents the domain part of a JID
func ParseDomain ¶
ParseDomain returns a domain part of a JID. It will fail if the given string isn't at least a domain This will parse the full string as a JID and _extract_ the domain part, This is in comparison to NewDomain that will try to create a new Domain object from the given string
func (Domain) MaybeWithResource ¶
MaybeWithResource implements WithoutResource
func (Domain) PotentialResource ¶
PotentialResource implements Any
func (Domain) PotentialSplit ¶
func (j Domain) PotentialSplit() (WithoutResource, Resource)
PotentialSplit implements Any
func (Domain) WithResource ¶
func (j Domain) WithResource(r Resource) WithResource
WithResource implements WithoutResource
type Full ¶
type Full interface { WithResource WithLocal WithBare }
Full represents a JID containing a local, host and resource component. A Full is a Bare and an Any
func ParseFull ¶
ParseFull returns a full JID. It will fail if the given string isn't at least a full
func TryParseFull ¶
TryParseFull returns a full JID if it can.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local represents the local part of a JID
func MaybeLocal ¶
MaybeLocal returns the local part of a JID if it has one, otherwise empty
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource represents the resource part of a JID
func NewResource ¶
NewResource returns a new resource if possible
type WithBare ¶
type WithBare interface { // Bare will return the extracted bare jid from the original jid Bare() Bare }
WithBare represents a JID that is a bare jid compatible
type WithLocal ¶
type WithLocal interface { // Local returns the local part of the JID Local() Local }
WithLocal represents a JID that has a Local port
type WithResource ¶
type WithResource interface { Any // Resource will return the resource Resource() Resource // Split will return the JID split into the part without resource and the part with resource Split() (WithoutResource, Resource) }
WithResource represents any valid JID that has a resource part
func R ¶
func R(s string) WithResource
R returns a JID with resource. This method will fail if the object doesn't have a resource
type WithoutResource ¶
type WithoutResource interface { Any // contains filtered or unexported methods }
WithoutResource represents any valid JID that does not have a resource part