💾 Archived View for code.pfad.fr › rvcodns captured on 2023-11-14 at 07:48:14. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

➡️ Next capture (2023-12-28)

-=-=-=-=-=-=-

rvcodns package - code.pfad.fr/rvcodns

import "code.pfad.fr/rvcodns"

package rvcodns provides a Go client for [Release Version Check over DNS (RVCoDNS)].

Release Version Check over DNS (RVCoDNS)

Example

// SPDX-FileCopyrightText: 2023 Olivier Charvin <git@olivier.pfad.fr>
// SPDX-License-Identifier: CC0-1.0

package main

import (
	"fmt"

	"code.pfad.fr/rvcodns"
)

var domain = "example.rvcodns.pfad.fr"

func main() {
	releases, err := rvcodns.LookupRelease(domain)
	if err != nil {
		panic(err) // network or parsing error (to handle)
	}
	for _, r := range releases {
		fmt.Println(r.Version) // compare with own version (to inform the user about available updates)
	}
}

Variables

var DefaultResolver = Resolver{net.DefaultResolver.LookupTXT}

DefaultResolver is the resolver used by the package-level LookupRelease function.

Functions

func DKIMQuotedPrintableEncode

func DKIMQuotedPrintableEncode(str string) string

DKIMQuotedPrintableEncode encodes a strings as a [DKIM-Quoted-Printable] string.

DKIM-Quoted-Printable

See [Value.String] for decoding.

Types

type Release

type Release struct {
	Version string // decoded version string
	AllTags []Tag  // raw tags in the order they appeared
}

Release represents a release record

func LookupRelease

func LookupRelease(domain string) ([]Release, error)

LookupRelease looks up and parses supported releases by DNS-querying _release.{domain}

LookupRelease uses context.Background internally; to specify the context, use Resolver.LookupRelease.

func Parse

func Parse(record string) (Release, error)

Parse parses a DNS records into a [Release]

type Resolver

type Resolver struct {
	LookupTXT func(ctx context.Context, name string) ([]string, error)
}

Resolver allows to specify the LookupTXT function to use (usually net.DefaultResolver.LookupTXT)

func (Resolver) LookupRelease

func (r Resolver) LookupRelease(ctx context.Context, domain string) ([]Release, error)

LookupRelease looks up and parses supported releases by querying the DNS TXT "_release.{domain}" records.

type Tag

type Tag struct {
	Key   string
	Value Value
}

Tag represents a key-value tag pair of the DNS record

type Value

type Value string

Value represents a raw DNS value. Use String() to get the decoded value.

func (Value) String

func (v Value) String() string

String parses the value as a [DKIM-Quoted-Printable] string. It removes whitespaces and decodes hex-octets "=XX".

DKIM-Quoted-Printable

See [DKIMQuotedPrintableEncode] for encoding.

Files

encoding.go

parse.go

rvcodns.go

Directories

cmd/dkim-encode-pairs

dkim-encode-pairs endodes key-value pairs for usage in [Release Version Check over DNS (RVCoDNS)].

cmd/get-releases

get-releases retrieves and prints out the currently supported releases using [Release Version Check over DNS (RVCoDNS)].

Forge

https://codeberg.org/pfad.fr/rvcodns

git clone

https://codeberg.org/pfad.fr/rvcodns.git
git@codeberg.org:pfad.fr/rvcodns.git