Merge pull request #18 from nictuku/master

DHT API update
Make test script rebuild Taipei-Torrent.
Deal with t.dht being nil

Fixes panic when running without DHT.
Make code work with int being an alias for int64

Previously the code relied on int being a synonym for int32.
Remove a test file that accidentally got committed.
Improve error reporting when SHA1 sums don't match
Don't execute test if code doesn't compile.
Close peers that send us bad data.
Test with race detection.
Fix data race in deadlock detector

The lastHeartBeat variable was being written from one goroutine, and
read from another goroutine without any synchronization. In theory
the reading goroutine could view a partially updated lastHeartBeat
variable.

I replaced the implementation of deadlock detection with what I think
is a more idiomatic implementation that uses a heartbeat channel and
select with a timeout.
Add preliminary support for NAT-PMP port forwarding.

Example usage:

 -useNATPMP -gateway 192.168.1.1

You must manually specify the IP address of the default gateway.
Discovering the IP address of the default gateway is not part of the
NAT-PMP protocol.

Go doesn't currently seem to have a library for discovering the IP
address of the default gateway.

Adjusted the NAT interface to work with the NAT-PMP protocol.
Move NAT-PMP protocol support to a separate package.

This will allow other people to use the NAT-PMP client in their
own projects.
Improve unexpected length error message.

go vet pointed out that the Sprintf function wasn't using all its args.

Also switch from errors.New(fmt.Sprintf(...)) to fmt.Errorf(...)
Listen for connection if not using proxy
Merge pull request #19 from rakoo/fix-useProxy

Listen for connection if not using proxy
Fix upload issues

- Send the bitfield to a peer upon adding
- Fix handling of keep-alives
- Remove filter of piece requests based on length (some request
	may have a different size, e.g last chunk of last piece)
Add profiling and Ctrl-C handling
Add support for magnet

To download a magnet, we don't fill the TorrentSession completely, only
with the InfoHash. We then add a few booleans for selecting the path of
a peerMessage: as long as the metadata is not completely downloaded,
we only treat metadata-oriented messages.
Add code suggestions from @nictuku
Merge pull request #22 from rakoo/profiling-ctrlc

Add profiling and Ctrl-C handling