You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.4 KiB

  1. package pex
  2. import (
  3. "fmt"
  4. "github.com/tendermint/tendermint/p2p"
  5. )
  6. type ErrAddrBookNonRoutable struct {
  7. Addr *p2p.NetAddress
  8. }
  9. func (err ErrAddrBookNonRoutable) Error() string {
  10. return fmt.Sprintf("Cannot add non-routable address %v", err.Addr)
  11. }
  12. type ErrAddrBookSelf struct {
  13. Addr *p2p.NetAddress
  14. }
  15. func (err ErrAddrBookSelf) Error() string {
  16. return fmt.Sprintf("Cannot add ourselves with address %v", err.Addr)
  17. }
  18. type ErrAddrBookPrivate struct {
  19. Addr *p2p.NetAddress
  20. }
  21. func (err ErrAddrBookPrivate) Error() string {
  22. return fmt.Sprintf("Cannot add private peer with address %v", err.Addr)
  23. }
  24. type ErrAddrBookPrivateSrc struct {
  25. Src *p2p.NetAddress
  26. }
  27. func (err ErrAddrBookPrivateSrc) Error() string {
  28. return fmt.Sprintf("Cannot add peer coming from private peer with address %v", err.Src)
  29. }
  30. type ErrAddrBookNilAddr struct {
  31. Addr *p2p.NetAddress
  32. Src *p2p.NetAddress
  33. }
  34. func (err ErrAddrBookNilAddr) Error() string {
  35. return fmt.Sprintf("Cannot add a nil address. Got (addr, src) = (%v, %v)", err.Addr, err.Src)
  36. }
  37. type ErrAddrBookInvalidAddr struct {
  38. Addr *p2p.NetAddress
  39. }
  40. func (err ErrAddrBookInvalidAddr) Error() string {
  41. return fmt.Sprintf("Cannot add invalid address %v", err.Addr)
  42. }
  43. type ErrAddrBookInvalidAddrNoID struct {
  44. Addr *p2p.NetAddress
  45. }
  46. func (err ErrAddrBookInvalidAddrNoID) Error() string {
  47. return fmt.Sprintf("Cannot add address with no ID %v", err.Addr)
  48. }