"strconv"
"time"
- cmn "github.com/tendermint/tmlibs/common"
"github.com/btcsuite/go-socks/socks"
+ cmn "github.com/tendermint/tmlibs/common"
)
// NetAddress defines information about a peer on the network
// including its IP address, and port.
type NetAddress struct {
- IP net.IP
- Port uint16
- str string
+ IP net.IP
+ Port uint16
+ str string
+ isLAN bool
}
// NewNetAddress returns a new NetAddress using the provided TCP
}
}
+// NewLANNetAddressIPPort returns a new LAN NetAddress using the provided IP
+// and port number.
+func NewLANNetAddressIPPort(ip net.IP, port uint16) *NetAddress {
+ return &NetAddress{
+ IP: ip,
+ Port: port,
+ str: net.JoinHostPort(
+ ip.String(),
+ strconv.FormatUint(uint64(port), 10),
+ ),
+ isLAN: true,
+ }
+}
+
// Equals reports whether na and other are the same addresses.
func (na *NetAddress) Equals(other interface{}) bool {
if o, ok := other.(*NetAddress); ok {