xmppo / go-xmpp-atomatt Goto Github PK
View Code? Open in Web Editor NEWGo package for implementing XMPP clients and components.
License: MIT License
Go package for implementing XMPP clients and components.
License: MIT License
Go package for implementing XMPP clients and components. See src/xmpp/doc.go for overview.
If we recieve an Iq like this :
<iq to='comp.mydomain.com' type='set' id='1'>
<hello xmlns='me:test'/>
</iq>
Then the payload will be : "\n <hello xmlns='me:test'/>\n"
But the method Iq.PayloadName() returns an empty xml.Name because first token found is \n
Below a path proposal in stanza.go
// Return the name of the payload element.
func (iq *Iq) PayloadName() (name xml.Name) {
dec := xml.NewDecoder(bytes.NewBufferString(iq.Payload))
for {
tok, err := dec.Token()
if err != nil {
return
}
fmt.Printf("tok => %#v\n", tok)
start, ok := tok.(xml.StartElement)
if ok {
name = start.Name
break
}
}
return name
}
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"[email protected]`,
7: `b&[email protected]`,
8: `b'[email protected]`,
9: `b:[email protected]`,
10: `b<[email protected]`,
11: `b>[email protected]`,
12: `[email protected]/`,
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)
}
})
}
}
Hello,
With huge incoming message load (1000 per second), my component uses only 1 CPU at 100% of the 8 free CPU available.
The amount of load makes the component laggy and some are never received (the XMPP server might drop a that is not received by the component after a specific timeout?)
Increasing GOMAXPROCS does not change the problem.
Is it possible to use goroutines to speed up income stanza processing ?
Thanks.
Running a producer with 30000 messages to send, the consumer terminate with status 0, no error message on STDOUT/STDERR.
./throughput consumer -jid [email protected]/test -pass toto -server domain.com
2013/04/22 18:06:30 Establishing session.
2013/04/22 18:06:32 throughput: 0 msgs/s
2013/04/22 18:06:33 throughput: 0 msgs/s
2013/04/22 18:06:34 throughput: 9967 msgs/s
./throughput producer -jid [email protected]/test -pass titi -to [email protected]/test -count 30000
2013/04/22 18:09:46 Establishing session.
2013/04/22 18:09:47 EOF due to {http://etherx.jabber.org/streams stream}
2013/04/22 18:09:47 EOF
It does not happend with 10000 messages to send.
Can you add supports of :
"When using the SASL SCRAM mechanism, the SCRAM-SHA-256-PLUS variant SHOULD be preferred over the SCRAM-SHA-256 variant, and SHA-256 variants [RFC7677] SHOULD be preferred over SHA-1 variants [RFC5802]".
SCRAM-SHA-1(-PLUS):
-- https://tools.ietf.org/html/rfc5802
-- https://tools.ietf.org/html/rfc6120
SCRAM-SHA-256(-PLUS):
-- https://tools.ietf.org/html/rfc7677 since 2015-11-02
-- https://tools.ietf.org/html/rfc8600 since 2019-06-21: https://mailarchive.ietf.org/arch/msg/ietf-announce/suJMmeMhuAOmGn_PJYgX5Vm8lNA
SCRAM-SHA-512(-PLUS):
-- https://tools.ietf.org/html/draft-melnikov-scram-sha-512
SCRAM-SHA3-512(-PLUS):
-- https://tools.ietf.org/html/draft-melnikov-scram-sha3-512
https://xmpp.org/extensions/inbox/hash-recommendations.html
-PLUS variants:
LDAP:
HTTP:
2FA:
IANA:
Linked to:
Currently to send a stanza we can use Stanza.Send(), but it has to be a Struct to be XML encoded and sent.
I see that Stanza.send() can do the job, but it's a private method. It would be nice that it become public.
Hello,
I start 2 XMPP clients (user1 and user2), with LogStanzas = true
After the both clients are successfully connected, user1 sends this stanza to user2:
<message to='[email protected]' xml:lang='en'>
<body>Foo</body>
</message>
And user2 will fail with this message
2013/07/08 16:25:15 recv: <message from='[email protected]/3073686587137329346519190' to='[email protected]' http://www.w3.org/XML/1998/namespace:lang='en' xmlns:='jabber:client'><body>Foo</body></message>
2013/07/08 16:25:15 XML syntax error on line 1: attribute name without = in element
If user1 omit xml:lang='en'
attribute, it works.
This issue does not appears with LogStanzas = false
Thx.
With a complex incoming message, like http://xmpp.org/extensions/xep-0022.html :
<message to='[email protected]' id='message22'>
<body>Art thou not Romeo, and a Montague?</body>
<x xmlns='jabber:x:event'>
<offline/>
<delivered/>
<composing/>
</x>
</message>
Incoming messages are unmarshalled to a Message strct by XMPP.receiver, but this structure exposes only Body and Subject payload. How can i process the specific payload ?
Thx.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.