server

package
v0.0.0-...-66655a6 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int32
const (
	ActionConnect Action = iota
	ActionAnnounce
	ActionScrape
	ActionError
)

type AnnounceRequest

type AnnounceRequest struct {
	TransactionId int32
	InfoHash      [20]byte
	PeerId        [20]byte
	Downloaded    int64
	Left          int64
	Uploaded      int64
	Event         Event
	IpAddress     uint32
	Key           uint32
	NumWant       int32
	Port          uint16
}

type AnnounceResponse

type AnnounceResponse struct {
	Action        Action
	TransactionId int32
	Interval      int32
	Leechers      int32
	Seeders       int32
}

type ConnectRequest

type ConnectRequest struct {
	TransactionId int32
}

Connect

type ConnectResponse

type ConnectResponse struct {
	Action        Action
	TransactionId int32
	ConnectionId  int64
}

type Event

type Event int32
const (
	EventNone Event = iota
	EventCompleted
	EventStarted
	EventStopped
)

type InfoHash

type InfoHash struct {
	InfoHash [20]byte
}

type Peer

type Peer struct {
	Ip   int32
	Port uint16
}

type RequestHeader

type RequestHeader struct {
	ConnectionId int64
	Action       Action
}

type ScrapeRequest

type ScrapeRequest struct {
	TransactionId int32
}

type ScrapeResponse

type ScrapeResponse struct {
	Action        Action
	TransactionId int32
}

type Server

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

func Listen

func Listen(address string) (*Server, error)

Starts listening on specified address and returns a Server object

func (*Server) Addr

func (s *Server) Addr() net.Addr

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run() (err error)

type TorrentInfo

type TorrentInfo struct {
	Seeders   int32
	Completed int32
	Leechers  int32
}

Jump to

Keyboard shortcuts

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