fonerotoml

package
v0.0.0-...-ebafc48 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const FoneroTomlMaxSize = 5 * 1024

FoneroTomlMaxSize is the maximum size of fonero.toml file

View Source
const WellKnownPath = "/.well-known/fonero.toml"

WellKnownPath represents the url path at which the fonero.toml file should exist to conform to the federation protocol.

Variables

View Source
var DefaultClient = &Client{HTTP: http.DefaultClient}

DefaultClient is a default client using the default parameters

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTP is the http client used when resolving a Fonero.toml file
	HTTP HTTP

	// UseHTTP forces the client to resolve against servers using plain HTTP.
	// Useful for debugging.
	UseHTTP bool
}

Client represents a client that is capable of resolving a Fonero.toml file using the internet.

func (*Client) GetFoneroToml

func (c *Client) GetFoneroToml(domain string) (resp *Response, err error)

GetFoneroToml returns fonero.toml file for a given domain

Example

ExampleGetTOML gets the fonero.toml file for coins.asia

_, err := DefaultClient.GetFoneroToml("coins.asia")
if err != nil {
	log.Fatal(err)
}
Output:

func (*Client) GetFoneroTomlByAddress

func (c *Client) GetFoneroTomlByAddress(addy string) (*Response, error)

GetFoneroTomlByAddress returns fonero.toml file of a domain fetched from a given address

type ClientInterface

type ClientInterface interface {
	GetFoneroToml(domain string) (*Response, error)
	GetFoneroTomlByAddress(addy string) (*Response, error)
}

type HTTP

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

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

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is a mockable fonerotoml client.

func (*MockClient) GetFoneroToml

func (m *MockClient) GetFoneroToml(domain string) (*Response, error)

GetFoneroToml is a mocking a method

func (*MockClient) GetFoneroTomlByAddress

func (m *MockClient) GetFoneroTomlByAddress(address string) (*Response, error)

GetFoneroTomlByAddress is a mocking a method

type Response

type Response struct {
	AuthServer       string `toml:"AUTH_SERVER"`
	FederationServer string `toml:"FEDERATION_SERVER"`
	EncryptionKey    string `toml:"ENCRYPTION_KEY"`
	SigningKey       string `toml:"SIGNING_KEY"`
}

Response represents the results of successfully resolving a fonero.toml file

func GetFoneroToml

func GetFoneroToml(domain string) (*Response, error)

GetFoneroToml returns fonero.toml file for a given domain

func GetFoneroTomlByAddress

func GetFoneroTomlByAddress(addy string) (*Response, error)

GetFoneroTomlByAddress returns fonero.toml file of a domain fetched from a given address

Jump to

Keyboard shortcuts

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