func main() { push, err := dcams.NewPush() dieOnErr(err) pull, err := dcams.NewPull() dieOnErr(err) log.Println("Trust") push.Trust(pull) pull.Trust(push) web, _ := dcams.New() web.AddLocal(*pull) dcams.ManifestFileName = "test.manifest" web.WriteFile() /* testserver,_ := dcams.New() testserver.AddLocal(*push) dcams.ManifestFileName = "testserver.manifest" testserver.WriteFile() */ }
func main() { dcams.ManifestFileName = "testserver.manifest" testserver, err := dcams.Open() if err != nil { //What do we need: 1 push push, err := dcams.NewPush("testserverData") dieOnErr(err) testserver.Add(push) testserver.WriteFile() log.Fatal("testserver not ready, add key to trusted list ", push.PublicKey) } dcams.ManifestFileName = "web.manifest" web, err := dcams.Open() if err != nil { //What do we need: 1 pull pull, err := dcams.NewPull("testserverData") dieOnErr(err) web.Add(pull) web.WriteFile() log.Fatal("webserver not ready, add key to trusted list ", pull.PublicKey) } log.Println(testserver) log.Println(web) log.Println("Connect") testserver.Connect() web.Connect() err = testserver.Resource("testserverData").Write("Hello") dieOnErr(err) out, err := web.Resource("testserverData").Read() dieOnErr(err) log.Println("Got:", out) }