mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-28 17:23:09 -06:00
Build fixes
This commit is contained in:
parent
b263a4e01b
commit
8f7ccc9fae
|
|
@ -45,10 +45,6 @@ func (m *DendriteMonolith) PeerCount() int {
|
||||||
return m.YggdrasilNode.PeerCount()
|
return m.YggdrasilNode.PeerCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DendriteMonolith) SessionCount() int {
|
|
||||||
return m.YggdrasilNode.SessionCount()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *DendriteMonolith) SetMulticastEnabled(enabled bool) {
|
func (m *DendriteMonolith) SetMulticastEnabled(enabled bool) {
|
||||||
m.YggdrasilNode.SetMulticastEnabled(enabled)
|
m.YggdrasilNode.SetMulticastEnabled(enabled)
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +74,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ygg, err := yggconn.Setup("dendrite", m.StorageDirectory)
|
ygg, err := yggconn.Setup("dendrite", m.StorageDirectory, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +83,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
cfg := &config.Dendrite{}
|
cfg := &config.Dendrite{}
|
||||||
cfg.Defaults()
|
cfg.Defaults()
|
||||||
cfg.Global.ServerName = gomatrixserverlib.ServerName(ygg.DerivedServerName())
|
cfg.Global.ServerName = gomatrixserverlib.ServerName(ygg.DerivedServerName())
|
||||||
cfg.Global.PrivateKey = ygg.SigningPrivateKey()
|
cfg.Global.PrivateKey = ygg.PrivateKey()
|
||||||
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
cfg.Global.KeyID = gomatrixserverlib.KeyID(signing.KeyID)
|
||||||
cfg.Global.Kafka.UseNaffka = true
|
cfg.Global.Kafka.UseNaffka = true
|
||||||
cfg.Global.Kafka.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-naffka.db", m.StorageDirectory))
|
cfg.Global.Kafka.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-naffka.db", m.StorageDirectory))
|
||||||
|
|
@ -134,18 +130,6 @@ func (m *DendriteMonolith) Start() {
|
||||||
asAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
asAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
|
||||||
rsAPI.SetAppserviceAPI(asAPI)
|
rsAPI.SetAppserviceAPI(asAPI)
|
||||||
|
|
||||||
ygg.SetSessionFunc(func(address string) {
|
|
||||||
req := &api.PerformServersAliveRequest{
|
|
||||||
Servers: []gomatrixserverlib.ServerName{
|
|
||||||
gomatrixserverlib.ServerName(address),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
res := &api.PerformServersAliveResponse{}
|
|
||||||
if err := fsAPI.PerformServersAlive(context.TODO(), req, res); err != nil {
|
|
||||||
logrus.WithError(err).Error("Failed to send wake-up message to newly connected node")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// The underlying roomserver implementation needs to be able to call the fedsender.
|
// The underlying roomserver implementation needs to be able to call the fedsender.
|
||||||
// This is different to rsAPI which can be the http client which doesn't need this dependency
|
// This is different to rsAPI which can be the http client which doesn't need this dependency
|
||||||
rsAPI.SetFederationSenderAPI(fsAPI)
|
rsAPI.SetFederationSenderAPI(fsAPI)
|
||||||
|
|
|
||||||
|
|
@ -56,16 +56,18 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
internal.SetupPprof()
|
internal.SetupPprof()
|
||||||
|
|
||||||
ygg, err := yggconn.Setup(*instanceName, ".")
|
ygg, err := yggconn.Setup(*instanceName, ".", *instancePeer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
ygg.SetMulticastEnabled(true)
|
ygg.SetMulticastEnabled(true)
|
||||||
if instancePeer != nil && *instancePeer != "" {
|
if instancePeer != nil && *instancePeer != "" {
|
||||||
if err = ygg.SetStaticPeer(*instancePeer); err != nil {
|
if err = ygg.SetStaticPeer(*instancePeer); err != nil {
|
||||||
logrus.WithError(err).Error("Failed to set static peer")
|
logrus.WithError(err).Error("Failed to set static peer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
cfg := &config.Dendrite{}
|
cfg := &config.Dendrite{}
|
||||||
cfg.Defaults()
|
cfg.Defaults()
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func (n *Node) DialerContext(ctx context.Context, _, address string) (net.Conn,
|
||||||
return n.utpSocket.DialAddrContext(ctx, pk)
|
return n.utpSocket.DialAddrContext(ctx, pk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Setup(instanceName, storageDirectory string) (*Node, error) {
|
func Setup(instanceName, storageDirectory, peerURI string) (*Node, error) {
|
||||||
n := &Node{
|
n := &Node{
|
||||||
core: &yggdrasilcore.Core{},
|
core: &yggdrasilcore.Core{},
|
||||||
config: yggdrasildefaults.GenerateConfig(),
|
config: yggdrasildefaults.GenerateConfig(),
|
||||||
|
|
@ -81,6 +81,9 @@ func Setup(instanceName, storageDirectory string) (*Node, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
n.config.Peers = []string{}
|
n.config.Peers = []string{}
|
||||||
|
if peerURI != "" {
|
||||||
|
n.config.Peers = append(n.config.Peers, peerURI)
|
||||||
|
}
|
||||||
n.config.AdminListen = "none"
|
n.config.AdminListen = "none"
|
||||||
|
|
||||||
j, err := json.MarshalIndent(n.config, "", " ")
|
j, err := json.MarshalIndent(n.config, "", " ")
|
||||||
|
|
@ -157,17 +160,22 @@ func (n *Node) KnownNodes() []gomatrixserverlib.ServerName {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) SetMulticastEnabled(enabled bool) {
|
func (n *Node) SetMulticastEnabled(enabled bool) {
|
||||||
|
// TODO: There's no dynamic reconfiguration in Yggdrasil v0.4
|
||||||
|
// so we need a solution for this.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) DisconnectMulticastPeers() {
|
func (n *Node) DisconnectMulticastPeers() {
|
||||||
|
// TODO: There's no dynamic reconfiguration in Yggdrasil v0.4
|
||||||
|
// so we need a solution for this.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) DisconnectNonMulticastPeers() {
|
func (n *Node) DisconnectNonMulticastPeers() {
|
||||||
|
// TODO: There's no dynamic reconfiguration in Yggdrasil v0.4
|
||||||
|
// so we need a solution for this.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) SetStaticPeer(uri string) error {
|
func (n *Node) SetStaticPeer(uri string) error {
|
||||||
|
// TODO: There's no dynamic reconfiguration in Yggdrasil v0.4
|
||||||
|
// so we need a solution for this.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue