proposal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPolicy

type AccessPolicy struct {
	ID     string `json:"id"`
	Source string `json:"source"`
}

type Contact

type Contact struct {
	Type       string            `json:"type"`
	Definition ContactDefinition `json:"definition"`
}

type ContactDefinition

type ContactDefinition struct {
	BrokerAddresses []string `json:"broker_addresses"`
}

type Location

type Location struct {
	Continent string `json:"continent"`
	Country   string `json:"country"`
	Region    string `json:"region"`
	City      string `json:"city"`
	Asn       int    `json:"asn"`
	Isp       string `json:"isp"`
	IpType    string `json:"ip_type"`
}

type Proposal

type Proposal struct {
	Format         string         `json:"format"`
	Compatibility  int            `json:"compatibility"`
	ProviderID     string         `json:"provider_id"`
	ServiceType    string         `json:"service_type"`
	Location       Location       `json:"location"`
	Contacts       []Contact      `json:"contacts"`
	Quality        *Quality       `json:"quality"`
	AccessPolicies []AccessPolicy `json:"access_policies,omitempty"`
}

func (Proposal) ServiceKey

func (p Proposal) ServiceKey() string

type Provider

type Provider struct {
	ID       string
	Location Location
	Quality  *Quality
	Services []Service
}

type Quality

type Quality struct {
	Quality        float64 `json:"quality"`
	Latency        float64 `json:"latency"`
	Bandwidth      float64 `json:"bandwidth"`
	Uptime         float64 `json:"uptime"`
	RestrictedNode bool    `json:"restrictedNode"`
}

type Repository

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

func NewProposalRepository

func NewProposalRepository(proposalLifetime time.Duration) *Repository

func (*Repository) CountProposals

func (r *Repository) CountProposals() int

func (*Repository) CountProviders

func (r *Repository) CountProviders() int

func (*Repository) Countries added in v0.3.0

func (r *Repository) Countries() []string

func (*Repository) Exists

func (r *Repository) Exists(key string) bool

func (*Repository) Get

func (r *Repository) Get(key string) *Proposal

func (*Repository) Match added in v0.4.0

func (r *Repository) Match(filter *Proposal, max int) []*Proposal

func (*Repository) Proposals

func (r *Repository) Proposals() []*Proposal

func (*Repository) Providers

func (r *Repository) Providers() []*Provider

func (*Repository) Remove

func (r *Repository) Remove(key string)

func (*Repository) RemoveExpired

func (r *Repository) RemoveExpired() int

func (*Repository) Renew added in v0.3.0

func (r *Repository) Renew(id string)

func (*Repository) RenewOrStore added in v0.3.0

func (r *Repository) RenewOrStore(p *Proposal)

func (*Repository) Store

func (r *Repository) Store(p *Proposal)

func (*Repository) UpdateQuality added in v0.3.0

func (r *Repository) UpdateQuality(qualityData map[string]*Quality)

type Service

type Service struct {
	ServiceType    string
	Compatibility  int
	Contacts       []Contact
	AccessPolicies []AccessPolicy
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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