Commit Graph

689 Commits

Author SHA1 Message Date
Brian Cunnie
4f81fccb7f Get rid of WaitGroups
I wasn't using them the way they're supposed to be used. I was using
them because they were "cool" and I wanted to force-fit them.
Specifically, I never called `WaitGroup.Done()`. Instead of using
WaitGroups to keep from exiting, I now dive into a readFrom(), which
never returns.
2023-09-25 10:53:46 -07:00
Brian Cunnie
5e81d41637 Test when it can't bind to INADDR_ANY 2023-09-25 10:52:47 -07:00
Brian Cunnie
81b142925f Clarify UDP binding code
In preparation for TCP binding, I re-worked the UDP binding process so
that it could be more understandable and more easily replicated.

I don't know that it's more understandable. I may have failed.
2023-09-24 10:07:12 +02:00
Brian Cunnie
4a095ca2b6 Test when it's unable to bind to _any_ port
Spoiler alert: it prints an error message and then exits non-zero.
2023-09-19 16:41:04 +02:00
Brian Cunnie
78e9ddf229 New test includes speed benchmarks: queries/second
I was worried that the DNS server had no headroom left on the DNS server
after one incident where the CI was red and the responses were "choppy".
Rebooting (restarting?) fixed the problem.

- ~19k Apple M2
- ~8k vSphere Xeon D-1736 2.7GHz
- ~6k AWS Graviton T2
- ~5k Azure Xeon E5-2673 v4 @ 2.30GHz

The busiest server, ns-aws.nono.io, handles ~132 queries/second.

It seems there's enough headroom for 37x (5000/132) the current traffic
on the slowest server.
2023-09-18 09:55:53 +02:00
Brian Cunnie
49ea1d36a8 Lay groundwork for allowing TCP Connections
- enhance logging messages to call out UDP as appropriate
- make the variable name UDP-specific
2023-09-13 15:11:52 +02:00
Brian Cunnie
d7526c6ca2 tools.go: go generate installs ginkgo
Works in conjunction with `go mod tidy`.

I probably did this wrong, but I don't care:

<https://www.jvt.me/posts/2022/06/15/go-tools-dependency-management/>
2023-09-13 14:58:32 +02:00
Brian Cunnie
e24797ff79 Bump dependencies go get -u -t; go mod tidy 2023-09-07 17:54:12 -07:00
Brian Cunnie
97b2a2936f Bump dependencies 2023-08-12 13:49:36 -07:00
Brian Cunnie
b9130c130a Leave a TODO breadcrumb for IDNA2008
If I ever want to make sure the results are IDNA2008-compliant, I'll
know which test to start with.

One of the things that held me back was that I couldn't find a spec for
what constitutes IDNA2008 compliance.

