Documentation ¶
Index ¶
- Variables
- func Addresses() []string
- func GetAddresses(protocol string, l net.Listener) []string
- func GetLocalPeerAddresses(port int) ([]string, error)
- func Read(conn *Connection) (*object.Object, error)
- func WithEventBus(k eventbus.Eventbus) func(*network)
- func WithKeychain(k keychain.Keychain) func(*network)
- func Write(o object.Object, conn *Connection) error
- type Connection
- type Listener
- type Middleware
- type MiddlewareHandler
- type Network
- type Option
- type Transport
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAllAddressesFailed for when a peer cannot be dialed ErrAllAddressesFailed = errors.New("all addresses failed to dial") // ErrNoAddresses for when a peer has no addresses ErrNoAddresses = errors.New("no addresses") // ErrNotForUs object is not meant for us ErrNotForUs = errors.New("object not for us") // ErrMissingKey when a key is not passed ErrMissingKey = errors.New("missing key") // ErrECDSAPrivateKeyRequired when a key is not an ECDSA key ErrECDSAPrivateKeyRequired = errors.New( "network currently requires an ecdsa private key", ) // ErrNonce is when the nonce does not match ErrNonce = errors.New("nonce does not match") // ErrMissingSignature is when the signature is missing ErrMissingSignature = errors.New("signature missing") // ErrAllAddressesBlacklisted all peer's addresses are currently blacklisted ErrAllAddressesBlacklisted = errors.New("all addresses blacklisted") )
View Source
var ( BindLocal = false // TODO(geoah) refactor to remove global BindPrivate = false // TODO(geoah) refactor to remove global )
View Source
var ( DefaultNetwork = New( WithEventBus(eventbus.DefaultEventbus), WithKeychain(keychain.DefaultKeychain), ) )
Functions ¶
func GetAddresses ¶
GetAddresses returns the addresses the transport is listening to
func GetLocalPeerAddresses ¶
GetLocalPeerAddresses returns the addresses TCP can listen to on the local machine
func WithEventBus ¶ added in v0.8.0
WithEventBus overrides the default eventbus for the network.
func WithKeychain ¶ added in v0.8.0
WithKeychain overrides the default keychain for the network.
Types ¶
type Connection ¶
type Connection struct { LocalPeerKey crypto.PublicKey RemotePeerKey crypto.PublicKey IsIncoming bool // contains filtered or unexported fields }
func Accept ¶ added in v0.9.0
func Accept() (*Connection, error)
func (*Connection) Close ¶ added in v0.3.2
func (c *Connection) Close() error
func (*Connection) LocalAddr ¶ added in v0.4.0
func (c *Connection) LocalAddr() string
func (*Connection) RemoteAddr ¶ added in v0.4.0
func (c *Connection) RemoteAddr() string
type Middleware ¶
type Middleware interface {
Handle() MiddlewareHandler
}
Middleware defines a middleware interface
type MiddlewareHandler ¶
type MiddlewareHandler func( ctx context.Context, conn *Connection, ) (*Connection, error)
MiddlewareHandler defines a middleware handler
Source Files ¶
Click to show internal directories.
Click to hide internal directories.