service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("query target not found")

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option defines a single option function.

func Config

func Config(val *config.Config) Option

Config provides a function to set the config option.

func Logger

func Logger(val log.Logger) Option

Logger provides a function to set the logger option.

func WithRelationProviders

func WithRelationProviders(val map[string]RelationProvider) Option

type Options

type Options struct {
	Logger            log.Logger
	Config            *config.Config
	RelationProviders map[string]RelationProvider
}

Options defines the available options for this package.

type RelationProvider

type RelationProvider interface {
	Add(ctx context.Context, jrd *webfinger.JSONResourceDescriptor)
}

type Service

type Service interface {
	// Webfinger is the endpoint for retrieving various href relations.
	//
	//	GET /.well-known/webfinger?
	//	     resource=acct%3Acarol%40example.com&
	//	     rel=http%3A%2F%2Fwebfinger.opencloud%rel%2Fserver-instance
	//	     HTTP/1.1
	//	Host: example.com
	//
	// The server might respond like this:
	//
	//	HTTP/1.1 200 OK
	//	Access-Control-Allow-Origin: *
	//	Content-Type: application/jrd+json
	//
	//	{
	//	  "subject" : "acct:carol@example.com",
	//	  "links" :
	//	  [
	//	    {
	//	      "rel" : "http://webfinger.opencloud/rel/server-instance",
	//	      "href" : "https://instance.example.com",
	//	      "titles": {
	//	        "en": "Readable Instance Name"
	//	      }
	//	    },
	//	    {
	//	      "rel" : "http://webfinger.opencloud/rel/server-instance",
	//	      "href" : "https://otherinstance.example.com",
	//	      "titles": {
	//	        "en": "Other Readable Instance Name"
	//	      }
	//	    }
	//	  ]
	//	}
	Webfinger(ctx context.Context, queryTarget *url.URL, rels []string) (webfinger.JSONResourceDescriptor, error)
}

Service defines the extension handlers.

func New

func New(opts ...Option) (Service, error)

New returns a new instance of Service

func NewInstrument

func NewInstrument(next Service, metrics *metrics.Metrics) Service

NewInstrument returns a service that instruments metrics.

func NewLogging

func NewLogging(next Service, logger log.Logger) Service

NewLogging returns a service that logs messages.

func NewTracing

func NewTracing(next Service, tp trace.TracerProvider) Service

NewTracing returns a service that instruments traces.

Jump to

Keyboard shortcuts

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