Example #1
0
func runDir() {
	fh, err := os.Open("_SECRETS_/privkey-sanctum.bin")
	defer fh.Close()
	if err != nil {
		panic(err.Error())
	}
	masterPriv := natrium.EdDSAGenerateKey()
	_, err = io.ReadFull(fh, masterPriv)
	if err != nil {
		panic(err.Error())
	}
	haha := directory.NewServer(masterPriv)

	kilog.Info("starting SAGIRI directory on port 2378")
	server, err := net.Listen("tcp", "0.0.0.0:2378")
	if err != nil {
		panic(err.Error())
	}

	for {
		rawcl, err := server.Accept()
		if err != nil {
			return
		}
		go func() {
			defer rawcl.Close()
			haha.HandleClient(rawcl)
		}()
	}
}
Example #2
0
func spinTestDir() {
	var err error
	__test_srv, err = net.Listen("tcp", "127.0.0.1:12345")
	if err != nil {
		panic(err.Error())
	}
	go func() {
		fh, err := os.Open("privkey-sanctum.bin")
		defer fh.Close()
		if err != nil {
			panic(err.Error())
		}
		masterPriv := natrium.EdDSAGenerateKey()
		_, err = io.ReadFull(fh, masterPriv)
		if err != nil {
			panic(err.Error())
		}
		fmt.Println(masterPriv)

		haha := directory.NewServer(masterPriv)

		for {
			rawcl, err := __test_srv.Accept()
			if err != nil {
				return
			}
			go func() {
				defer rawcl.Close()
				/*obfscl, err := kiss.LLObfsServerHandshake(masterPriv.PublicKey(), rawcl)
				if err != nil {
					panic(err.Error())
				}*/
				haha.HandleClient(rawcl)
			}()
		}
	}()
}