1
Fork 0

dynamic dns

This commit is contained in:
Andy Killorin 2023-12-16 19:45:53 -06:00
parent 3a05db554c
commit fb8a03ae22
Signed by: ank
GPG key ID: B6241CA3B552BCA4
4 changed files with 12 additions and 5 deletions

View file

@ -1,7 +1,3 @@
-- wget run http://68.46.126.104:48228/turtle/client.lua
local ipaddr = "68.46.126.104"
if not ipaddr then
if fs.exists("/disk/ip") then
local ipfile = fs.open("/disk/ip")

View file

@ -9,6 +9,7 @@ edition = "2021"
anyhow = "1.0.75"
axum = "0.7.2"
bit-struct = "0.3.2"
const_format = "0.2.32"
feistel_rs = "0.1.0"
rstar = "0.11.0"
rustmatica = "0.1.1"

View file

@ -1,3 +1,12 @@
GLOBAL_IP=`dig +short @dns.toys -4 ip`
.PHONY: server server-opt
server: surnames.txt names.txt
GLOBAL_IP=$(GLOBAL_IP) cargo run
server-opt: surnames.txt names.txt
GLOBAL_IP=$(GLOBAL_IP) cargo run --release
surnames.txt:
curl https://raw.githubusercontent.com/Hyneman/moby-project/672f6bdca054c42d375f065ffee87e8ceba0c242/moby/mwords/21986na.mes |\
iconv -f cp1252 - > surnames.txt

View file

@ -13,6 +13,7 @@ use names::Name;
use serde_json::Value;
use tokio::sync::{Mutex, RwLock};
use serde::{Serialize, Deserialize};
use const_format::formatcp;
#[derive(Serialize, Deserialize)]
enum Direction {
@ -172,5 +173,5 @@ struct TurtleResponse {
}
async fn client() -> &'static str {
include_str!("../../client/client.lua")
formatcp!("local ipaddr = {}\n{}", env!("GLOBAL_IP"), include_str!("../../client/client.lua"))
}