tengu

package
v0.0.0-...-a24eca1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

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 MakeMagnet(infoHash string) string

func NewNode

func NewNode(port int) dhtNode

func Open

func Open(path string) (*bencodeTorrent, error)

Open parses a torrent file

func PiecesHash

func PiecesHash(piece DataPiece, index int) ([SHA1Len]byte, error)

PiecesHash hash one piece, file & index unique

func Play

func Play(path string, songName string, albumName string)

func UploadFileProcessing

func UploadFileProcessing(filePath string, fileName string, seedPath string) (KeyPackage, DataPackage, string, string)

func Welcome

func Welcome()

Types

type DataPackage

type DataPackage struct {
	// contains filtered or unexported fields
}

type DataPiece

type DataPiece []byte

type KeyPackage

type KeyPackage struct {
	// contains filtered or unexported fields
}

func DownloadFileProcessing

func DownloadFileProcessing(seedPath string) (KeyPackage, string)

type KeyPiece

type KeyPiece [SHA1Len]byte

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) DownLoad

func (this *Peer) DownLoad(keyPackage *KeyPackage) (bool, []byte)

func (*Peer) Login

func (this *Peer) Login(port int, bootstrapAddr string)

func (*Peer) Quit

func (this *Peer) Quit()

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) Get

func (this PubNodeType) Get(key string) (bool, string)

func (PubNodeType) Join

func (this PubNodeType) Join(addr string) bool

func (PubNodeType) Ping

func (this PubNodeType) Ping(addr string) bool

func (PubNodeType) Put

func (this PubNodeType) Put(key string, value string) bool

func (PubNodeType) Quit

func (this PubNodeType) Quit()

func (*PubNodeType) Run

func (this *PubNodeType) Run()

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL