p2p: tmconn->conn and types->p2p

This commit is contained in:
Ethan Buchman
2018-01-21 00:33:53 -05:00
parent 0d7d16005a
commit 44e967184a
28 changed files with 160 additions and 177 deletions

20
p2p/errors.go Normal file
View File

@ -0,0 +1,20 @@
package p2p
import (
"errors"
"fmt"
)
var (
ErrSwitchDuplicatePeer = errors.New("Duplicate peer")
ErrSwitchConnectToSelf = errors.New("Connect to self")
)
type ErrSwitchAuthenticationFailure struct {
Dialed *NetAddress
Got ID
}
func (e ErrSwitchAuthenticationFailure) Error() string {
return fmt.Sprintf("Failed to authenticate peer. Dialed %v, but got peer with ID %s", e.Dialed, e.Got)
}