A simple RPC demo implemented in Go and Rust.
The server is already hosted on test.lingkang.dev:8333
for testing.
The rustdoc of client side is hosted on lingkang.dev/rpc_demo/
.
See this blog post for more details: Implement RPC demo from scratch - Lingkang's Blog.
The server side is implemented in Go, under the ./server
directory.
To run it locally:
cd server
go run cmd/main.go
Or build and run the binary:
cd server
go build -o target/rpc_demo cmd/main.go
./target/rpc_demo
Or use nohup
to run it in the background.
nohup ./target/rpc_demo > ./target/output.txt 2>&1 & # keep the output
# or
nohup ./target/rpc_demo > /dev/null 2>&1 & # discard the output
Golang built-in module log
is used to provide basic running information.
The client side is implemented in Rust, under the ./client
directory.
It can be run locally:
cd client
cargo run
A naive implementation of logger based on log
crate is used in this demo:
Count lines of code:
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Go 5 60 50 347
Rust 8 84 120 320
Markdown 2 51 0 119
YAML 2 13 2 45
PowerShell 1 7 0 8
TOML 1 2 1 7
-------------------------------------------------------------------------------
SUM: 19 217 173 846
-------------------------------------------------------------------------------