federation

package
v0.0.0-...-55f7a6b Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FederationResponseMaxSize = 100 * 1024

FederationResponseMaxSize is the maximum size of response from a federation server

Variables

View Source
var DefaultPublicNetClient = &Client{
	HTTP:            http.DefaultClient,
	Frontier:        hc.DefaultPublicNetClient,
	DigitalBitsTOML: digitalbitstoml.DefaultClient,
}

DefaultPublicNetClient is a default federation client for pubnet

View Source
var DefaultTestNetClient = &Client{
	HTTP:            http.DefaultClient,
	Frontier:        hc.DefaultTestNetClient,
	DigitalBitsTOML: digitalbitstoml.DefaultClient,
}

DefaultTestNetClient is a default federation client for testnet

Functions

This section is empty.

Types

type Client

type Client struct {
	DigitalBitsTOML DigitalBitsTOML
	HTTP            HTTP
	Frontier        Frontier
	AllowHTTP       bool
}

Client represents a client that is capable of resolving a federation request using the internet.

func (*Client) ForwardRequest

func (c *Client) ForwardRequest(domain string, fields url.Values) (*proto.NameResponse, error)

ForwardRequest performs a federated lookup following to the digitalbits federation protocol using the "forward" type request.

func (*Client) LookupByAccountID

func (c *Client) LookupByAccountID(aid string) (*proto.IDResponse, error)

LookupByAccountID performs a federated lookup following to the digitalbits federation protocol using the "id" type request. The provided strkey-encoded account id is used to resolve what server the request should be made against.

func (*Client) LookupByAddress

func (c *Client) LookupByAddress(addy string) (*proto.NameResponse, error)

LookupByAddress performs a federated lookup following to the digitalbits federation protocol using the "name" type request. The provided address is used to resolve what server the request should be made against. NOTE: the "name" type is a legacy holdover from the legacy digitalbits network's federation protocol. It is unfortunate.

type ClientInterface

type ClientInterface interface {
	LookupByAddress(addy string) (*proto.NameResponse, error)
	LookupByAccountID(aid string) (*proto.IDResponse, error)
	ForwardRequest(domain string, fields url.Values) (*proto.NameResponse, error)
}

type DigitalBitsTOML

type DigitalBitsTOML interface {
	GetDigitalBitsToml(domain string) (*digitalbitstoml.Response, error)
}

DigitalBitsTOML represents a client that can resolve a given domain name to digitalbits.toml file. The response is used to find the federation server that a query should be made against.

type Frontier

type Frontier interface {
	HomeDomainForAccount(aid string) (string, error)
}

Frontier represents a frontier client that can be consulted for data when needed as part of the federation protocol

type HTTP

type HTTP interface {
	Get(url string) (*http.Response, error)
}

HTTP represents the http client that a federation client uses to make http requests.

Jump to

Keyboard shortcuts

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