indeed

package module
v0.0.0-...-a65364c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 17 Imported by: 0

README

Introduction

Domain, feed—indeed.
You get the point; naming is hard.
This little tool lets you track domain events via RSS.
It works all right, despite its name.

Usage

To run the HTTP server with Docker:

docker run --rm --publish 8080:8080 ghcr.io/axeljohnsson/indeed:main

Next, an example of how to query a domain with curl. Include q for as many domains as you like.

curl --silent 'http://localhost:8080/feed?q=example.com' | xmllint --format -

You should see something like this:

<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Domain Events</title>
    <link>/feed?q=example.com</link>
    <description>Domain events for: example.com.</description>
    <item>
      <link>https://rdap.org/domain/EXAMPLE.COM</link>
      <description>example.com: expiration</description>
      <guid>0e7b8746deb1b3df50b53bd3fa1df6f795e130088f3dbee4fbcd559b99ea7e46</guid>
      <pubDate>13 Aug 24 04:00 UTC</pubDate>
    </item>
    <item>
      <link>https://rdap.org/domain/EXAMPLE.COM</link>
      <description>example.com: last update of RDAP database</description>
      <guid>f1194c798bf1a1a603735c0ca0b536f59835c8ded794f215410b2192fe7677c7</guid>
      <pubDate>25 Aug 23 18:30 UTC</pubDate>
    </item>
    <item>
      <link>https://rdap.org/domain/EXAMPLE.COM</link>
      <description>example.com: last changed</description>
      <guid>264aaecf302ed10f175731ded269a76e2ac202212ac70cf6e73977e6ba033f5b</guid>
      <pubDate>14 Aug 23 07:01 UTC</pubDate>
    </item>
    <item>
      <link>https://rdap.org/domain/EXAMPLE.COM</link>
      <description>example.com: registration</description>
      <guid>8c0e7bcead41a573c598c2ab9ae7e95fde486b0d7307b115a1da9b6d6fbb8c4a</guid>
      <pubDate>14 Aug 95 04:00 UTC</pubDate>
    </item>
  </channel>
</rss>

Documentation

Index

Constants

View Source
const RDAPBaseURL = "https://rdap.org/"

Variables

This section is empty.

Functions

func LogHandler

func LogHandler(h http.Handler, logger *slog.Logger) http.Handler

Types

type Domain

type Domain struct {
	Name   string
	Link   string
	Events []Event
}

func ResolveDomains

func ResolveDomains(ctx context.Context, resolver Resolver, names []string) ([]Domain, error)

type Event

type Event struct {
	Action string
	Actor  string
	Date   time.Time
}

type FeedHandler

type FeedHandler struct {
	// contains filtered or unexported fields
}

func NewFeedHandler

func NewFeedHandler(rdap *RDAPClient, whois *WHOISClient) *FeedHandler

func (*FeedHandler) ServeHTTP

func (h *FeedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RDAPClient

type RDAPClient struct {
	BaseURL string
	// contains filtered or unexported fields
}

func NewRDAPClient

func NewRDAPClient(baseURL string) *RDAPClient

func (*RDAPClient) Resolve

func (c *RDAPClient) Resolve(ctx context.Context, name string) (*Domain, error)

type RSSFeed

type RSSFeed struct {
	XMLName     xml.Name  `xml:"rss"`
	Version     string    `xml:"version,attr"`
	Title       string    `xml:"channel>title"`
	Link        string    `xml:"channel>link"`
	Description string    `xml:"channel>description"`
	Items       []RSSItem `xml:"channel>item"`
}

type RSSItem

type RSSItem struct {
	Title       string  `xml:"title,omitempty"`
	Link        string  `xml:"link,omitempty"`
	Description string  `xml:"description,omitempty"`
	Author      string  `xml:"author,omitempty"`
	GUID        string  `xml:"guid,omitempty"`
	PubDate     RSSTime `xml:"pubDate,omitempty"`
}

type RSSTime

type RSSTime struct {
	time.Time
}

func (RSSTime) MarshalXML

func (t RSSTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*RSSTime) UnmarshalXML

func (t *RSSTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, name string) (*Domain, error)
}

func MultiResolver

func MultiResolver(resolvers []Resolver) Resolver

func TryResolver

func TryResolver(resolver Resolver, err error) Resolver

type WHOISClient

type WHOISClient struct {
	// contains filtered or unexported fields
}

func NewWHOISClient

func NewWHOISClient() *WHOISClient

func (*WHOISClient) Resolve

func (c *WHOISClient) Resolve(ctx context.Context, name string) (*Domain, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL