discovery

package
v0.0.0-...-af321b4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const HTTPPath = "/.well-known/horizon/hubs.json"

Variables

View Source
var ErrBadServer = errors.New("bad server")

Functions

This section is empty.

Types

type Client

type Client struct {
	URL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(surl string) (*Client, error)

func (*Client) Best

func (c *Client) Best(ctx context.Context, count int) ([]string, error)

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context) error

func (*Client) Return

func (c *Client) Return(cfg HubConfig)

func (*Client) Take

func (c *Client) Take(ctx context.Context) (HubConfig, bool)

type DiscoveryData

type DiscoveryData struct {
	ServerTime time.Time             `json:"server_time"`
	Hubs       []*pb.NetworkLocation `json:"hubs"`
}

type GetNetlocs

type GetNetlocs interface {
	GetAllNetworkLocations() ([]*pb.NetworkLocation, error)
}

type HubConfig

type HubConfig struct {
	Addr       string
	Name       string
	Insecure   bool
	PinnedCert *x509.Certificate
}

type HubConfigProvider

type HubConfigProvider interface {
	Take(context.Context) (HubConfig, bool)
	Return(HubConfig)
}

func HubConfigs

func HubConfigs(cfg ...HubConfig) HubConfigProvider

type HubConnectDetails

type HubConnectDetails interface {
	Address() string
	InsecureTLS() bool
	X509Cert() *x509.Certificate
}

type StaticHubConfigs

type StaticHubConfigs struct {
	// contains filtered or unexported fields
}

func (*StaticHubConfigs) Return

func (h *StaticHubConfigs) Return(cfg HubConfig)

func (*StaticHubConfigs) Take

func (h *StaticHubConfigs) Take(ctx context.Context) (HubConfig, bool)

type WellKnown

type WellKnown struct {
	L          hclog.Logger
	GetNetlocs GetNetlocs
}

func (*WellKnown) ServeHTTP

func (wk *WellKnown) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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