mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
A few notes: - this is not all the deletion that we can do, but this is the most "simple" case: it leaves in shims, and there's some trivial additional cleanup to the transport that can happen but that requires writing more code, and I wanted this to be easy to review above all else. - This should land *after* we cut the branch for 0.35, but I'm anticipating that to happen soon, and I wanted to run this through CI.
79 lines
1.8 KiB
Go
79 lines
1.8 KiB
Go
package pex
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/tendermint/tendermint/internal/p2p"
|
|
)
|
|
|
|
type ErrAddrBookNonRoutable struct {
|
|
Addr *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddrBookNonRoutable) Error() string {
|
|
return fmt.Sprintf("Cannot add non-routable address %v", err.Addr)
|
|
}
|
|
|
|
type ErrAddrBookSelf struct {
|
|
Addr *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddrBookSelf) Error() string {
|
|
return fmt.Sprintf("Cannot add ourselves with address %v", err.Addr)
|
|
}
|
|
|
|
type ErrAddrBookPrivate struct {
|
|
Addr *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddrBookPrivate) Error() string {
|
|
return fmt.Sprintf("Cannot add private peer with address %v", err.Addr)
|
|
}
|
|
|
|
func (err ErrAddrBookPrivate) PrivateAddr() bool {
|
|
return true
|
|
}
|
|
|
|
type ErrAddrBookPrivateSrc struct {
|
|
Src *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddrBookPrivateSrc) Error() string {
|
|
return fmt.Sprintf("Cannot add peer coming from private peer with address %v", err.Src)
|
|
}
|
|
|
|
func (err ErrAddrBookPrivateSrc) PrivateAddr() bool {
|
|
return true
|
|
}
|
|
|
|
type ErrAddrBookNilAddr struct {
|
|
Addr *p2p.NetAddress
|
|
Src *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddrBookNilAddr) Error() string {
|
|
return fmt.Sprintf("Cannot add a nil address. Got (addr, src) = (%v, %v)", err.Addr, err.Src)
|
|
}
|
|
|
|
type ErrAddrBookInvalidAddr struct {
|
|
Addr *p2p.NetAddress
|
|
AddrErr error
|
|
}
|
|
|
|
func (err ErrAddrBookInvalidAddr) Error() string {
|
|
return fmt.Sprintf("Cannot add invalid address %v: %v", err.Addr, err.AddrErr)
|
|
}
|
|
|
|
// ErrAddressBanned is thrown when the address has been banned and therefore cannot be used
|
|
type ErrAddressBanned struct {
|
|
Addr *p2p.NetAddress
|
|
}
|
|
|
|
func (err ErrAddressBanned) Error() string {
|
|
return fmt.Sprintf("Address: %v is currently banned", err.Addr)
|
|
}
|
|
|
|
// ErrUnsolicitedList is thrown when a peer provides a list of addresses that have not been asked for.
|
|
var ErrUnsolicitedList = errors.New("unsolicited pexAddrsMessage")
|