Hi, thanks for the work you've done on this library! I've been experimenting with different Go XMPP libraries to try and make the existing ones more robust, and the following tests will fail with your current JID parsing implementation. All of these are invalid JIDs according to RFC 7622 (feel free to use these tests however you see fit):
var invalidutf8 = string([]byte{0xff, 0xfe, 0xfd})
var invalidJIDs = [...]string{
0: "test@/test",
1: invalidutf8 + "@example.com/rp",
2: invalidutf8 + "/rp",
3: invalidutf8,
4: "example.com/" + invalidutf8,
5: "lp@/rp",
6: `b"d@example.net`,
7: `b&d@example.net`,
8: `b'd@example.net`,
9: `b:d@example.net`,
10: `b<d@example.net`,
11: `b>d@example.net`,
12: `e@example.net/`,
13: `@example.net/`,
}
func TestInvalidParseJIDs(t *testing.T) {
for i, tc := range invalidJIDs {
t.Run(strconv.Itoa(i), func(t *testing.T) {
_, err := ParseJID(tc)
if err == nil {
t.Errorf("Expected JID %s to fail", tc)
}
})
}
}
Hi, thanks for the work you've done on this library! I've been experimenting with different Go XMPP libraries to try and make the existing ones more robust, and the following tests will fail with your current JID parsing implementation. All of these are invalid JIDs according to RFC 7622 (feel free to use these tests however you see fit):