go: github.com/stellar/go/clients/stellartoml Index | Examples | Files

package stellartoml

import "github.com/stellar/go/clients/stellartoml"

Index

Examples

Package Files

client.go main.go mocks.go

Constants

const StellarTomlMaxSize = 100 * 1024

StellarTomlMaxSize is the maximum size of stellar.toml file

const WellKnownPath = "/.well-known/stellar.toml"

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

Variables

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

DefaultClient is a default client using the default parameters

type Client Uses

type Client struct {
    // HTTP is the http client used when resolving a Stellar.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 Stellar.toml file using the internet.

func (*Client) GetStellarToml Uses

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

GetStellarToml returns stellar.toml file for a given domain

ExampleGetTOML gets the stellar.toml file for coins.asia

Code:

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

func (*Client) GetStellarTomlByAddress Uses

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

GetStellarTomlByAddress returns stellar.toml file of a domain fetched from a given address

type ClientInterface Uses

type ClientInterface interface {
    GetStellarToml(domain string) (*Response, error)
    GetStellarTomlByAddress(addy string) (*Response, error)
}

type HTTP Uses

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 Uses

type MockClient struct {
    mock.Mock
}

MockClient is a mockable stellartoml client.

func (*MockClient) GetStellarToml Uses

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

GetStellarToml is a mocking a method

func (*MockClient) GetStellarTomlByAddress Uses

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

GetStellarTomlByAddress is a mocking a method

type Response Uses

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 stellar.toml file

func GetStellarToml Uses

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

GetStellarToml returns stellar.toml file for a given domain

func GetStellarTomlByAddress Uses

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

GetStellarTomlByAddress returns stellar.toml file of a domain fetched from a given address

Package stellartoml imports 7 packages (graph) and is imported by 39 packages. Updated 2019-06-20. Refresh now. Tools for package owners.