resolvers

package
v0.0.0-...-c9c6779 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDestination = errors.New("encountered prefix without a destination")

Functions

This section is empty.

Types

type InOrder

type InOrder []wdresolve.Resolver

InOrder implements wdresolve.Resolver and queries several child resolvers in order

func (InOrder) Prefixes

func (io InOrder) Prefixes() map[string]string

func (InOrder) Target

func (io InOrder) Target(uri string) string

type Prefix

type Prefix struct {
	Data map[string]string
}

Prefix implements wdresolve.Resolver on the basis of a longest prefix match

func ReadPrefixes

func ReadPrefixes(reader io.Reader) (p Prefix, err error)

ReadPrefixes reads a set of prefixes from the provided reader

The reader should return data that contains one prefix per line. Leading and trailing spaces are ignored. A destination is indicated by a line ending in ":". Blank lines and those starting with "#" are ignored. For example:

# I am ignored

https://wisski.example.com:
  http://wisski.example.com/
  https://wisski.example.com/
https://wisski.other.com:
  http://wisski.other.com/
  https://wisski.other.com/

func (Prefix) Prefixes

func (prefix Prefix) Prefixes() map[string]string

func (Prefix) Target

func (prefix Prefix) Target(uri string) (url string)

type Regexp

type Regexp struct {
	Data map[string]string
	// contains filtered or unexported fields
}

Regexp implements [wdresolver.Resolver] on the basis of a regexp mapping.

It should contain a map from regular expressions for URIs to target WissKI deployments. Keys are encoded as regular expressions, Values may contain the $n$ syntax to replace matched groups.

The behaviour when multiple keys match is non-deterministic, as any value might be used as a response.

func (*Regexp) Target

func (rr *Regexp) Target(uri string) string

Jump to

Keyboard shortcuts

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