mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-10 01:50:11 +08:00
dig txt version.sslip.io
returns version
I needed a way of determining the version that a server was running. I orginally considered a command-line argument, but then I thought, "Why not create a DNS record for it? That way I can query running servers without needing to ssh onto the machine." The TXT record consists of three distinct strings: version, compile date, and git hash. ```bash dig txt version.sslip.io +short "2.2.1" "2021/10/03-15:08:54+0100" "6a928eb" ```
This commit is contained in:
10
bin/make_all
10
bin/make_all
@@ -4,12 +4,18 @@
|
||||
#
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
cd $DIR/../src/sslip.io-dns-server
|
||||
|
||||
ldflags="-X xip/xip.VersionSemantic=2.2.0 \
|
||||
-X xip/xip.VersionDate=$(date +%Y/%m/%d-%H:%M:%S%z) \
|
||||
-X xip/xip.VersionGitHash=$(git rev-parse --short HEAD)"
|
||||
export GOOS GOARCH
|
||||
|
||||
# Bring in ARM64 for my AWS Graviton2 instance
|
||||
for GOARCH in amd64 arm64; do
|
||||
for GOOS in darwin linux freebsd; do
|
||||
go build -o $DIR/sslip.io-dns-server-$GOOS-$GOARCH main.go
|
||||
go build \
|
||||
-ldflags="$ldflags" \
|
||||
-o $DIR/sslip.io-dns-server-$GOOS-$GOARCH \
|
||||
main.go
|
||||
done
|
||||
done
|
||||
|
||||
|
@@ -109,6 +109,10 @@ var _ = Describe("sslip.io-dns-server", func() {
|
||||
"@localhost example.com srv +short",
|
||||
`\A\z`,
|
||||
`TypeSRV example.com. \? nil, SOA example.com. briancunnie.gmail.com. 2021080200 900 900 1800 300\n$`),
|
||||
Entry(`TXT for version.sslip.io is the version number of the xip software (which gets overwritten during linking)`,
|
||||
"@127.0.0.1 version.sslip.io txt +short",
|
||||
`\A"dev"\n"today"\n"xxx"\n\z`,
|
||||
`TypeTXT version.sslip.io. \? \["dev"\], \["today"\], \["xxx"\]`),
|
||||
Entry(`TXT is the querier's IPv4 address and the TLD is "ip."`,
|
||||
"@127.0.0.1 blah.blah.ip txt +short",
|
||||
`127.0.0.1`,
|
||||
|
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// DomainCustomization is a value that is returned for a specific query.
|
||||
// The map key is the the domain in question, e.g. "sslip.io." (always include trailing dot).
|
||||
// The map key is the domain in question, e.g. "sslip.io." (always include trailing dot).
|
||||
// For example, when querying for MX records for "sslip.io", return the protonmail servers,
|
||||
// but when querying for MX records for generic queries, e.g. "127.0.0.1.sslip.io", return the
|
||||
// default (which happens to be no MX records).
|
||||
@@ -51,12 +51,17 @@ var (
|
||||
{NS: nsGce},
|
||||
}
|
||||
|
||||
mbox, _ = dnsmessage.NewName("briancunnie.gmail.com.")
|
||||
mx1, _ = dnsmessage.NewName("mail.protonmail.ch.")
|
||||
mx2, _ = dnsmessage.NewName("mailsec.protonmail.ch.")
|
||||
dkim1, _ = dnsmessage.NewName("protonmail.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
dkim2, _ = dnsmessage.NewName("protonmail2.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
dkim3, _ = dnsmessage.NewName("protonmail3.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
mbox, _ = dnsmessage.NewName("briancunnie.gmail.com.")
|
||||
mx1, _ = dnsmessage.NewName("mail.protonmail.ch.")
|
||||
mx2, _ = dnsmessage.NewName("mailsec.protonmail.ch.")
|
||||
dkim1, _ = dnsmessage.NewName("protonmail.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
dkim2, _ = dnsmessage.NewName("protonmail2.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
dkim3, _ = dnsmessage.NewName("protonmail3.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.")
|
||||
|
||||
VersionSemantic = "dev"
|
||||
VersionDate = "today"
|
||||
VersionGitHash = "xxx"
|
||||
|
||||
Customizations = DomainCustomizations{
|
||||
"sslip.io.": {
|
||||
A: []dnsmessage.AResource{
|
||||
@@ -115,6 +120,13 @@ var (
|
||||
CNAME: dkim3,
|
||||
},
|
||||
},
|
||||
"version.sslip.io.": {
|
||||
TXT: []dnsmessage.TXTResource{
|
||||
{TXT: []string{VersionSemantic}}, // e.g. "2.2.1'
|
||||
{TXT: []string{VersionDate}}, // e.g. "2021/10/03-15:08:54+0100"
|
||||
{TXT: []string{VersionGitHash}}, // e.g. "9339c0d"
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
@@ -6,9 +6,12 @@ they might not make sense unless you're on my workstation.
|
||||
```zsh
|
||||
export OLD_VERSION=2.1.2
|
||||
export VERSION=2.2.0
|
||||
cd ~/go/src/github.com/cunnie/sslip.io
|
||||
cd ~/workspace/sslip.io
|
||||
git pull -r --autostash
|
||||
sed -i '' "s~/$OLD_VERSION/~/$VERSION/~g" k8s/document_root/index.html # update the download instructions on the website
|
||||
# update the version number for the TXT record for version.sslip.io
|
||||
sed -i '' "s/$OLD_VERSION/$VERSION/g" bin/make_all
|
||||
# update the download instructions on the website
|
||||
sed -i '' "s~/$OLD_VERSION/~/$VERSION/~g" k8s/document_root/index.html
|
||||
cd bosh-release/
|
||||
lpass show a # refresh LastPass token
|
||||
. ~/workspace/deployments/.envrc # set BOSH auth
|
||||
|
Reference in New Issue
Block a user