Fix bugs in P2P demos
This commit is contained in:
parent
bd7b0b1787
commit
a6f7e83596
|
@ -21,7 +21,7 @@ func ConnectToPeer(pRouter *pineconeRouter.Router, peer string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
c, _, err := websocket.Dial(ctx, peer, nil)
|
c, _, err := websocket.Dial(ctx, peer, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("websocket.Dial: %w", err)
|
return fmt.Errorf("websocket.DefaultDialer.Dial: %w", err)
|
||||||
}
|
}
|
||||||
parent = websocket.NetConn(ctx, c, websocket.MessageBinary)
|
parent = websocket.NetConn(ctx, c, websocket.MessageBinary)
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,7 +43,7 @@ type RoundTripper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (y *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
req.URL.Scheme = "https"
|
req.URL.Scheme = "http"
|
||||||
return y.inner.RoundTrip(req)
|
return y.inner.RoundTrip(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,13 @@ func createTransport(s *pineconeSessions.Sessions) *http.Transport {
|
||||||
}
|
}
|
||||||
tr.RegisterProtocol(
|
tr.RegisterProtocol(
|
||||||
"matrix", &RoundTripper{
|
"matrix", &RoundTripper{
|
||||||
inner: tr,
|
inner: &http.Transport{
|
||||||
|
DisableKeepAlives: false,
|
||||||
|
Dial: s.Dial,
|
||||||
|
DialContext: s.DialContext,
|
||||||
|
DialTLS: s.DialTLS,
|
||||||
|
DialTLSContext: s.DialTLSContext,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return tr
|
return tr
|
||||||
|
|
|
@ -18,6 +18,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -166,7 +167,7 @@ func main() {
|
||||||
cfg.Global.TrustedIDServers = []string{}
|
cfg.Global.TrustedIDServers = []string{}
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
cfg.Global.PrivateKey = sk
|
cfg.Global.PrivateKey = sk
|
||||||
cfg.Global.ServerName = gomatrixserverlib.ServerName(pk)
|
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||||
|
|
||||||
if err := cfg.Derive(); err != nil {
|
if err := cfg.Derive(); err != nil {
|
||||||
logrus.Fatalf("Failed to derive values from config: %s", err)
|
logrus.Fatalf("Failed to derive values from config: %s", err)
|
||||||
|
|
Loading…
Reference in a new issue