BitTorrent peer write test

This commit is contained in:
liwei committed 2019-05-27 19:18:28 +08:00
1 parent 41ff983b73
commit 03fbdcda60
15 files changed
+649 -188

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
package bt
import (
"fmt"
)
type ErrorCode int
const (
ErrTimeout ErrorCode = -1
ErrResponse ErrorCode = -2
)
type TrackerError struct {
Code ErrorCode
Err error
}
func (te *TrackerError) Error() string {
return fmt.Sprintf("%s:%d", te.Err.Error(), te.Code)
}
func NewTrackerError(code ErrorCode, err error) *TrackerError {
return &TrackerError{code, err}
}