Documentation ¶
Index ¶
- Variables
- func URLMatchesHTTPSourceHost(urlHost, sourceHost string) bool
- type Entry
- type FileSource
- type HTTPSource
- type Pool
- func (pool *Pool) FetchPeerIdentity(ctx context.Context, url storj.NodeURL) (_ *identity.PeerIdentity, err error)
- func (pool *Pool) GetAddress(ctx context.Context, id storj.NodeID) (_ string, err error)
- func (pool *Pool) GetSatellites(ctx context.Context) (satellites []storj.NodeID)
- func (pool *Pool) GetSignee(ctx context.Context, id storj.NodeID) (_ signing.Signee, err error)
- func (pool *Pool) VerifySatelliteID(ctx context.Context, id storj.NodeID) (err error)
- type SatelliteURL
- type Source
- type StaticSource
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileSource is an error class for file source errors ErrFileSource = errs.Class("file source") )
var ( // ErrHTTPSource is an error class for HTTP source errors ErrHTTPSource = errs.Class("HTTP source") )
var ( // ErrSatelliteURL is an error class for satellite URL related errors ErrSatelliteURL = errs.Class("invalid satellite URL") )
var ( // ErrStaticSource is an error class for static source errors ErrStaticSource = errs.Class("static source") )
var Error = errs.Class("trust")
Error is the default error class
Functions ¶
func URLMatchesHTTPSourceHost ¶ added in v0.27.0
URLMatchesHTTPSourceHost takes the Satellite URL host and the host of the HTTPSource URL and determines if the SatelliteURL matches or is in the same domain as the HTTPSource URL.
Types ¶
type Entry ¶ added in v0.27.0
type Entry struct { // SatelliteURL is the URL of the satellite SatelliteURL SatelliteURL // Authoritative indicates whether this entry came from an authoritative // source. This impacts how URLS are aggregated. Authoritative bool `json:"authoritative"` }
Entry represents a trust entry
type FileSource ¶ added in v0.27.0
type FileSource struct {
// contains filtered or unexported fields
}
FileSource represents a trust source contained in a file on disk
func NewFileSource ¶ added in v0.27.0
func NewFileSource(path string) *FileSource
NewFileSource creates a new FileSource that loads a trust list from the given path.
func (*FileSource) FetchEntries ¶ added in v0.27.0
func (source *FileSource) FetchEntries(ctx context.Context) (_ []Entry, err error)
FetchEntries implements the Source interface and returns entries from a the file source on disk. The entries returned are authoritative.
func (*FileSource) Static ¶ added in v0.27.0
func (source *FileSource) Static() bool
Static implements the Source interface. It returns true.
func (*FileSource) String ¶ added in v0.27.0
func (source *FileSource) String() string
String implements the Source interface and returns the FileSource URL
type HTTPSource ¶ added in v0.27.0
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource represents a trust source at a http:// or https:// URL
func NewHTTPSource ¶ added in v0.27.0
func NewHTTPSource(httpURL string) (*HTTPSource, error)
NewHTTPSource constructs a new HTTPSource from a URL. The URL must be an http:// or https:// URL. The fragment cannot be set.
func (*HTTPSource) FetchEntries ¶ added in v0.27.0
func (source *HTTPSource) FetchEntries(ctx context.Context) (_ []Entry, err error)
FetchEntries implements the Source interface and returns entries parsed from the list retrieved over HTTP(S). The entries returned are only authoritative if the entry URL has a host that matches or is a subdomain of the source URL.
func (*HTTPSource) Static ¶ added in v0.27.0
func (source *HTTPSource) Static() bool
Static implements the Source interface. It returns false for this source.
func (*HTTPSource) String ¶ added in v0.27.0
func (source *HTTPSource) String() string
String implements the Source interface and returns the URL
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool implements different peer verifications.
architecture: Service
func (*Pool) FetchPeerIdentity ¶ added in v0.15.3
func (pool *Pool) FetchPeerIdentity(ctx context.Context, url storj.NodeURL) (_ *identity.PeerIdentity, err error)
FetchPeerIdentity dials the url and fetches the identity.
func (*Pool) GetAddress ¶ added in v0.15.0
GetAddress returns the address of a satellite in the trusted list
func (*Pool) GetSatellites ¶ added in v0.14.0
GetSatellites returns a slice containing all trusted satellites
type SatelliteURL ¶ added in v0.27.0
type SatelliteURL struct { ID storj.NodeID `json:"id"` Host string `json:"host"` Port int `json:"port"` }
SatelliteURL represents a Satellite URL
func LoadSatelliteURLList ¶ added in v0.27.0
func LoadSatelliteURLList(ctx context.Context, path string) (_ []SatelliteURL, err error)
LoadSatelliteURLList loads a list of Satellite URLs from a path on disk
func ParseSatelliteURL ¶ added in v0.27.0
func ParseSatelliteURL(s string) (SatelliteURL, error)
ParseSatelliteURL parses a Satellite URL. For the purposes of the trust list, the Satellite URL MUST contain both an ID and port designation.
func ParseSatelliteURLList ¶ added in v0.27.0
ParseSatelliteURLList parses a newline separated list of Satellite URLs. Empty lines or lines starting with '#' (comments) are ignored.
func (*SatelliteURL) Address ¶ added in v0.27.0
func (u *SatelliteURL) Address() string
Address returns the address (i.e. host:port) of the Satellite
func (*SatelliteURL) NodeURL ¶ added in v0.27.0
func (u *SatelliteURL) NodeURL() storj.NodeURL
NodeURL returns a full Node URL to the Satellite
func (*SatelliteURL) String ¶ added in v0.27.0
func (u *SatelliteURL) String() string
String returns a string representation of the Satellite URL
type Source ¶ added in v0.27.0
type Source interface { // String is the string representation of the source. It is used as a key // into the cache. String() string // Static returns true if the source is static. Static sources are not cached. Static() bool // FetchEntries returns the list of trust entries from the source. FetchEntries(context.Context) ([]Entry, error) }
Source is a trust source for trusted Satellites
type StaticSource ¶ added in v0.27.0
type StaticSource struct {
// contains filtered or unexported fields
}
StaticSource is a trust source that returns an explicitly trusted URL
func NewStaticSource ¶ added in v0.27.0
func NewStaticSource(satelliteURL string) (*StaticSource, error)
NewStaticSource takes an explicitly trusted URL and returns a new StaticSource.
func (*StaticSource) FetchEntries ¶ added in v0.27.0
func (source *StaticSource) FetchEntries(ctx context.Context) ([]Entry, error)
FetchEntries returns a trust entry for the explicitly trusted Satellite URL. The entry is authoritative.
func (*StaticSource) Static ¶ added in v0.27.0
func (source *StaticSource) Static() bool
Static implements the Source interface. It returns true.
func (*StaticSource) String ¶ added in v0.27.0
func (source *StaticSource) String() string
String implements the Source interface and returns the static trusted URL