[#30]
2023-08-12 13:44:30 -07:00
Brian Cunnie
fd1665120e Update GKE node public IP addrs (etcd.pem) 2023-08-12 12:33:00 -07:00
Brian Cunnie
431cac2692 Fuzz-test the IPv6 PTR integration tests
This commit introduces fuzz-testing for the PTR lookups' integration
test.

This commit does NOT successfully surface the following error condition.
In that sense, this commit is a failure:
```
/usr/bin/dig @ns.sslip.io -x ::11b7:bf0a:0:0:d410 +short
  /usr/bin/dig: '--11b7-bf0a-0-0-d410.sslip.io.' is not a legal IDNA2008 name (string start/ends with forbidden hyphen), use +noidnout
```

- moves helper functions for test into a separate package,
  `xip/testhelper`.
- uses `dig`'s `-x` flag to make PTR lookup tests more readable, e.g.
  `dig -x ::1`

This IDN complaint has at least one related commit
([06f1556](06f1556699)).

[#30]
2023-07-12 11:45:57 -04:00
Brian Cunnie
2f9c75891d Bump dependencies go get -u -t; go mod tidy 2023-07-12 07:06:21 -04:00
Brian Cunnie
549d6713b8 Update GKE node public IP addrs (etcd.pem) 2023-07-10 06:21:38 -04:00
Brian Cunnie
92531f9460 Update GKE node public IP addrs (etcd.pem) 2023-06-02 08:14:30 -07:00
Brian Cunnie
55fc17559f Concourse: docker-image → registry-image
This allows our Concourse CI to pull the new multi-platform OCI Docker
images instead of pulling very stale, old Docker images.

Fixes, from <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/unit/builds/97>:
```
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.5.0
  Mismatched package versions found:
    2.8.4 used by sslip.io-dns-server, xip
```
2023-04-18 08:56:31 -07:00
Brian Cunnie
2356dbb451 Remove key-value from sslip.io home page
We've removed the key-value feature, so there's no need to describe them
on the home page. I also updated the examples.
2023-03-15 13:58:35 -07:00
Brian Cunnie
fb755b89a1 Update SOA to the Ides of March (3/15)
"Beware the ides of March."

William Shakespeare, _Julius Caesar_, Act 1, Scene 2

I should have bumped the SOA _before_ I cut release 2.7.0.
2023-03-15 13:53:50 -07:00
Brian Cunnie
463071ff90 Pipeline: DNS servers are tested against HEAD
...instead of latest release. This happens, for example, if I didn't fix
the specs before rolling out a new release. I may change this back in
the future.
2023-03-14 10:56:53 -04:00
Brian Cunnie
3e688e61de dns-servers test: remove key-value tests
We are no longer doing key-value-over-DNS.

Fixes <https://ci.nono.io/teams/main/pipelines/sslip.io/jobs/dns-servers/builds/1097>
```
rspec './spec/check-dns_spec.rb[1:17:1]' # sslip.io k-v.io tested on the ns-aws.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:17:2]' # sslip.io k-v.io tested on the ns-aws.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:33:1]' # sslip.io k-v.io tested on the ns-azure.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:33:2]' # sslip.io k-v.io tested on the ns-azure.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:49:1]' # sslip.io k-v.io tested on the ns-gce.sslip.io. nameserver sets a value, 1678804743, on the key sslipio-spec.k-v.io
rspec './spec/check-dns_spec.rb[1:49:2]' # sslip.io k-v.io tested on the ns-gce.sslip.io. nameserver gets the newly-set value, 1678804743, from the key, sslipio-spec.k-v.io
```
2023-03-14 10:40:04 -04:00
Brian Cunnie
1cf277c706 🐞 Tweak
Fixes, `fly trigger-job ...`:
```
error: resource not found
```
Fixes, `kubectl logs ...`:
```
flag provided but not defined: -etcdHost
Usage of /usr/sbin/sslip.io-dns-server:
```
2023-03-13 19:56:56 -04:00
Brian Cunnie
451ad0ef5f 2.7.0: remove key-value store 2.7.0 2023-03-13 16:46:20 -04:00
Brian Cunnie
a62a797fe5 Disable DNS-backed key-value store
I'm disabling the key-value store because no one was using it.

There are other reasons, too:

- The removal of the `etcd` library dropped the executable size by over
  half from 17MB to 7MB
- I didn't want users who've deployed it internally to be "surprised" by
  unexpected key-value features
- Key-value-over-DNS has a seamy side to it: "data exfiltration". I know
  there are legitimate uses for it, but I've come to believe that a
  Key-value-over-HTTP solution is preferable because it's not only more
  legitimate but also because it eliminates the DNS caching problem.
2023-03-13 16:44:30 -04:00
Brian Cunnie
326b717eb7 Bump dependencies go get -u -t 2023-02-28 17:41:38 -08:00
Brian Cunnie
e858c69248 Google Analytics: switch from UA to GA4
From
<https://support.google.com/analytics/answer/10759417>:

> Google Analytics 4 is replacing Universal Analytics. On July 1, 2023
all standard Universal Analytics properties will stop processing new
hits.

I wonder if Google Analytics is worth the trouble.
2023-02-05 17:52:56 -08:00
Brian Cunnie
7fa7a51453 Better etcd instructions when GKE re-IPs 2023-01-27 06:47:38 -08:00
Brian Cunnie
1ac38b2544 etcd.pem has updated GKE node public IP addrs
Fixes:
```
Jan 26 21:17:42 ns-aws etcd[508]: rejected connection from "34.121.219.144:39244" (error "tls: \"34.121.219.144\" does not match any of DNSNames [\"ns-aws.sslip.io\" \"ns-azure.sslip.io\" \"ns-gce.sslip.io\" \"ns-aws\" \"ns-azure\" \"ns-gce\"] (lookup ns-gce: Temporary failure in name resolution)", ServerName "ns-aws.sslip.io", IPAddresses ["127.0.0.1" "52.0.56.137" "52.187.42.158" "104.155.144.4" "34.71.136.235" "104.198.25.221" "35.223.15.132" "::1" "2600:1f18:aaf:6900::a"], DNSNames ["ns-aws.sslip.io" "ns-azure.sslip.io" "ns-gce.sslip.io" "ns-aws" "ns-azure" "ns-gce"])
```
2023-01-27 05:58:16 -08:00
Brian Cunnie
81dde02fdc Bump dependencies go get -u -t
Fixes:
```
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
```
2023-01-11 14:12:19 -08:00
Brian Cunnie
a6defe5d33 Log executable path, version when starting 2023-01-11 14:04:21 -08:00
Brian Cunnie
94e0bb7abd 🐞 k8s deployment: flag is -quiet not quiet
This one cost me, in Google Cloud, $21.63. Sigh.
2023-01-02 13:58:08 -08:00
Brian Cunnie
0623523a6d Wildcard certs: show people an easier way 2022-12-11 18:21:17 -08:00
Brian Cunnie
0fdb9f27bc Dockerfile: deprecate custom registry-image
Now that we're on Concourse 7.9, we no longer need the custom Concourse
registry-image resource, so we use the stock resource instead.
2022-12-11 18:00:16 -08:00
Stefan Sundin
c2f4b9c80c Update module path. 2022-12-07 06:34:46 -08:00
Stefan Sundin
29a8ba0777 Fix broken links. 2022-12-07 06:34:46 -08:00
Brian Cunnie
2422c73a1b 🐞 k8s: DNS server args are args, not command
Fixes, when `kubectl describe pod sslip.io-xxx-yy`:

> Warning  Failed     72s (x4 over 113s)  kubelet            Error:
failed to create containerd task: failed to create shim task: OCI
runtime create failed: runc create failed: unable to start container
process: exec: "-etcdHost": executable file not found in $PATH: unknown
2022-11-27 06:53:39 -08:00
Brian Cunnie
37e4ab7537 🐞 GKE deployment saves $$ by not logging so much
Also, it uses the new ENTRYPOINT instead of the old CMD.
2022-11-26 18:42:16 -08:00
Brian Cunnie
8052a84428 🐞 Docker build fails when curl fails
Our CI sometimes builds "broken" docker images because it fails
downloading the proper executable (because I haven't populated the
GitHub release yet).

I'd like it to fail rather than publish broken images.

Fixes, during `docker run -it --rm cunnie/sslip.io-dns-server`:
```
exec /usr/sbin/sslip.io-dns-server: exec format error
```
2022-11-26 18:39:30 -08:00
Brian Cunnie
036b7a0c3a Instructions for fixing GKE's etcd's certs
...because they're so volatile. It's super annoying.
2022-11-26 17:18:23 -08:00
Brian Cunnie
513ef81acb etcd.pem has updated GKE node public IP addrs
Fixes:
```
Nov 26 16:50:36 ns-aws etcd[508]: rejected connection from "35.223.15.132:56234" (error "tls: \"35.223.15.132\" does not match any of DNSNames [\"ns-aws.sslip.io\" \"ns-azure.sslip.io\" \"ns-gce.sslip.io\" \"ns-aws\" \"ns-azure\" \"ns-gce\"] (lookup ns-gce: Temporary failure in name resolution)", ServerName "ns-aws.sslip.io", IPAddresses ["127.0.0.1" "52.0.56.137" "52.187.42.158" "104.155.144.4" "34.123.7.26" "34.121.225.254" "34.70.136.153" "::1" "2600:1f18:aaf:6900::a"], DNSNames ["ns-aws.sslip.io" "ns-azure.sslip.io" "ns-gce.sslip.io" "ns-aws" "ns-azure" "ns-gce"])
```
2022-11-26 16:50:15 -08:00
Brian Cunnie
776fe532ce 2.6.2: -quiet suppresses logs for each query 2.6.2 2022-11-26 13:55:38 -08:00
Brian Cunnie
e997cd9ec9 Remove testing tool "counterfeiter"
In spite of good intentions, I never used Max Brunsfeld's Counterfeiter;
Counterfeiter is good for unit tests, but I've pivoted to using mostly
integration tests.

I took the opportunity to update `go.mod`:

```bash
rm go.mod go.sum
go mod init xip
go mod tidy
```
2022-11-26 13:29:38 -08:00
Brian Cunnie
faefad2413 Bump serial 2022110900 → 2022112600
...as a prelude to cutting a new release.
2022-11-26 13:19:49 -08:00
Brian Cunnie
c3335aae28 DNS server Dockerfile: CMD → ENTRYPOINT
`ENTRYPOINT` [is more appropriate](https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/):

> ENTRYPOINT configures a container that will run as an executable

Which is exactly how I think the container should work for new people.
Yes, I'm screwing over the existing users. Sorry.
2022-11-26 11:38:56 -08:00
Brian Cunnie
0a95fe872f -quiet suppreses logging
Google Cloud Plaatform (GCP) charged me $17.69 last month for "Cloud
Logging" which consumed 84.74 GiB.

At an average of 51.2 queries/second, and each log line
averaging 192 bytes, and 60*60*24*30 seconds/month, this works out to
25,480,396,800 bytes (23.73 GiB), which works out to a monthly savings of
$4.95 if I use the `-quiet` flag.

However, it seems that my saving would be even more because when I
visually browse the logs, at least ⅔ are from sslip.io logging.

I have *no* idea where all the other logs are coming from.
2022-11-25 18:58:06 -08:00
Brian Cunnie
9681b6a4f0 README's IPv6 address has :0100: instead of 💯
...because it's super-annoying to have an IPv6 address with a "💯" in
the middle of it.

Also did some minor tweaks to the README.
2022-11-13 17:44:05 -08:00
Brian Cunnie
cfb83cb301 README tweaks
- Move "Directory Structure" lower down--it's not terribly useful,
  certainly less useful than the "DNS Server" section.
- Remove the "tidy" turd at the bottom of the page. It adds no value,
  and I'm not sure how it got there in the first place.
- A specific sections for flags such as `-nameservers`
- Add a section about running official Docker containers.
- get rid of the old, deprecated "faq" and "about" pages

[#21]
2022-11-12 17:51:19 -08:00
Brian Cunnie
cf650f3824 Dockerfile pipeline: build using HEAD, not tag
This change allows me to build new versions of the Docker images without
forcing me to create a gratuitous release merely for that purpose.

In this specific case, I had neglected to have `curl` follow redirects
(`-L`), thus the Docker images created were missing the sslip.io DNS
server.

On the downside, it's possible that the *nginx* Docker containers are
built with content/features that haven't been released yet, but I'm
willing to run that risk.
2022-11-11 14:35:50 -08:00
Brian Cunnie
c14d08c2fd 🐞 Dockerfile: download DNS server properly
I had neglected to account for the 302 redirect.

Fixes, during `docker run -it --rm cunnie/sslip.io-dns-server`:
```
exec /usr/sbin/sslip.io-dns-server: exec format error
```

Drive-by: removed a Dockerfile left over from testing the creation of
multi-platform (x86_64, ARM64) Docker images.
2022-11-11 14:27:53 -08:00
Brian Cunnie
262a1e0ea1 2.6.1: -addresses flag enables custom addresses 2.6.1 2022-11-11 10:48:37 -08:00
Brian Cunnie
2ad8ef059a 🐞 Eliminate flaky test failures
Integration tests would fail approximately 11% of the time (4/35) when
run in parallel (on my 8-core MacBook Air). The fix was to lengthen the
amount of time (1ms → 2ms) a port was held to make sure it was really,
truly free. After change, the tests ran 32 times without a failure.

Fixes, during `ginkgo -r -p --until-it-fails .`
```
I couldn't bind to any IPs on port 1974, so I'm exiting
...
  Waiting for:
      Ready to answer queries
  In [JustBeforeEach] at: /Volumes/workspace/sslip.io/src/sslip.io-dns-server/integration_flags_test.go:28 @ 11/11/22 10:38:02.045
```
2022-11-11 10:48:37 -08:00