Move project to gosrc.io/xmpp
The URL will be more permanent as this is a place we dedicate as short URL for our go projects.
This commit is contained in:
parent
95585866c2
commit
5eae7f4ef7
|
@ -1,6 +1,6 @@
|
||||||
# Go XMPP library
|
# Go XMPP library
|
||||||
|
|
||||||
[![Codeship Status for FluuxIO/xmpp](https://app.codeship.com/projects/dba7f300-d145-0135-6c51-26e28af241d2/status?branch=master)](https://app.codeship.com/projects/262399) [![GoDoc](https://godoc.org/fluux.io/xmpp?status.svg)](https://godoc.org/fluux.io/xmpp) [![GoReportCard](https://goreportcard.com/badge/fluux.io/xmpp)](https://goreportcard.com/report/fluux.io/xmpp) [![codecov](https://codecov.io/gh/FluuxIO/xmpp/branch/master/graph/badge.svg)](https://codecov.io/gh/FluuxIO/xmpp)
|
[![Codeship Status for FluuxIO/xmpp](https://app.codeship.com/projects/dba7f300-d145-0135-6c51-26e28af241d2/status?branch=master)](https://app.codeship.com/projects/262399) [![GoDoc](https://godoc.org/gosrc.io/xmpp?status.svg)](https://godoc.org/gosrc.io/xmpp) [![GoReportCard](https://goreportcard.com/badge/gosrc.io/xmpp)](https://goreportcard.com/report/fluux.io/xmpp) [![codecov](https://codecov.io/gh/FluuxIO/xmpp/branch/master/graph/badge.svg)](https://codecov.io/gh/FluuxIO/xmpp)
|
||||||
|
|
||||||
Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT.
|
Fluux XMPP is a Go XMPP library, focusing on simplicity, simple automation, and IoT.
|
||||||
|
|
||||||
|
|
2
auth.go
2
auth.go
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -3,13 +3,13 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"fluux.io/xmpp"
|
"gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
component := MyComponent{Name: "Test Component", Category: "gateway", Type: "service"}
|
component := MyComponent{Name: "Test Component", Category: "gateway", Type: "service"}
|
||||||
component.xmpp = &xmpp.Component{Host: "service.localhost", Secret: "mypass"}
|
component.xmpp = &xmpp.Component{Host: "service.localhost", Secret: "mypass"}
|
||||||
component.xmpp.Connect("localhost:8888")
|
_ = component.xmpp.Connect("localhost:8888")
|
||||||
|
|
||||||
for {
|
for {
|
||||||
packet, err := component.xmpp.ReadPacket()
|
packet, err := component.xmpp.ReadPacket()
|
||||||
|
@ -39,7 +39,7 @@ func main() {
|
||||||
Type: "cancel",
|
Type: "cancel",
|
||||||
}
|
}
|
||||||
reply := p.MakeError(xError)
|
reply := p.MakeError(xError)
|
||||||
component.xmpp.Send(&reply)
|
_ = component.xmpp.Send(&reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
case xmpp.Message:
|
case xmpp.Message:
|
||||||
|
@ -83,7 +83,7 @@ func DiscoResult(c MyComponent, attrs xmpp.PacketAttrs, info *xmpp.DiscoInfo) {
|
||||||
}
|
}
|
||||||
iq.AddPayload(&payload)
|
iq.AddPayload(&payload)
|
||||||
|
|
||||||
c.xmpp.Send(iq)
|
_ = c.xmpp.Send(iq)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
|
func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
|
||||||
|
@ -98,5 +98,5 @@ func DiscoItems(c MyComponent, attrs xmpp.PacketAttrs, items *xmpp.DiscoItems) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iq.AddPayload(&payload)
|
iq.AddPayload(&payload)
|
||||||
c.xmpp.Send(iq)
|
_ = c.xmpp.Send(iq)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"fluux.io/xmpp"
|
"gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -37,11 +37,11 @@ func main() {
|
||||||
for packet := range client.Recv() {
|
for packet := range client.Recv() {
|
||||||
switch packet := packet.(type) {
|
switch packet := packet.(type) {
|
||||||
case *xmpp.Message:
|
case *xmpp.Message:
|
||||||
fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
|
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", packet.Body, packet.From)
|
||||||
reply := xmpp.Message{PacketAttrs: xmpp.PacketAttrs{To: packet.From}, Body: packet.Body}
|
reply := xmpp.Message{PacketAttrs: xmpp.PacketAttrs{To: packet.From}, Body: packet.Body}
|
||||||
client.Send(reply)
|
_ = client.Send(reply)
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
_, _ = fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"fluux.io/xmpp"
|
|
||||||
"fluux.io/xmpp/iot"
|
|
||||||
"fluux.io/xmpp/pep"
|
|
||||||
"github.com/processone/mpg123"
|
"github.com/processone/mpg123"
|
||||||
"github.com/processone/soundcloud"
|
"github.com/processone/soundcloud"
|
||||||
|
"gosrc.io/xmpp"
|
||||||
|
"gosrc.io/xmpp/iot"
|
||||||
|
"gosrc.io/xmpp/pep"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get the actual song Stream URL from SoundCloud website song URL and play it with mpg123 player.
|
// Get the actual song Stream URL from SoundCloud website song URL and play it with mpg123 player.
|
||||||
|
@ -47,7 +47,7 @@ func main() {
|
||||||
case xmpp.Presence:
|
case xmpp.Presence:
|
||||||
// Do nothing with received presence
|
// Do nothing with received presence
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
_, _ = fmt.Fprintf(os.Stdout, "Ignoring packet: %T\n", packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,17 +77,17 @@ func processIq(client *xmpp.Client, p *mpg123.Player, packet *xmpp.IQ) {
|
||||||
playSCURL(p, url)
|
playSCURL(p, url)
|
||||||
setResponse := new(iot.ControlSetResponse)
|
setResponse := new(iot.ControlSetResponse)
|
||||||
reply := xmpp.IQ{PacketAttrs: xmpp.PacketAttrs{To: packet.From, Type: "result", Id: packet.Id}, Payload: []xmpp.IQPayload{setResponse}}
|
reply := xmpp.IQ{PacketAttrs: xmpp.PacketAttrs{To: packet.From, Type: "result", Id: packet.Id}, Payload: []xmpp.IQPayload{setResponse}}
|
||||||
client.Send(reply)
|
_ = client.Send(reply)
|
||||||
// TODO add Soundclound artist / title retrieval
|
// TODO add Soundclound artist / title retrieval
|
||||||
sendUserTune(client, "Radiohead", "Spectre")
|
sendUserTune(client, "Radiohead", "Spectre")
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(os.Stdout, "Other IQ Payload: %T\n", packet.Payload)
|
_, _ = fmt.Fprintf(os.Stdout, "Other IQ Payload: %T\n", packet.Payload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendUserTune(client *xmpp.Client, artist string, title string) {
|
func sendUserTune(client *xmpp.Client, artist string, title string) {
|
||||||
tune := pep.Tune{Artist: artist, Title: title}
|
tune := pep.Tune{Artist: artist, Title: title}
|
||||||
client.SendRaw(tune.XMPPFormat())
|
_ = client.SendRaw(tune.XMPPFormat())
|
||||||
}
|
}
|
||||||
|
|
||||||
func playSCURL(p *mpg123.Player, rawURL string) {
|
func playSCURL(p *mpg123.Player, rawURL string) {
|
||||||
|
@ -95,7 +95,7 @@ func playSCURL(p *mpg123.Player, rawURL string) {
|
||||||
// TODO: Maybe we need to check the track itself to get the stream URL from reply ?
|
// TODO: Maybe we need to check the track itself to get the stream URL from reply ?
|
||||||
url := soundcloud.FormatStreamURL(songID)
|
url := soundcloud.FormatStreamURL(songID)
|
||||||
|
|
||||||
p.Play(url)
|
_ = p.Play(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectXmpp(jid string, password string, address string) (client *xmpp.Client, err error) {
|
func connectXmpp(jid string, password string, address string) (client *xmpp.Client, err error) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
2
doc.go
2
doc.go
|
@ -29,4 +29,4 @@ Fluux XMPP has been primarily tested with ejabberd (https://www.ejabberd.im)
|
||||||
but it should work with any XMPP compliant server.
|
but it should work with any XMPP compliant server.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package iot // import "fluux.io/xmpp/iot"
|
package iot // import "gosrc.io/xmpp/iot"
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
||||||
|
|
2
iq.go
2
iq.go
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
4
jid.go
4
jid.go
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -22,7 +22,7 @@ func NewJid(sjid string) (jid *Jid, err error) {
|
||||||
|
|
||||||
s2 := strings.Split(s1[1], "/")
|
s2 := strings.Split(s1[1], "/")
|
||||||
if len(s2) > 2 {
|
if len(s2) > 2 {
|
||||||
err = errors.New("invalid JID: " + sjid)
|
err = errors.New("invalid JID: " + sjidd)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jid.domain = s2[0]
|
jid.domain = s2[0]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
2
ns.go
2
ns.go
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NSStream = "http://etherx.jabber.org/streams"
|
NSStream = "http://etherx.jabber.org/streams"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
type Packet interface {
|
type Packet interface {
|
||||||
Name() string
|
Name() string
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package pep // import "fluux.io/xmpp/pep"
|
package pep // import "gosrc.io/xmpp/pep"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package xmpp // import "fluux.io/xmpp"
|
package xmpp // import "gosrc.io/xmpp"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
Loading…
Reference in a new issue