~samwhited/xmpp

424ddf3bb5289b596e382aa388fcd3b6d2745713 — Sam Whited 5 years ago 46002ff
Export default id len and move to internal package
2 files changed, 3 insertions(+), 1 deletions(-)

M bind.go
M internal/idgen.go
M bind.go => bind.go +1 -1
@@ 44,7 44,7 @@ func BindResource() StreamFeature {
			if (conn.state & Received) == Received {
				panic("xmpp: bind not yet implemented")
			} else {
				reqID := internal.RandomID(idLen)
				reqID := internal.RandomID(internal.IDLen)
				if resource := conn.config.Origin.Resourcepart(); resource == "" {
					// Send a request for the server to set a resource part.
					_, err = fmt.Fprintf(conn, bindIQServerGeneratedRP, reqID)

M internal/idgen.go => internal/idgen.go +2 -0
@@ 9,6 9,8 @@ import (
	"fmt"
)

const IDLen = 16

// TODO: This will be called a lot, and probably needs to be faster than we can
//       get when reading from getrandom(2). Should we use a fast userspace
//       CSPRNG and just seed with data from the OS?