You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-xmpp/transport.go

36 lines
822 B

package xmpp
import (
"crypto/tls"
"errors"
)
var TLSNotSupported = errors.New("Transport does not support StartTLS")
type TransportConfiguration struct {
// Address is the XMPP Host and port to connect to. Host is of
// the form 'serverhost:port' i.e "localhost:8888"
Address string
ConnectTimeout int // Client timeout in seconds. Default to 15
// tls.Config must not be modified after having been passed to NewClient. Any
// changes made after connecting are ignored.
TLSConfig *tls.Config
}
type Transport interface {
Connect() error
DoesStartTLS() bool
StartTLS(domain string) error
IsSecure() bool
Read(p []byte) (n int, err error)
Write(p []byte) (n int, err error)
Close() error
}
func NewTransport(config TransportConfiguration) Transport {
return &XMPPTransport{Config: config}
}