Exemplo n.º 1
0
Arquivo: repo.go Projeto: nicnys-8/mdc
func main() {
	var done chan int

	node, done := bitverse.MakeEdgeNode(bitverse.MakeWSTransport(), new(BitverseObserver))
	//node.Debug()
	fmt.Println("-> my id is " + node.Id())

	go node.Connect("localhost:1111")

	<-done
}
Exemplo n.º 2
0
func main() {
	var done chan int

	secret2, _ := bitverse.GenerateAesSecret()
	fmt.Println(secret2)

	node, done := bitverse.MakeEdgeNode(bitverse.MakeWSTransport(), new(BitverseObserver))
	//node.Debug()
	fmt.Println("-> my id is " + node.Id())

	msgServiceObserver := new(MsgServiceObserver)
	_, err := node.CreateMsgService(secret, serviceId, msgServiceObserver)
	if err != nil {
		panic(err)
	}

	go node.Connect("localhost:1111")

	<-done
}
Exemplo n.º 3
0
Arquivo: cli.go Projeto: nicnys-8/mdc
func main() {
	flag.Parse()
	if *aesSecretFlag {
		aesSecret, err := bitverse.GenerateAesSecret()

		if err != nil {
			panic(err)
		}

		fmt.Println(aesSecret)
	} else if *certFlag != "" {
		fmt.Println("generating files " + *certFlag + " " + *certFlag + ".pub")
		bitverse.GeneratePem(*certFlag)
	} else {
		// set up super node
		var done chan int

		transport := bitverse.MakeWSTransport()

		var superNode *bitverse.SuperNode
		temp := strings.Split(*localFlag, ":")
		localAddr := temp[0]
		localPort := temp[1]

		superNode, done = bitverse.MakeSuperNode(transport, localAddr, localPort)

		if *debugFlag {
			superNode.Debug()
		}

		if *testHttpServerFlag {
			fmt.Println("Starting a HTTP test server at port 8080")
			log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("./js/"))))
		}

		<-done
	}
}