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:
Wichert Akkerman
2019-10-11 06:41:15 +02:00
committed by Mickaël Rémond
parent f8d0e99696
commit 7fa4b06705
13 changed files with 67 additions and 25 deletions

View File

@@ -11,9 +11,11 @@ import (
func main() {
opts := xmpp.ComponentOptions{
Domain: "service.localhost",
Secret: "mypass",
Address: "localhost:9999",
TransportConfiguration: xmpp.TransportConfiguration{
Address: "localhost:9999",
},
Domain: "service.localhost",
Secret: "mypass",
// TODO: Move that part to a component discovery handler
Name: "Test Component",

View File

@@ -10,9 +10,11 @@ import (
func main() {
opts := xmpp.ComponentOptions{
TransportConfiguration: xmpp.TransportConfiguration{
Address: "localhost:8888",
},
Domain: "service2.localhost",
Secret: "mypass",
Address: "localhost:8888",
Name: "Test Component",
Category: "gateway",
Type: "service",

View File

@@ -15,7 +15,9 @@ import (
func main() {
config := xmpp.Config{
Address: "localhost:5222",
TransportConfiguration: xmpp.TransportConfiguration{
Address: "localhost:5222",
},
Jid: "test@localhost",
Credential: xmpp.Password("test"),
StreamLogger: os.Stdout,

View File

@@ -32,7 +32,9 @@ func main() {
// 2. Prepare XMPP client
config := xmpp.Config{
Address: *address,
TransportConfiguration: xmpp.TransportConfiguration{
Address: *address,
},
Jid: *jid,
Credential: xmpp.Password(*password),
// StreamLogger: os.Stdout,

View File

@@ -15,12 +15,14 @@ import (
func main() {
config := xmpp.Config{
Address: "localhost:5222",
TransportConfiguration: xmpp.TransportConfiguration{
Address: "localhost:5222",
// TLSConfig: tls.Config{InsecureSkipVerify: true},
},
Jid: "test@localhost",
Credential: xmpp.OAuthToken("OdAIsBlY83SLBaqQoClAn7vrZSHxixT8"),
StreamLogger: os.Stdout,
// Insecure: true,
// TLSConfig: tls.Config{InsecureSkipVerify: true},
}
router := xmpp.NewRouter()