Documentation ¶
Index ¶
- Constants
- Variables
- type BlockContent
- type BoostDataFetcher
- type CVMStorage
- type Config
- type FileStorage
- func (fs *FileStorage) AddBlock(b *types.Block) error
- func (fs *FileStorage) Blocks() []*types.Block
- func (fs *FileStorage) Close() error
- func (fs *FileStorage) Files() []*types.FileInfo
- func (fs *FileStorage) Flush() error
- func (fs *FileStorage) GetBlockByNumber(blockNum uint64) *types.Block
- func (fs *FileStorage) GetFileByAddr(addr common.Address) *types.FileInfo
- func (fs *FileStorage) GetRootByNumber(number uint64) (root []byte)
- func (fs *FileStorage) ID() uint64
- func (fs *FileStorage) NewFileInfo(Meta *types.FileMeta) *types.FileInfo
- func (fs *FileStorage) Reset() error
- func (fs *FileStorage) Root() common.Hash
- func (fs *FileStorage) Txs() uint64
- func (fs *FileStorage) UpdateFile(x *types.FileInfo) (uint64, bool, error)
- func (fs *FileStorage) Version() string
- type Monitor
- type Peer
- type PublicTorrentAPI
- type Torrent
- func (t *Torrent) BoostOff()
- func (t *Torrent) BytesLeft() int64
- func (t *Torrent) Finished() bool
- func (t *Torrent) InfoHash() string
- func (t *Torrent) IsAvailable() bool
- func (t *Torrent) Pause()
- func (t *Torrent) Paused() bool
- func (t *Torrent) Pending() bool
- func (t *Torrent) ReloadFile(files []string, datas [][]byte, tm *TorrentManager)
- func (t *Torrent) ReloadTorrent(data []byte, tm *TorrentManager) error
- func (t *Torrent) Run(slot int)
- func (t *Torrent) Running() bool
- func (t *Torrent) Seed()
- func (t *Torrent) SeedInQueue()
- func (t *Torrent) Seeding() bool
- func (t *Torrent) WriteTorrent() error
- type TorrentFS
- func (tfs *TorrentFS) APIs() []rpc.API
- func (fs *TorrentFS) Available(infohash string, rawSize int64) (bool, error)
- func (t *TorrentFS) Config() *Config
- func (fs *TorrentFS) GetFile(infohash string, subpath string) ([]byte, error)
- func (tfs *TorrentFS) HandlePeer(peer *p2p.Peer, rw p2p.MsgReadWriter) error
- func (tfs *TorrentFS) MaxMessageSize() uint64
- func (t *TorrentFS) Monitor() *Monitor
- func (tfs *TorrentFS) Protocols() []p2p.Protocol
- func (tfs *TorrentFS) Start(server *p2p.Server) error
- func (tfs *TorrentFS) Stop() error
- func (tfs *TorrentFS) Version() uint
- type TorrentManager
- func (tm *TorrentManager) AddInfoHash(ih metainfo.Hash, BytesRequested int64) *Torrent
- func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Torrent
- func (tm *TorrentManager) Close() error
- func (tm *TorrentManager) CreateTorrent(t *torrent.Torrent, requested int64, status int, ih metainfo.Hash) *Torrent
- func (tm *TorrentManager) GetLimitation(value int64) int64
- func (tm *TorrentManager) GetTorrent(ih metainfo.Hash) *Torrent
- func (tm *TorrentManager) SearchAndDownload(hex string, request int64)
- func (tm *TorrentManager) SetTorrent(ih metainfo.Hash, torrent *Torrent)
- func (tm *TorrentManager) SetTrackers(trackers []string, disableTCP, boost bool)
- func (tm *TorrentManager) Start() error
- func (tm *TorrentManager) UpdateDynamicTrackers(trackers []string)
- func (tm *TorrentManager) UpdateInfoHash(ih metainfo.Hash, BytesRequested int64)
- func (tm *TorrentManager) UpdateTorrent(input interface{}) error
- type TorrentManagerAPI
Constants ¶
const ( ProtocolName = "nas" ProtocolVersion = 1 NumberOfMessageCodes = uint64(1048576) ProtocolVersionStr = "1.0" )
Variables ¶
var BadFiles = map[string]bool{ "3edcb8a793887d92db12d53124955681d5c20a43": true, }
var DefaultConfig = Config{ Port: 40401, DefaultTrackers: params.MainnetTrackers, BoostNodes: params.TorrentBoostNodes, SyncMode: "full", DisableUTP: true, DisableDHT: false, DisableTCP: false, MaxSeedingNum: 1024, MaxActiveNum: 1024, FullSeed: false, Boost: false, Quiet: true, UploadRate: -1, DownloadRate: -1, }
DefaultConfig contains default settings for the storage.
var (
ErrReadDataFromBoltDB = errors.New("bolt DB Read Error")
)
var GoodFiles = map[string]bool{ "6dfc52c480a779dd3e2c9dce9772a5131ee1f4d7": true, "d31d1b0f588069aa6f36de5a7025a8d73a9a49f6": true, "9dbde0099a270c23d5dec0acb0ac537b0fb35c27": true, "3df6926c165db01330574fba8c23aa7b03311356": true, "c599d0fa8d816cf83c5018232453c6ae57db4ab3": true, "ae5a301ddfe1d4be9848adf8dde9f78d7ebba919": true, "6b3fd83c1fb05ae5145673218b53a1411460f3e0": true, "3101ac2c157ace6e4be72575758f7ba62b53e219": true, "b3d2f3d4f395924ca4cf5bd1843d49de043c959c": true, "ad3d77101866c0c7520aa41a5c41eee92500f809": true, "67b315aac2fbdbaf97ac8d40df0b9c435b65c4aa": true, "1fb97d6da1761ddc051446307bd915506359a17a": true, "b08e2c6103157ab99040cdc9ddfee05e93763f6c": true, "a83dc64f96494b6b6c4f5291196d0ddd2f1a0769": true, "3f1f6c007e8da3e16f7c3378a20a746e70f1c2b0": true, "1f1706fa53ce0723ba1c577418b222acbfa5a200": true, "ec6b1f5b5073c07dd35a53a3a13220c1a21e426d": true, "aea5584d0cd3865e90c80eace3bfcb062473d966": true, "9f222b4afa685d74d82e88972922cc9108a81791": true, "3145ad19228c1cd2d051314e72f26c1ce77b7f02": true, "04615009127a4829d32d22dddb45664a2aee8067": true, }
var Str404NotFound []byte = []byte{} /* 178 elements not displayed */
Functions ¶
This section is empty.
Types ¶
type BlockContent ¶ added in v1.9.51
type BlockContent struct {
// contains filtered or unexported fields
}
func (BlockContent) CalculateHash ¶ added in v1.9.51
func (t BlockContent) CalculateHash() ([]byte, error)
type BoostDataFetcher ¶ added in v1.0.0
type BoostDataFetcher struct {
// contains filtered or unexported fields
}
func NewBoostDataFetcher ¶ added in v1.0.0
func NewBoostDataFetcher(nodes []string) *BoostDataFetcher
func (*BoostDataFetcher) GetFile ¶ added in v1.0.0
func (f *BoostDataFetcher) GetFile(ih, subpath string) ([]byte, error)
func (*BoostDataFetcher) GetTorrent ¶ added in v1.0.0
func (f *BoostDataFetcher) GetTorrent(ih string) ([]byte, error)
type CVMStorage ¶ added in v1.0.0
type CVMStorage interface { Available(infohash string, rawSize int64) (bool, error) GetFile(infohash string, path string) ([]byte, error) Stop() error }
func GetStorage ¶ added in v1.0.0
func GetStorage() CVMStorage
type Config ¶
type Config struct { // Host is the host interface on which to start the storage server. If this // field is empty, no storage will be started. Port int `toml:",omitempty"` DataDir string `toml:",omitempty"` RpcURI string `toml:",omitempty"` IpcPath string `toml:",omitempty"` DisableUTP bool `toml:",omitempty"` DisableTCP bool `toml:",omitempty"` DisableDHT bool `toml:",omitempty"` DefaultTrackers []string `toml:",omitempty"` BoostNodes []string `toml:",omitempty"` SyncMode string `toml:",omitempty"` MaxSeedingNum int `toml:",omitempty"` MaxActiveNum int `toml:",omitempty"` FullSeed bool Boost bool Quiet bool UploadRate int DownloadRate int }
Config ...
type FileStorage ¶
type FileStorage struct { CheckPoint uint64 LastListenBlockNumber uint64 // contains filtered or unexported fields }
func NewFileStorage ¶
func NewFileStorage(config *Config) (*FileStorage, error)
func (*FileStorage) AddBlock ¶
func (fs *FileStorage) AddBlock(b *types.Block) error
func (fs *FileStorage) addBlock(b *Block, record bool) error {
func (*FileStorage) Blocks ¶ added in v1.9.51
func (fs *FileStorage) Blocks() []*types.Block
func (*FileStorage) Close ¶ added in v1.0.0
func (fs *FileStorage) Close() error
func (*FileStorage) Files ¶ added in v1.9.51
func (fs *FileStorage) Files() []*types.FileInfo
func (*FileStorage) Flush ¶ added in v1.9.51
func (fs *FileStorage) Flush() error
func (*FileStorage) GetBlockByNumber ¶ added in v1.0.0
func (fs *FileStorage) GetBlockByNumber(blockNum uint64) *types.Block
func (*FileStorage) GetFileByAddr ¶
func (fs *FileStorage) GetFileByAddr(addr common.Address) *types.FileInfo
func (*FileStorage) GetRootByNumber ¶ added in v1.9.51
func (fs *FileStorage) GetRootByNumber(number uint64) (root []byte)
func (*FileStorage) ID ¶ added in v1.9.51
func (fs *FileStorage) ID() uint64
func (*FileStorage) NewFileInfo ¶ added in v1.0.0
func (fs *FileStorage) NewFileInfo(Meta *types.FileMeta) *types.FileInfo
func (*FileStorage) Reset ¶ added in v1.9.51
func (fs *FileStorage) Reset() error
func (*FileStorage) Root ¶ added in v1.9.51
func (fs *FileStorage) Root() common.Hash
func (*FileStorage) Txs ¶ added in v1.9.51
func (fs *FileStorage) Txs() uint64
func (*FileStorage) UpdateFile ¶ added in v1.9.51
func (fs *FileStorage) UpdateFile(x *FileInfo, b *Block, prog bool) (uint64, bool, error) {
func (*FileStorage) Version ¶ added in v1.9.51
func (fs *FileStorage) Version() string
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor observes the data changes on the blockchain and synchronizes. cl for ipc/rpc communication, dl for download manager, and fs for data storage.
func NewMonitor ¶
NewMonitor creates a new instance of monitor. Once Ipcpath is settle, this method prefers to build socket connection in order to get higher communicating performance. IpcPath is unavailable on windows.
type PublicTorrentAPI ¶ added in v1.9.54
type PublicTorrentAPI struct {
// contains filtered or unexported fields
}
func NewPublicTorrentAPI ¶ added in v1.9.54
func NewPublicTorrentAPI(w *TorrentFS) *PublicTorrentAPI
NewPublicWhisperAPI create a new RPC whisper service.
type Torrent ¶
func (*Torrent) IsAvailable ¶ added in v1.0.0
func (*Torrent) ReloadFile ¶ added in v1.0.0
func (t *Torrent) ReloadFile(files []string, datas [][]byte, tm *TorrentManager)
func (*Torrent) ReloadTorrent ¶ added in v1.0.0
func (t *Torrent) ReloadTorrent(data []byte, tm *TorrentManager) error
func (*Torrent) SeedInQueue ¶ added in v1.0.0
func (t *Torrent) SeedInQueue()
func (*Torrent) WriteTorrent ¶ added in v1.0.0
type TorrentFS ¶
type TorrentFS struct {
// contains filtered or unexported fields
}
TorrentFS contains the torrent file system internals.
func (*TorrentFS) HandlePeer ¶ added in v1.9.54
func (*TorrentFS) MaxMessageSize ¶ added in v1.9.54
func (*TorrentFS) Start ¶
Start starts the data collection thread and the listening server of the dashboard. Implements the node.Service interface.
type TorrentManager ¶
type TorrentManager struct { DataDir string TmpDataDir string // contains filtered or unexported fields }
func NewTorrentManager ¶
func NewTorrentManager(config *Config, fsid uint64) (error, *TorrentManager)
NewTorrentManager ...
func (*TorrentManager) AddInfoHash ¶ added in v1.0.0
func (tm *TorrentManager) AddInfoHash(ih metainfo.Hash, BytesRequested int64) *Torrent
func (*TorrentManager) AddTorrent ¶
func (tm *TorrentManager) AddTorrent(filePath string, BytesRequested int64) *Torrent
func (*TorrentManager) Close ¶ added in v1.0.0
func (tm *TorrentManager) Close() error
func (*TorrentManager) CreateTorrent ¶ added in v1.0.0
func (*TorrentManager) GetLimitation ¶ added in v1.9.51
func (tm *TorrentManager) GetLimitation(value int64) int64
func (*TorrentManager) GetTorrent ¶ added in v1.0.0
func (tm *TorrentManager) GetTorrent(ih metainfo.Hash) *Torrent
func (*TorrentManager) SearchAndDownload ¶ added in v1.9.54
func (tm *TorrentManager) SearchAndDownload(hex string, request int64)
func (*TorrentManager) SetTorrent ¶ added in v1.0.0
func (tm *TorrentManager) SetTorrent(ih metainfo.Hash, torrent *Torrent)
func (*TorrentManager) SetTrackers ¶
func (tm *TorrentManager) SetTrackers(trackers []string, disableTCP, boost bool)
func (*TorrentManager) Start ¶ added in v1.0.0
func (tm *TorrentManager) Start() error
func (*TorrentManager) UpdateDynamicTrackers ¶ added in v1.9.51
func (tm *TorrentManager) UpdateDynamicTrackers(trackers []string)
func (*TorrentManager) UpdateInfoHash ¶ added in v1.0.0
func (tm *TorrentManager) UpdateInfoHash(ih metainfo.Hash, BytesRequested int64)
UpdateInfoHash ...
func (*TorrentManager) UpdateTorrent ¶
func (tm *TorrentManager) UpdateTorrent(input interface{}) error