Bind build support, further Yggdrasil demo updates (#1152)

* Add gobind builds for Yggdrasil demo

* Massage client API a bit

* Fix build

* Fix gobind build

* Fix gobind client API setup

* Tweaks

* Tweaks

* Update sytest-whitelist, add comment

* Default to sending push rules on initial sync
This commit is contained in:
Neil Alexander 2020-06-19 13:29:27 +01:00 committed by GitHub
parent 72444e4a4f
commit 7f26b0cd13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 336 additions and 65 deletions

View file

@ -67,7 +67,7 @@ func (n *Node) DialerContext(ctx context.Context, network, address string) (net.
}
// nolint:gocyclo
func Setup(instanceName, instancePeer string) (*Node, error) {
func Setup(instanceName, instancePeer, storageDirectory string) (*Node, error) {
n := &Node{
core: &yggdrasil.Core{},
config: yggdrasilconfig.GenerateConfig(),
@ -77,7 +77,7 @@ func Setup(instanceName, instancePeer string) (*Node, error) {
incoming: make(chan *yamux.Stream),
}
yggfile := fmt.Sprintf("%s-yggdrasil.conf", instanceName)
yggfile := fmt.Sprintf("%s/%s-yggdrasil.conf", storageDirectory, instanceName)
if _, err := os.Stat(yggfile); !os.IsNotExist(err) {
yggconf, e := ioutil.ReadFile(yggfile)
if e != nil {
@ -87,7 +87,7 @@ func Setup(instanceName, instancePeer string) (*Node, error) {
panic(err)
}
} else {
n.config.AdminListen = fmt.Sprintf("unix://./%s-yggdrasil.sock", instanceName)
n.config.AdminListen = "none" // fmt.Sprintf("unix://%s/%s-yggdrasil.sock", storageDirectory, instanceName)
n.config.MulticastInterfaces = []string{".*"}
n.config.EncryptionPrivateKey = hex.EncodeToString(n.EncryptionPrivateKey())
n.config.EncryptionPublicKey = hex.EncodeToString(n.EncryptionPublicKey())
@ -114,20 +114,22 @@ func Setup(instanceName, instancePeer string) (*Node, error) {
panic(err)
}
}
if err = n.admin.Init(n.core, n.state, n.log, nil); err != nil {
panic(err)
}
if err = n.admin.Start(); err != nil {
panic(err)
}
/*
if err = n.admin.Init(n.core, n.state, n.log, nil); err != nil {
panic(err)
}
if err = n.admin.Start(); err != nil {
panic(err)
}
*/
if err = n.multicast.Init(n.core, n.state, n.log, nil); err != nil {
panic(err)
}
if err = n.multicast.Start(); err != nil {
panic(err)
}
n.admin.SetupAdminHandlers(n.admin)
n.multicast.SetupAdminHandlers(n.admin)
//n.admin.SetupAdminHandlers(n.admin)
//n.multicast.SetupAdminHandlers(n.admin)
n.listener, err = n.core.ConnListen()
if err != nil {
panic(err)
@ -137,6 +139,9 @@ func Setup(instanceName, instancePeer string) (*Node, error) {
panic(err)
}
n.log.Println("Public curve25519:", n.core.EncryptionPublicKey())
n.log.Println("Public ed25519:", n.core.SigningPublicKey())
go n.listenFromYgg()
return n, nil