2018-01-26 18:04:13 +00:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
2019-09-09 14:54:38 +00:00
|
|
|
"net"
|
|
|
|
|
2018-02-06 06:43:32 +00:00
|
|
|
"github.com/CityOfZion/neo-go/pkg/network/payload"
|
2018-01-26 18:04:13 +00:00
|
|
|
)
|
|
|
|
|
2019-09-03 14:51:37 +00:00
|
|
|
// Peer represents a network node neo-go is connected to.
|
2018-01-31 08:27:08 +00:00
|
|
|
type Peer interface {
|
2019-11-06 07:55:21 +00:00
|
|
|
// RemoteAddr returns the remote address that we're connected to now.
|
|
|
|
RemoteAddr() net.Addr
|
|
|
|
// PeerAddr returns the remote address that should be used to establish
|
|
|
|
// a new connection to the node. It can differ from the RemoteAddr
|
|
|
|
// address in case where the remote node is a client and its current
|
|
|
|
// connection port is different from the one the other node should use
|
|
|
|
// to connect to it. It's only valid after the handshake is completed,
|
|
|
|
// before that it returns the same address as RemoteAddr.
|
|
|
|
PeerAddr() net.Addr
|
2018-03-14 09:36:59 +00:00
|
|
|
Disconnect(error)
|
2018-04-13 10:14:08 +00:00
|
|
|
WriteMsg(msg *Message) error
|
2018-03-14 09:36:59 +00:00
|
|
|
Done() chan error
|
|
|
|
Version() *payload.Version
|
2019-09-13 12:43:22 +00:00
|
|
|
Handshaked() bool
|
|
|
|
SendVersion(*Message) error
|
|
|
|
SendVersionAck(*Message) error
|
|
|
|
HandleVersion(*payload.Version) error
|
|
|
|
HandleVersionAck() error
|
2018-01-31 08:27:08 +00:00
|
|
|
}
|