Giter Club home page Giter Club logo

Comments (2)

mdosch avatar mdosch commented on June 2, 2024

Can you provide an example where this happens? I just hacked together a little piece of code which sends 10 messages for 10 users in a short time and all worked well:

package main

import (
	"crypto/tls"
	"fmt"
	"log"
	"net"
	"strconv"
	"strings"

	"github.com/xmppo/go-xmpp"
	"salsa.debian.org/mdosch/xmppsrv"
)

func main() {
	user1 := REDACTED
	pw1 := REDACTED
	user2 := REDACTED
	pw2 := REDACTED
	user3 := REDACTED
	pw3 := REDACTED
	user4 := REDACTED
	pw4 := REDACTED
	user5 := REDACTED
	pw5 := REDACTED
	user6 := REDACTED
	pw6 := REDACTED
	user7 := REDACTED
	pw7 := REDACTED
	user8 := REDACTED
	pw8 := REDACTED
	user9 := REDACTED
	pw9 := REDACTED
	user10 := REDACTED
	pw10 := REDACTED
	srv, err := xmppsrv.LookupClient(strings.Split(user1, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server := net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS := false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options1 := xmpp.Options{
		Host:      server,
		User:      user1,
		Password:  pw1,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user1, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user2, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options2 := xmpp.Options{
		Host:      server,
		User:      user2,
		Password:  pw2,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user2, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user3, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options3 := xmpp.Options{
		Host:     server,
		User:     user3,
		Password: pw3,
		Debug:    true,
		// Mechanism: "SCRAM-SHA-1",
		NoTLS:    !directTLS,
		StartTLS: !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user3, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user4, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options4 := xmpp.Options{
		Host:      server,
		User:      user4,
		Password:  pw4,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user4, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user5, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options5 := xmpp.Options{
		Host:      server,
		User:      user5,
		Password:  pw5,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user5, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user6, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options6 := xmpp.Options{
		Host:      server,
		User:      user6,
		Password:  pw6,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user6, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user7, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options7 := xmpp.Options{
		Host:      server,
		User:      user7,
		Password:  pw7,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user7, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user8, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options8 := xmpp.Options{
		Host:     server,
		User:     user8,
		Password: pw8,
		Debug:    true,
		// Mechanism: "SCRAM-SHA-1",
		NoTLS:    !directTLS,
		StartTLS: !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user8, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user9, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options9 := xmpp.Options{
		Host:      server,
		User:      user9,
		Password:  pw9,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user9, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	srv, err = xmppsrv.LookupClient(strings.Split(user10, "@")[1])
	if err != nil {
		log.Fatal(err)
	}
	server = net.JoinHostPort(srv[0].Target, fmt.Sprint(srv[0].Port))
	directTLS = false
	if srv[0].Type == "xmpps-client" {
		directTLS = true
	}
	options10 := xmpp.Options{
		Host:      server,
		User:      user10,
		Password:  pw10,
		Debug:     true,
		Mechanism: "SCRAM-SHA-1",
		NoTLS:     !directTLS,
		StartTLS:  !directTLS,
		TLSConfig: &tls.Config{
			ServerName: strings.Split(user10, "@")[1],
			NextProtos: []string{"xmpp-client"},
		},
	}
	conn1, err := options1.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn2, err := options2.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn3, err := options3.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn4, err := options4.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn5, err := options5.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn6, err := options6.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn7, err := options7.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn8, err := options8.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn9, err := options9.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	conn10, err := options10.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	for i := 1; i < 11; i++ {
		msg := "Test " + strconv.Itoa(i)
		conn1.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn2.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn3.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn4.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn5.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn6.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn7.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn8.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn9.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
		conn10.Send(xmpp.Chat{Remote: "REDACTED", Type: "chat", Text: msg})
	}
}

from go-xmpp.

mdosch avatar mdosch commented on June 2, 2024

@anoop012345 any news?

from go-xmpp.

Related Issues (20)

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.