mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 11:41:38 +00:00
P2P demo tweaks
This commit is contained in:
parent
5997c32452
commit
3a9dde28fd
@ -218,6 +218,9 @@ func (m *DendriteMonolith) Start() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
||||||
panic("failed to read the old private key: " + err.Error())
|
panic("failed to read the old private key: " + err.Error())
|
||||||
@ -233,7 +236,12 @@ func (m *DendriteMonolith) Start() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pk = sk.Public().(ed25519.PublicKey)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
m.listener, err = net.Listen("tcp", "localhost:65432")
|
m.listener, err = net.Listen("tcp", "localhost:65432")
|
||||||
|
@ -87,6 +87,9 @@ func (m *DendriteMonolith) Start() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
||||||
panic("failed to read the old private key: " + err.Error())
|
panic("failed to read the old private key: " + err.Error())
|
||||||
@ -103,7 +106,12 @@ func (m *DendriteMonolith) Start() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pk = sk.Public().(ed25519.PublicKey)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
m.listener, err = net.Listen("tcp", "localhost:65432")
|
m.listener, err = net.Listen("tcp", "localhost:65432")
|
||||||
|
@ -98,6 +98,9 @@ func main() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
||||||
panic("failed to read the old private key: " + err.Error())
|
panic("failed to read the old private key: " + err.Error())
|
||||||
@ -114,7 +117,13 @@ func main() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pk = sk.Public().(ed25519.PublicKey)
|
||||||
|
|
||||||
cfg.Defaults(config.DefaultOpts{
|
cfg.Defaults(config.DefaultOpts{
|
||||||
Generate: true,
|
Generate: true,
|
||||||
Monolithic: true,
|
Monolithic: true,
|
||||||
@ -136,7 +145,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pk = sk.Public().(ed25519.PublicKey)
|
|
||||||
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
|
|
||||||
|
@ -86,6 +86,9 @@ func main() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
if sk, err = os.ReadFile(oldkeyfile); err != nil {
|
||||||
panic("failed to read the old private key: " + err.Error())
|
panic("failed to read the old private key: " + err.Error())
|
||||||
@ -102,7 +105,12 @@ func main() {
|
|||||||
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
if _, sk, err = config.LoadMatrixKey(keyfile, os.ReadFile); err != nil {
|
||||||
panic("failed to load PEM key: " + err.Error())
|
panic("failed to load PEM key: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if len(sk) != ed25519.PrivateKeySize {
|
||||||
|
panic("the private key is not long enough")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pk = sk.Public().(ed25519.PublicKey)
|
||||||
|
|
||||||
// use custom config if config flag is set
|
// use custom config if config flag is set
|
||||||
if configFlagSet {
|
if configFlagSet {
|
||||||
@ -129,7 +137,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pk = sk.Public().(ed25519.PublicKey)
|
|
||||||
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
cfg.Global.ServerName = gomatrixserverlib.ServerName(hex.EncodeToString(pk))
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user