From 07241bee58bc6f3e8798ecb1484d44feef00de46 Mon Sep 17 00:00:00 2001 From: mleku Date: Sun, 29 Oct 2023 18:32:43 -0100 Subject: [PATCH] tada, with destructions --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 1 - go.sum | 1 - namestr.service | 10 +++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 namestr.service diff --git a/README.md b/README.md index fed18e9..55efc75 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,62 @@ # namestr simple, zero configuration NIP-05 with LetsEncrypt TLS security + +## usage + +install go on your VPS, clone this repo: + + git clone https://github.com/mleku/namestr.git + +build it: + + cd namestr + go build + +make it so it can listen on ports under 1024: + + sudo setcap 'cap_net_bind_service=+ep' + +make the proper location for the binary to go: + + mkdir -p ~/.local/bin + +move the built binary there: + + mv namestr ~/.local/bin/ + +create a file in the following path + + touch /home//.local/bin/namestrt + chmod +x /home//.local/bin/namestrt + +put the details of your desired setup with the parameters you use to launch namestr: + + #!/usr/bin/bash + + /home//.local/bin/namestr -vc mleku.online npub1mlekuhhxqq6p8w9x5fs469cjk3fu9zw7uptujr55zmpuhhj48u3qnwx3q5 a.nos.lol bevo.nostr1.com bitcoiner.social nos.lol nostr.wine relay.nostr.band Bevo.nostr1.com ae.purplerelay.com nostr.plebchain.org christpill.nostr1.com relay.nostr.me relay.devstr.org relay.primal.net + +The `-vc` enables logging, which prints the URL requests that came in. it only sends a proper answer to the NIP-05 request path, all others return the text "gfy". (hah, if you want to change it, just edit the file `cmd/root.go` and look for "gfy" and change it) + +after that is the domain name. this is intended for a domain name that is your nostr display name, mleku.online in my case. + +after that, you put the npub. this is automatically decoded to hex for the json response. + +after that, zero or more of just the domain names of the relays that you usually use to post with. the `wss://` prefix is not needed. + + chmod +x /home//.local/bin/namestrt + +edit the service definition to suit the username you set up on your vps. + +mine was 'me' and it appears twice in the service file, one after User and the other in the ExecStart. + +edit these to fit the username you created on the VPS. + +Then, copy the service using sudo to the correct location: + + sudo cp namestr.service /etc/systemd/system/ + +and then start 'er up: + + sudo systemctl enable --now namestr + +enjoy your shiny new domain NIP-05 nostr/domain name. diff --git a/go.mod b/go.mod index 7593754..b5e90d0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/mleku/namestr go 1.20 require ( - github.com/davecgh/go-spew v1.1.1 github.com/gin-gonic/autotls v0.0.5 github.com/gookit/color v1.5.4 github.com/mleku/appdata v1.0.0 diff --git a/go.sum b/go.sum index 2f581ef..05a37dd 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,5 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/blake256 v1.1.0 h1:4AuEhGPT/3TTKFhTfBpZ8hgZE7wJpawcYaEawwsbtqM= github.com/dchest/blake256 v1.1.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY= github.com/gin-gonic/autotls v0.0.5 h1:SXQWwWGDJHujDlthIij1+jxn3m5IPV8I9Za9bcPzMdo= diff --git a/namestr.service b/namestr.service new file mode 100644 index 0000000..d5e6b11 --- /dev/null +++ b/namestr.service @@ -0,0 +1,10 @@ +[Unit] +Description=namestr + +[Service] +Type=simple +User=me +ExecStart=/home/me/.local/bin/namestrt + +[Install] +WantedBy=multi-user.target \ No newline at end of file