Documentation
¶
Index ¶
- Constants
- func GetLocalAddress() 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 Play(path string, songName string, albumName string)
- func UploadFileProcessing(filePath string, fileName string, seedPath string) (KeyPackage, DataPackage, string, string)
- func Welcome()
- type DataPackage
- type DataPiece
- type KeyPackage
- type KeyPiece
- type MusicController
- type Peer
- type PubNodeType
- func (this *PubNodeType) Create()
- func (this *PubNodeType) Delete(key string) bool
- func (this PubNodeType) ForceQuit()
- func (this PubNodeType) Get(key string) (bool, string)
- func (this PubNodeType) Join(addr string) bool
- func (this PubNodeType) Ping(addr string) bool
- func (this PubNodeType) Put(key string, value string) bool
- func (this PubNodeType) Quit()
- func (this *PubNodeType) Run()
- type Worker
Constants ¶
View Source
const ( SHA1Len = 20 SHA1StrLen = 40 DefaultTorrentPath = "torrent/" DefaultUploadPath = "upload/" DefaultDownloadPath = "download/" DefaultMusicPath = "music/" DefaultFileName = "file" DefaultMusicName = "music" DefaultAlbumName = "Default Album" SongDelim = '$' PieceSize = 1048576 //1MB WorkQueueBuffer = 1024 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 GetLocalAddress ¶
func GetLocalAddress() string
func MakeMagnet ¶
func PiecesHash ¶
PiecesHash hash one piece, file & index unique
func UploadFileProcessing ¶
func UploadFileProcessing(filePath string, fileName string, seedPath string) (KeyPackage, DataPackage, string, string)
Types ¶
type DataPackage ¶
type DataPackage struct {
// contains filtered or unexported fields
}
type KeyPackage ¶
type KeyPackage struct {
// contains filtered or unexported fields
}
func DownloadFileProcessing ¶
func DownloadFileProcessing(seedPath string) (KeyPackage, string)
type MusicController ¶
type MusicController struct {
// contains filtered or unexported fields
}
func NewMusicController ¶
func NewMusicController(sampleRate beep.SampleRate, streamer beep.StreamSeeker) *MusicController
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) Upload ¶
func (this *Peer) Upload(keyPackage *KeyPackage, dataPackage *DataPackage) bool
type PubNodeType ¶
type PubNodeType struct {
// contains filtered or unexported fields
}
func NewPubNode ¶
func NewPubNode(_addr string) *PubNodeType
func (*PubNodeType) Create ¶
func (this *PubNodeType) Create()
func (*PubNodeType) Delete ¶
func (this *PubNodeType) Delete(key string) bool
func (PubNodeType) ForceQuit ¶
func (this PubNodeType) ForceQuit()
func (PubNodeType) Join ¶
func (this PubNodeType) Join(addr string) bool
func (PubNodeType) Ping ¶
func (this PubNodeType) Ping(addr string) bool
func (PubNodeType) Quit ¶
func (this PubNodeType) Quit()
func (*PubNodeType) Run ¶
func (this *PubNodeType) Run()
Click to show internal directories.
Click to hide internal directories.