Documentation ¶
Index ¶
- Constants
- func GenerateAddr(addr string, port int) string
- func GetLocalIP() string
- func MakeMagnet(infoHash string) string
- func NewNode(port int) dhtNode
- func Open(path string) (*bencodeTorrent, error)
- func PiecesHash(piece DataPiece, index int) ([SHA1Len]byte, error)
- func Welcome()
- type Client
- func (ptr *Client) Create()
- func (this *Client) DownLoad(keyPackage *KeyPackage) (bool, []byte)
- func (c *Client) DownLoadByMagnet(magnet string, savePath string)
- func (ptr *Client) DownLoadByTorrent(torrentPath string, savePath string)
- func (ptr *Client) Init(port int)
- func (ptr *Client) Join(address string)
- func (ptr *Client) Quit()
- func (this *Client) Upload(filePath, torrentPath string)
- func (c *Client) UploadPackage(key *KeyPackage, data *DataPackage) bool
- type DataPackage
- type DataPiece
- type KeyPackage
- type KeyPiece
- type Worker
Constants ¶
View Source
const ( PieceSize = 262144 TimeWait = 3 * time.Second SHA1Len = 20 WorkQueueBuffer = 128 AfterLoginSleep = time.Second AfterQuitSleep = time.Second UploadTimeout = time.Second DownloadTimeout = time.Second RetryTime = 2 UploadInterval = 100 * time.Millisecond DownloadInterval = 100 * time.Millisecond DownloadWriteInterval = time.Second UploadFileInterval = time.Second )
Variables ¶
This section is empty.
Functions ¶
func GenerateAddr ¶
func GetLocalIP ¶
func GetLocalIP() string
func MakeMagnet ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DownLoadByMagnet ¶
func (*Client) DownLoadByTorrent ¶
func (*Client) UploadPackage ¶
func (c *Client) UploadPackage(key *KeyPackage, data *DataPackage) bool
type DataPackage ¶
type DataPackage struct {
// contains filtered or unexported fields
}
type KeyPackage ¶
type KeyPackage struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.