Documentation ¶
Index ¶
- Variables
- func AnyMsgFilter(addresses ...string) func(interface{}) bool
- func MsgFilter(msgType MsgType, addresses ...string) func(interface{}) bool
- func SetAddress(address string) func(*Config)
- func SetListen(listen bool) func(*Config)
- func SetMaxPeers(maxPeers uint) func(*Config)
- func SetMaxPending(maxPending uint) func(*Config)
- func SetMinPeers(minPeers uint) func(*Config)
- func SetNetwork(network []byte) func(*Config)
- type Codec
- type Config
- type Connected
- type Disconnected
- type Discover
- type Listener
- type MsgType
- type Network
- type Peers
- type Ping
- type Pong
- type Received
Constants ¶
This section is empty.
Variables ¶
var ( Odin = []byte{79, 68, 73, 78} Thor = []byte{84, 72, 79, 82} Loki = []byte{76, 79, 75, 73} )
Enumeration of different networks available. A node configured with one network will only successfully connect to nodes of the same network. To be used for testing & iteration.
Functions ¶
func AnyMsgFilter ¶
AnyMsgFilter filter for any message type
func SetAddress ¶
SetAddress allows us to configure a custom listen address.
func SetMaxPeers ¶
SetMaxPeers allows us to configure a custom number for maximum peers.
func SetMaxPending ¶
SetMaxPending allows us to configure the custom number for maximum pending.
func SetMinPeers ¶
SetMinPeers allows us to configure a custom number for minimum peers.
func SetNetwork ¶
SetNetwork allows us to configure a custom network ID.
Types ¶
type Codec ¶
type Codec interface { Encode(w io.Writer, i interface{}) error Decode(r io.Reader) (interface{}, error) }
Codec represents a module for network serialization & encoding, as well as deserialization & decoding, using the same format.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents the configuration parameters available to configure a node on the peer-to-peer network.
type Disconnected ¶
Disconnected represents a disconnection event.
type Discover ¶
type Discover struct { }
Discover represents a discovery message sent on the network.
type Listener ¶
Listener defines our own listener as the standard library interface doesn't have the deadline functions.
type Network ¶
type Network interface { Add(address string) Send(address string, msg interface{}) error Broadcast(msg interface{}, exclude ...string) error Stop() Stats() }
Network defines the exposed API of the Alvalor network package.
type Peers ¶
type Peers struct {
Addresses []string
}
Peers represents a list of peer addresses shared on the network.
type Ping ¶
type Ping struct {
Nonce uint32
}
Ping represents an outgoing heartbeat message sent on the network.
Source Files ¶
- acceptor.go
- addressManager.go
- codec.go
- config.go
- connector.go
- dialWrapper.go
- dialer.go
- discoverer.go
- dropper.go
- eventManager.go
- events.go
- filters.go
- handlerManager.go
- listenWrapper.go
- listener.go
- messages.go
- network.go
- peer.go
- peerManager.go
- pendingManager.go
- processor.go
- receiver.go
- reputationManager.go
- sender.go
- server.go
- sorts.go
- stream.go
- subscriber.go
- workaround.go