Пример #1
0
func InitDatastore(bindInterface string, bootstrap bool) error {
	err := ecc.Start(bootstrap, bootstrap, bindInterface, dataDir)
	if err == nil {
		go ecc.RegisterForNodeUpdates(listener)
	}
	return err
}
Пример #2
0
func main() {
	ecc.Start(true, true, "eth1", dataDir)
	listener := eccListener{}
	go ecc.RegisterForNodeUpdates(listener)
	go ecc.RegisterForKeyUpdates("network", "web", listener)
	keyUpdates("web")
	ecc.Delete("network", "web")
	go ecc.RegisterForKeyUpdates("network", "db", listener)
	keyUpdates("db")
	keyUpdates("web")
	// Ctrl+C handling
	ecc.Leave()
	time.Sleep(time.Second * 15)
	ecc.Start(true, true, "eth1", dataDir)

	handler := make(chan os.Signal, 1)
	signal.Notify(handler, os.Interrupt)
	for sig := range handler {
		if sig == os.Interrupt {
			time.Sleep(1e9)
			break
		}
	}
}