Documentation
¶
Index ¶
- Variables
- func DetectBadHost(netAddress string, log *zap.Logger) bool
- func RPCSettings(ctx context.Context, t *rhpv2.Transport) (settings rhpv2.HostSettings, err error)
- func ScanPriceTable(v3Session *Session) (rhpv3.HostPriceTable, error)
- type ChainManager
- type Check
- type Checker
- func (nc *Checker) CheckDNSRecords(hostname string) (bool, bool, []net.IP, []net.IP)
- func (nc *Checker) CheckPortOpen(address, port string) (bool, float64)
- func (nc *Checker) CheckVersion(publicKey string) (string, error)
- func (nc *Checker) ClassifyNetAddress(address string) string
- func (nc *Checker) PortScan(scanned HostScan)
- func (nc *Checker) ScanV1Host(host UnscannedHost) (HostScan, error)
- func (nc *Checker) ScanV2Host(host UnscannedHost) (HostScan, error)
- func (nc *Checker) SplitAddressPort(address string) (string, string, error)
- type HostScan
- type NetworkChecker
- type PaymentMethod
- type Scan
- type Session
- type TaskCheckDoc
- type UnscannedHost
- type Wallet
Constants ¶
This section is empty.
Variables ¶
View Source
var HostPortMap = make(map[string]map[string]bool)
Functions ¶
func RPCSettings ¶
func ScanPriceTable ¶
func ScanPriceTable(v3Session *Session) (rhpv3.HostPriceTable, error)
Types ¶
type ChainManager ¶
A ChainManager is used to get the current consensus state
type Check ¶
type Check struct {
CreatedAt time.Time
PublicKey string `json:"publicKey"`
V4Addr string `json:"v4Addr"`
V6Addr string `json:"v6Addr"`
Rhp2Port string `json:"rhp2Port"`
Rhp2V4Delay float64 `json:"rhp2V4Delay"`
Rhp2V6Delay float64 `json:"rhp2V6Delay"`
Rhp2V4 bool `json:"rhp2V4"`
Rhp2V6 bool `json:"rhp2V6"`
Rhp3Port string `json:"rhp3Port"`
Rhp3V4 bool `json:"rhp3V4"`
Rhp3V6 bool `json:"rhp3V6"`
Rhp3V4Delay float64 `json:"rhp3V4Delay"`
Rhp3V6Delay float64 `json:"rhp3V6Delay"`
Rhp4Port string `json:"rhp4Port"`
Rhp4V4 bool `json:"rhp4V4"`
Rhp4V6 bool `json:"rhp4V6"`
Rhp4V4Delay float64 `json:"rhp4V4Delay"`
Rhp4V6Delay float64 `json:"rhp4V6Delay"`
}
A Check is a port scan of a host
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func (*Checker) CheckDNSRecords ¶
func (*Checker) CheckPortOpen ¶
func (*Checker) ClassifyNetAddress ¶
func (*Checker) ScanV1Host ¶
func (nc *Checker) ScanV1Host(host UnscannedHost) (HostScan, error)
func (*Checker) ScanV2Host ¶
func (nc *Checker) ScanV2Host(host UnscannedHost) (HostScan, error)
type HostScan ¶
type HostScan struct {
// Location geoip.Location `json:"location"`
PublicKey string `json:"publicKey"`
V2 bool `json:"v2"`
V2NetAddresses []chain.NetAddress `json:"v2NetAddresses,omitempty"`
NetAddress string `json:"netAddress"`
Success bool `json:"success"`
Timestamp time.Time `json:"timestamp"`
NextScan time.Time `json:"nextScan"`
AcceptingContracts bool `json:"acceptingContracts"`
Error string `json:"error"`
OnlineSince time.Time `json:"onlineSince"`
OfflineSince time.Time `json:"offlineSince"`
TotalStorage uint64 `json:"totalStorage"`
RemainingStorage uint64 `json:"remainingStorage"`
Settings rhpv2.HostSettings `json:"settings"`
PriceTable rhpv3.HostPriceTable `json:"priceTable"`
RHPV4Settings rhpv4.HostSettings `json:"rhpV4Settings"`
}
HostScan represents the results of a host scan.
type NetworkChecker ¶
type NetworkChecker interface {
CheckPortOpen(address string, port string) (bool, time.Duration)
CheckDNSRecords(hostname string) (hasA, hasAAAA bool, v4, v6 []net.IP)
ClassifyNetAddress(address string) string
SplitAddressPort(address string) (host, port string, err error)
PortScan(hostId string, scanned Scan)
ScanV1Host(host UnscannedHost) (HostScan, error)
ScanV2Host(host UnscannedHost) (HostScan, error)
}
type PaymentMethod ¶
type PaymentMethod interface {
}
A PaymentMethod facilitates payments to the host using either a contract or an ephemeral account
type Scan ¶
type Scan struct {
Settings rhpv2.HostSettings
PriceTable rhpv3.HostPriceTable
}
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
A Session is an RHP3 session with the host
type UnscannedHost ¶
type UnscannedHost struct {
PublicKey types.PublicKey `json:"publicKey"`
V2 bool `json:"v2"`
NetAddress string `json:"netAddress"`
V2NetAddresses []chain.NetAddress `json:"v2NetAddresses,omitempty"`
FailedInteractionsStreak uint64 `json:"failedInteractionsStreak"`
}
UnscannedHost represents the metadata needed to scan a host.
func (UnscannedHost) IsV2 ¶
func (h UnscannedHost) IsV2() bool
IsV2 returns whether a host supports V2 or not.
func (UnscannedHost) V2SiamuxAddr ¶
func (h UnscannedHost) V2SiamuxAddr() (string, bool)
V2SiamuxAddr returns the `Address` of the first TCP siamux `NetAddress` it finds in the host's list of net addresses. The protocol for this address is // ProtocolTCPSiaMux.
type Wallet ¶
type Wallet interface {
Address() types.Address
FundTransaction(txn *types.Transaction, amount types.Currency) ([]types.Hash256, func(), error)
SignTransaction(cs consensus.State, txn *types.Transaction, toSign []types.Hash256, cf types.CoveredFields) error
}
A Wallet funds and signs transactions
Click to show internal directories.
Click to hide internal directories.