xmpp

package module
v0.0.0-...-fa0388b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2014 License: MIT Imports: 9 Imported by: 0

README

xmpp

Xmpp Implementation in Golang (Not for production)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Active

type Active struct {
	Xmlns string `xml:"xmlns,attr"`
}

type Bind

type Bind struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"`
	Body    string   `xml:",innerxml"`
}

type Body

type Body struct {
	Body string `xml:",innerxml"`
}

type IQ

type IQ struct {
	XMLName xml.Name `xml:"iq"`
	Type    string   `xml:"type,attr"`
	Id      string   `xml:"id,attr"`
	Binds   []Bind
	Queries []Query `xml:"query"`
	Pings   []Ping  `xml:"ping"`
}

type Message

type Message struct {
	To      string
	Message string
	From    string
}

type Ping

type Ping struct {
	Xmlns string `xml:"xmlns,attr"`
	Body  string `xml:",innerxml"`
}

type Query

type Query struct {
	Xmlns string `xml:"xmlns,attr"`
	Body  string `xml:",innerxml"`
}

type Request

type Request struct {
	Id   string
	User string
}

type Server

type Server struct {
	MessageChannel chan Message
	// contains filtered or unexported fields
}

func NewServer

func NewServer(domain string) (srv Server)

func (*Server) HandleQuery

func (srv *Server) HandleQuery(query string, handler func(io.Writer, Request))

func (Server) ListenAndServe

func (srv Server) ListenAndServe(protocol, addr string) error

func (*Server) SetAuthFunc

func (srv *Server) SetAuthFunc(authenticate func(username, password string) bool)

func (*Server) SetHandleIncomingMessage

func (srv *Server) SetHandleIncomingMessage(handle func(msg XmppMessage))

func (*Server) SetKeyPair

func (srv *Server) SetKeyPair(certfile, keyfile string) error

type Stream

type Stream struct {
	XMLName  xml.Name `xml:"http://etherx.jabber.org/streams stream"`
	To       string   `xml:"to,attr,omitempty"`
	From     string   `xml:"from,attr,omitempty"`
	Language string   `xml:"lang,attr,omitempty"`
	Id       string   `xml:"id,attr,omitempty"`
	Stream   string   `xml:"http://etherx.jabber.org/streams stream,attr,omitempty"`
	Version  string   `xml:"version,attr,omitempty"`
}

Stream represents an XMPP stream.

type StreamError

type StreamError struct {
	Condition string // one of the conditions from §4.9.3 of RFC 6120
	Message   string
}

StreamError is a generic error related to a stream.

type XmppMessage

type XmppMessage struct {
	XMLName xml.Name `xml:"message"`
	Type    string   `xml:"type,attr,omitempty`
	Id      string   `xml:"id,attr,omitempty"`
	To      string   `xml:"to,attr,omitempty"`
	Actives []Active `xml:"active"`
	Bodies  []Body   `xml:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL