Git Product home page Git Product logo

go-xmpp-atomatt's Introduction

Go package for implementing XMPP clients and components.

See src/xmpp/doc.go for overview.

go-xmpp-atomatt's People

Contributors

atomatt avatar louiz avatar

Stargazers

Ryanda Diedan avatar c032 avatar Justice Nanhou avatar Kevin.Kibet avatar Aloysius Michael Tansy avatar  avatar Gleb avatar Andrew Ayer avatar benjamincheng avatar Paweł Szczur avatar Ericson Cepeda avatar Mara Morton avatar Nikita Vorobey avatar Rogerio Marques avatar Peter Vrba avatar Jianfei Wang avatar Vasiliy Bukharev avatar Leonardo Bessa avatar Jimmy Moon avatar bzhu avatar Peter Jiang avatar Markus Kohlhase avatar liang avatar Fisher avatar Javed Khan avatar Emmaly avatar Charlie Zheng avatar Nan Deng avatar Steve Phillips avatar  avatar Conor Hunt avatar

Watchers

 avatar ...Paul avatar Neustradamus avatar Markus Kohlhase avatar Jacob Santos avatar Sam Whited avatar Thomas Maier avatar James Cloos avatar magicx avatar  avatar Anton Konovalov avatar

go-xmpp-atomatt's Issues

Iq.PayloadName() fails if payload starts with \n

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
}

JID parsing allows invalid JIDs

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)
			}
		})
	}
}

Scale with more CPU

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.

throughput.go terminates with high load

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.

SCRAM-SHA-1(-PLUS) + SCRAM-SHA-224(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-384(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports

Can you add supports of :

  • SCRAM-SHA-1
  • SCRAM-SHA-1-PLUS
  • SCRAM-SHA-224
  • SCRAM-SHA-224-PLUS
  • SCRAM-SHA-256
  • SCRAM-SHA-256-PLUS
  • SCRAM-SHA-384
  • SCRAM-SHA-384-PLUS
  • SCRAM-SHA-512
  • SCRAM-SHA-512-PLUS
  • SCRAM-SHA3-512
  • SCRAM-SHA3-512-PLUS

"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]".

https://xmpp.org/extensions/inbox/hash-recommendations.html

-PLUS variants:

LDAP:

  • RFC5803: Lightweight Directory Access Protocol (LDAP) Schema for Storing Salted: Challenge Response Authentication Mechanism (SCRAM) Secrets: https://tools.ietf.org/html/rfc5803

HTTP:

2FA:

IANA:

Linked to:

Allow send raw XML

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.

Fatal error when incoming stanza has a xml:lang attribute and LogStanzas is true

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.

Dealing with <message> XEPs

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.