From bbc58e58153f74e41f6e741883377b7f5e13fcc6 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Sat, 5 Nov 2016 16:57:00 -0600 Subject: [PATCH] Delete backend and rename cli to ricochet-cli ricochet-cli can act as a headless backend, so for now there is no point to having a separate backend program. It may be reintroduced later for multiprocess use by other frontends -- to be determined. --- .gitignore | 5 ++-- README.md | 4 +-- backend/backend.go | 37 --------------------------- {cli => ricochet-cli}/client.go | 0 {cli => ricochet-cli}/contact.go | 0 {cli => ricochet-cli}/conversation.go | 0 {cli => ricochet-cli}/innernet.go | 0 cli/cli.go => ricochet-cli/main.go | 0 {cli => ricochet-cli}/ui.go | 0 9 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 backend/backend.go rename {cli => ricochet-cli}/client.go (100%) rename {cli => ricochet-cli}/contact.go (100%) rename {cli => ricochet-cli}/conversation.go (100%) rename {cli => ricochet-cli}/innernet.go (100%) rename cli/cli.go => ricochet-cli/main.go (100%) rename {cli => ricochet-cli}/ui.go (100%) diff --git a/.gitignore b/.gitignore index 5e59442..7316069 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -cli/cli -backend/backend -*.json +ricochet-cli/ricochet-cli +*.ricochet diff --git a/README.md b/README.md index eee3189..f387d32 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,4 @@ Architecture **rpc** defines a [gRPC](http://www.grpc.io/) and [protobuf](https://developers.google.com/protocol-buffers/) API for communication between the client backend and frontend. This API is for trusted backends to communicate with frontend UI clients, and it's expected that both will usually be on the same machine and invisible to the end-user. Anything capable of speaking gRPC could implement a frontend. -**backend** is the backend application, providing the gRPC server and using the core implementation. - -**cli** is the first frontend, a Go readline-style text-only client. +**ricochet-cli** is a commandline program that acts as a backend and a readline-style CLI frontend. It can be used as a standalone client, to run a headless backend, or to attach to a running backend. diff --git a/backend/backend.go b/backend/backend.go deleted file mode 100644 index 17dd552..0000000 --- a/backend/backend.go +++ /dev/null @@ -1,37 +0,0 @@ -package main - -import ( - ricochet "github.com/ricochet-im/ricochet-go/core" - rpc "github.com/ricochet-im/ricochet-go/rpc" - "google.golang.org/grpc" - "log" - "net" -) - -const ( - defaultListener = "127.0.0.1:58281" -) - -func main() { - listener, err := net.Listen("tcp", defaultListener) - if err != nil { - log.Fatalf("listen failed: %v", err) - } - - config, err := ricochet.LoadConfig(".") - if err != nil { - log.Fatalf("config error: %v", err) - } - - core := new(ricochet.Ricochet) - if err := core.Init(config); err != nil { - log.Fatalf("init error: %v", err) - } - - server := &ricochet.RpcServer{ - Core: core, - } - grpcServer := grpc.NewServer() - rpc.RegisterRicochetCoreServer(grpcServer, server) - grpcServer.Serve(listener) -} diff --git a/cli/client.go b/ricochet-cli/client.go similarity index 100% rename from cli/client.go rename to ricochet-cli/client.go diff --git a/cli/contact.go b/ricochet-cli/contact.go similarity index 100% rename from cli/contact.go rename to ricochet-cli/contact.go diff --git a/cli/conversation.go b/ricochet-cli/conversation.go similarity index 100% rename from cli/conversation.go rename to ricochet-cli/conversation.go diff --git a/cli/innernet.go b/ricochet-cli/innernet.go similarity index 100% rename from cli/innernet.go rename to ricochet-cli/innernet.go diff --git a/cli/cli.go b/ricochet-cli/main.go similarity index 100% rename from cli/cli.go rename to ricochet-cli/main.go diff --git a/cli/ui.go b/ricochet-cli/ui.go similarity index 100% rename from cli/ui.go rename to ricochet-cli/ui.go