Add examples to README

This commit is contained in:
notplants 2021-12-18 10:34:55 -05:00
parent 95db71be61
commit d4d9ab3f9f
6 changed files with 21 additions and 9 deletions

2
Cargo.lock generated
View File

@ -1051,7 +1051,7 @@ dependencies = [
[[package]]
name = "peach-dyndns-server"
version = "0.1.0"
version = "0.1.2"
dependencies = [
"clap-log-flag",
"clap-verbosity-flag",

View File

@ -1,6 +1,6 @@
[package]
name = "peach-dyndns-server"
version = "0.1.0"
version = "0.1.2"
authors = ["Michael Williams <michael.williams@enspiral.com>", "Max Fowler <notplants@mfowler.info>"]
edition = "2018"

View File

@ -30,11 +30,23 @@ staging is deployed to /srv/peachcloud/peach-dyndns-server/dev-peach-dyndns
## Test
test peach-dyndns server is running,
# ping
```
curl http://localhost:8000
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "ping", "id":1 }' 127.0.0.1:3002
```
# register_domain
```
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "register_domain", "params" : {"domain": "mirage.dyn.peachcloud.org" }, "id":1 }' 127.0.0.1:3002
```
# is_domain_available
```
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "is_domain_available", "params" : {"domain": "mirage.dyn.peachcloud.org" }, "id":1 }' 127.0.0.1:3002
```
test peach-bind9 is running,
```
nslookup blue.dyn.peachcloud.org ns.peachcloud.org

2
cross_compile.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
cargo build --release --target=x86_64-unknown-linux-musl

2
deploy_binary.sh Normal file → Executable file
View File

@ -1,5 +1,5 @@
VERSION=0.1.0
VERSION=0.1.2
scp -i ~/.ssh/do_rsa2 target/x86_64-unknown-linux-musl/release/peach-dyndns-server root@147.182.177.135:/srv/files.commoninternet.net/peach-dyndns-server_${VERSION}_Linux_x86_64

View File

@ -72,11 +72,9 @@ pub fn run() -> Result<(), BoxError> {
let http_server =
env::var("PEACH_DYNDNS_SERVER").unwrap_or_else(|_| "127.0.0.1:3001".to_string());
info!("Starting JSON-RPC server on {}.", http_server);
info!("Starting JSON-RPC server on {}", http_server);
let server = ServerBuilder::new(io)
.cors(DomainsValidation::AllowOnly(vec![
AccessControlAllowOrigin::Null,
]))
.cors(DomainsValidation::Disabled)
.start_http(
&http_server
.parse()