mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Improvements to Yggdrasil demo (#1114)
* Improvements to Yggdrasil demo * Fix missing copyright * Fix tie-break
This commit is contained in:
parent
90a0aa9b3e
commit
3b4be90000
6 changed files with 217 additions and 17 deletions
|
@ -40,10 +40,10 @@ func (n *Node) listenFromYgg() {
|
|||
return
|
||||
}
|
||||
var session *yamux.Session
|
||||
if strings.Compare(n.EncryptionPublicKey(), conn.RemoteAddr().String()) < 0 {
|
||||
session, err = yamux.Client(conn, n.yamuxConfig())
|
||||
} else {
|
||||
if strings.Compare(conn.RemoteAddr().String(), n.DerivedServerName()) < 0 {
|
||||
session, err = yamux.Server(conn, n.yamuxConfig())
|
||||
} else {
|
||||
session, err = yamux.Client(conn, n.yamuxConfig())
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -96,7 +96,7 @@ func (n *Node) DialContext(ctx context.Context, network, address string) (net.Co
|
|||
n.log.Println("n.dialer.DialContext:", err)
|
||||
return nil, err
|
||||
}
|
||||
if strings.Compare(n.EncryptionPublicKey(), address) < 0 {
|
||||
if strings.Compare(address, n.DerivedServerName()) > 0 {
|
||||
session, err = yamux.Client(conn, n.yamuxConfig())
|
||||
} else {
|
||||
session, err = yamux.Server(conn, n.yamuxConfig())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue