1. 39
  1.  

  2. 9

    YAML was a contentious choice for application storage, let’s see if this (spoiler, it’s DNS) is more positively received!

    1. 5

      Neat idea, I really like the concise implementation. I still have a minor nitpick, initialize the context in attemptForward¹ with the incoming requests context so it gets canceled when the request is canceled and not only when it times out.

      ¹ How do I get permalinks in sourcehut, pressing y works in Github and GitLab and I know that sourcehut prevents Javascript as much as possible but this functionality would count as progressive enhancement for me :)

      1. 6

        Right-click the line number and copy the link, possibly by right-clicking and typing ‘L’ if you’re using firefox.

        1. 3

          Does not work for me in Firefox and man.sr.ht/git.sr.ht/ never mentions link or permalink anywhere. Anyways, this is getting off-topic.

      2. 2

        I don’t see anything wrong with this, but I find it has a pretty “high” bar of requirements. I think as of a few weeks ago I’m at a domain reseller where I could reasonably script the CUD part of CRUD via API for the first time, ever. The one before that had a horrible API (or only mail robot) and the one before that, none at all.

        1. 3

          In case you catch the urge to script anything against it, the python dns-lexicon library is extremely handy if they support your provider. I used it to add support for ACME dns-01 challenges against my DNS host, which is also too uncommon to have certbot support out of the box.

        2. 2

          Funny hack, but it is not a full shortener, if the shortening is not part of your 59 lines. It is just a lookup of a TXT record. I don’t want to be negative, but I think the far more irky write path should be part of it too

          1. 2

            Probably in theory, sure. The trouble with the writing is “how many different DNS providers are there?” and moreover there is no standard way to create a record :(

            Maybe I should change the project to be called a url-lengthener, seeing as that is the only function it handles?

            1. 3

              As a suggestion: Route53 has a Go API I assume, it at least some kind of HTTP API, and would fit the theme perfectly. ❤️

              1. 3

                Ah yes that is a good idea. Certainly food for thought!

              2. 1

                Unsurprisingly there is a standard (RFC2136 DNS UPDATE), but it suffers from a lack of an end-user-friendly authentication mechanism, with the result that basically nobody uses it, at least in any broadly-available service. But there are scenarios where it works fine.

                1. 2

                  You can use RFC2136 with bearer token authentication, especially useful for DNS ACMEv2 validation. Shouldn’t be too hard to use the same here.

                2. 1

                  Yes there are many different providers. Having at least one as an example would be fun.

              3. 1

                I am not sure about the limit, but I am assuming most hosted providers has limits on a) number of records and b) rate limit on API requests. It could work better if you are hosting your own NS.

                1. 3

                  Usual caveats if my hobby projects apply definitely:

                  scale and usefulness in the real world are an afterthought

                  1. 2

                    Route 53 has a “please tell us whyyyyyyyy” soft cap at 10,000 records, see https://aws.amazon.com/route53/pricing/

                    They limit you to 5 requests/second, and it looks like they can’t be concurrent requests, https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html#limits-api-requests-route-53