forked from jshiffer/go-xmpp
Move address into transport config
This makes it possible to use a factory function to create a transport of the right type and not having to repeat the address when calling Transport.Connect()
This commit is contained in:
committed by
Mickaël Rémond
parent
f8d0e99696
commit
7fa4b06705
+9
-1
@@ -5,6 +5,9 @@ import (
|
||||
)
|
||||
|
||||
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.
|
||||
@@ -12,7 +15,7 @@ type TransportConfiguration struct {
|
||||
}
|
||||
|
||||
type Transport interface {
|
||||
Connect(address string) error
|
||||
Connect() error
|
||||
DoesStartTLS() bool
|
||||
StartTLS(domain string) error
|
||||
|
||||
@@ -20,3 +23,8 @@ type Transport interface {
|
||||
Write(p []byte) (n int, err error)
|
||||
Close() error
|
||||
}
|
||||
|
||||
func NewTransport(config TransportConfiguration) Transport {
|
||||
return &XMPPTransport{Config: config}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user