listen

package
v0.0.0-...-fb43f42 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateListener

func CreateListener(flags *conf.Flags) (listener net.Listener, externalPort int, err error)

func CreatePortMapping

func CreatePortMapping(flags *conf.Flags) (translate nat.NAT, err error)

createPortMapping creates a NAT port mapping, or nil if none requested or found.

func ListenForPeerConnections

func ListenForPeerConnections(flags *conf.Flags) (conChan chan *BtConn, listenPort int, err error)

ListenForPeerConnections listens on a TCP port for incoming connections and demuxes them to the appropriate active torrentSession based on the InfoHash in the header.

func ReadHeader

func ReadHeader(conn net.Conn) (h []byte, err error)

Types

type BtConn

type BtConn struct {
	Conn       net.Conn
	RemoteAddr net.Addr

	Infohash string
	// contains filtered or unexported fields
}

btConn wraps an incoming network connection and contains metadata that helps identify which active torrentSession it's relevant for.

func NewBtConn

func NewBtConn(conn net.Conn, remoteAddr net.Addr, header []byte, infoHash string, id string) *BtConn

func (*BtConn) ID

func (b *BtConn) ID() string

ID returns the id of the BtConn

func (*BtConn) ReadHeader

func (b *BtConn) ReadHeader() []byte

Jump to

Keyboard shortcuts

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