Versions in this module Expand all Collapse all v1 v1.4.6 Mar 23, 2016 Changes in this version type TargetState + const TargetSuspended v1.4.5 Feb 29, 2016 v1.4.4 Feb 9, 2016 v1.4.3 Feb 2, 2016 v1.4.2 Jan 14, 2016 v1.4.1 Dec 22, 2015 v1.4.0 Dec 17, 2015 Changes in this version + func NewTrustedSubnetsSlice(trustedSubnets []*net.IPNet) []string type Config + TrustedSubnets []*net.IPNet type LocalConnection + TrustRemote bool + TrustedByRemote bool + func (conn *LocalConnection) Untrusted() bool type Peer + func NewPeerPlaceholder(name PeerName) *Peer type Router + func (router *Router) Trusts(remote *RemoteConnection) bool type Status + TrustedSubnets []string v1.3.1 Nov 23, 2015 v1.3.0 Nov 12, 2015 Changes in this version + const ChannelSize + const GossipInterval + const InitialInterval + const MaxDuration + const MaxInterval + const MaxTCPMsgSize + const NameSize + const PeerNameFlavour + const PeerShortIDBits + const Port + const Protocol + const ProtocolGossip + const ProtocolGossipBroadcast + const ProtocolGossipUnicast + const ProtocolHeartbeat + const ProtocolMaxVersion + const ProtocolMinVersion + const ProtocolOverlayControlMsg + const ProtocolReserved1 + const ProtocolReserved2 + const ProtocolReserved3 + const ResetAfter + const TCPHeartbeat + const UnknownPeerName + var ErrConnectToSelf = fmt.Errorf("Cannot connect to ourself") + var ErrExpectedCrypto = fmt.Errorf("Password specified, but peer requested an unencrypted connection") + var ErrExpectedNoCrypto = fmt.Errorf("No password specificed, but peer requested an encrypted connection") + var HeaderTimeout = 10 * time.Second + var ProtocolBytes = []byte(Protocol) + var ProtocolV1Features = []string + func FormSessionKey(remotePublicKey, localPrivateKey *[32]byte, secretKey []byte) *[32]byte + func GenerateKeyPair() (publicKey, privateKey *[32]byte, err error) + func GobEncode(items ...interface{}) []byte + func NewTargetSlice(cm *ConnectionMaker) []string + func StartLocalConnection(connRemote *RemoteConnection, tcpConn *net.TCPConn, router *Router, ...) + type BroadcastRouteStatus struct + Source string + Via []string + func NewBroadcastRouteStatusSlice(routes *Routes) []BroadcastRouteStatus + type Config struct + ConnLimit int + Password []byte + PeerDiscovery bool + Port int + ProtocolMinVersion byte + type Connection interface + BreakTie func(Connection) ConnectionTieBreak + Established func() bool + Local func() *Peer + Log func(args ...interface{}) + Outbound func() bool + Remote func() *Peer + RemoteTCPAddr func() string + Shutdown func(error) + type ConnectionAction func() error + type ConnectionMaker struct + func NewConnectionMaker(ourself *LocalPeer, peers *Peers, port int, discovery bool) *ConnectionMaker + func (cm *ConnectionMaker) ConnectionAborted(address string, err error) + func (cm *ConnectionMaker) ConnectionCreated(conn Connection) + func (cm *ConnectionMaker) ConnectionTerminated(conn Connection, err error) + func (cm *ConnectionMaker) ForgetConnections(peers []string) + func (cm *ConnectionMaker) InitiateConnections(peers []string, replace bool) []error + func (cm *ConnectionMaker) Refresh() + type ConnectionMakerAction func() bool + type ConnectionSet map[Connection]struct + type ConnectionStatus struct + Address string + Established bool + Name string + NickName string + Outbound bool + type ConnectionSummary struct + Established bool + NameByte []byte + Outbound bool + RemoteTCPAddr string + type ConnectionTieBreak int + const TieBreakLost + const TieBreakTied + const TieBreakWon + type EncryptedTCPReceiver struct + func NewEncryptedTCPReceiver(receiver TCPReceiver, sessionKey *[32]byte, outbound bool) *EncryptedTCPReceiver + func (receiver *EncryptedTCPReceiver) Receive() ([]byte, error) + type EncryptedTCPSender struct + func NewEncryptedTCPSender(sender TCPSender, sessionKey *[32]byte, outbound bool) *EncryptedTCPSender + func (sender *EncryptedTCPSender) Send(msg []byte) error + type GobTCPReceiver struct + func NewGobTCPReceiver(decoder *gob.Decoder) *GobTCPReceiver + func (receiver *GobTCPReceiver) Receive() ([]byte, error) + type GobTCPSender struct + func NewGobTCPSender(encoder *gob.Encoder) *GobTCPSender + func (sender *GobTCPSender) Send(msg []byte) error + type Gossip interface + GossipBroadcast func(update GossipData) error + GossipUnicast func(dstPeerName PeerName, msg []byte) error + type GossipChannel struct + func NewGossipChannel(channelName string, ourself *LocalPeer, routes *Routes, g Gossiper) *GossipChannel + func (c *GossipChannel) GossipBroadcast(update GossipData) error + func (c *GossipChannel) GossipUnicast(dstPeerName PeerName, msg []byte) error + func (c *GossipChannel) Send(srcName PeerName, data GossipData) + func (c *GossipChannel) SendDown(conn Connection, data GossipData) + type GossipChannels map[string]*GossipChannel + type GossipData interface + Encode func() [][]byte + Merge func(GossipData) + type GossipSender struct + func NewGossipSender(send func(GossipData)) *GossipSender + func (sender *GossipSender) Send(data GossipData) + func (sender *GossipSender) Stop() + type Gossiper interface + Gossip func() GossipData + OnGossip func(update []byte) (GossipData, error) + OnGossipBroadcast func(sender PeerName, update []byte) (GossipData, error) + OnGossipUnicast func(sender PeerName, msg []byte) error + type LengthPrefixTCPReceiver struct + func NewLengthPrefixTCPReceiver(reader io.Reader) *LengthPrefixTCPReceiver + func (receiver *LengthPrefixTCPReceiver) Receive() ([]byte, error) + type LengthPrefixTCPSender struct + func NewLengthPrefixTCPSender(writer io.Writer) *LengthPrefixTCPSender + func (sender *LengthPrefixTCPSender) Send(msg []byte) error + type ListOfPeers []*Peer + func (lop ListOfPeers) Len() int + func (lop ListOfPeers) Less(i, j int) bool + func (lop ListOfPeers) Swap(i, j int) + type LocalConnection struct + OverlayConn OverlayConnection + Router *Router + SessionKey *[32]byte + TCPConn *net.TCPConn + func (conn *LocalConnection) BreakTie(dupConn Connection) ConnectionTieBreak + func (conn *LocalConnection) Established() bool + func (conn *LocalConnection) SendProtocolMsg(m ProtocolMsg) + func (conn *LocalConnection) Shutdown(err error) + type LocalConnectionStatus struct + Address string + Info string + Outbound bool + State string + func NewLocalConnectionStatusSlice(cm *ConnectionMaker) []LocalConnectionStatus + type LocalPeer struct + func NewLocalPeer(name PeerName, nickName string, router *Router) *LocalPeer + func (peer *LocalPeer) AddConnection(conn *LocalConnection) error + func (peer *LocalPeer) ConnectionEstablished(conn *LocalConnection) + func (peer *LocalPeer) ConnectionTo(name PeerName) (Connection, bool) + func (peer *LocalPeer) Connections() ConnectionSet + func (peer *LocalPeer) ConnectionsTo(names []PeerName) []Connection + func (peer *LocalPeer) CreateConnection(peerAddr string, acceptNewPeer bool) error + func (peer *LocalPeer) DeleteConnection(conn *LocalConnection) + func (peer *LocalPeer) Encode(enc *gob.Encoder) + type LocalPeerAction func() + type NullOverlay struct + func (NullOverlay) AddFeaturesTo(map[string]string) + func (NullOverlay) Confirm() + func (NullOverlay) ControlMessage(byte, []byte) + func (NullOverlay) Diagnostics() interface{} + func (NullOverlay) DisplayName() string + func (NullOverlay) ErrorChannel() <-chan error + func (NullOverlay) EstablishedChannel() <-chan struct{} + func (NullOverlay) PrepareConnection(OverlayConnectionParams) (OverlayConnection, error) + func (NullOverlay) Stop() + type Overlay interface + AddFeaturesTo func(map[string]string) + Diagnostics func() interface{} + PrepareConnection func(OverlayConnectionParams) (OverlayConnection, error) + type OverlayConnection interface + Confirm func() + ControlMessage func(tag byte, msg []byte) + DisplayName func() string + ErrorChannel func() <-chan error + EstablishedChannel func() <-chan struct{} + Stop func() + type OverlayConnectionParams struct + ConnUID uint64 + Features map[string]string + LocalAddr *net.TCPAddr + Outbound bool + RemoteAddr *net.TCPAddr + RemotePeer *Peer + SendControlMessage func(tag byte, msg []byte) error + SessionKey *[32]byte + type Peer struct + Name PeerName + func NewPeer(name PeerName, nickName string, uid PeerUID, version uint64, ...) *Peer + func NewPeerFrom(peer *Peer) *Peer + func NewPeerFromSummary(summary PeerSummary) *Peer + func (peer *Peer) Encode(enc *gob.Encoder) + func (peer *Peer) ForEachConnectedPeer(establishedAndSymmetric bool, exclude map[PeerName]PeerName, f func(*Peer)) + func (peer *Peer) Routes(stopAt *Peer, establishedAndSymmetric bool) (bool, map[PeerName]PeerName) + func (peer *Peer) String() string + type PeerName uint64 + func PeerNameFromBin(nameByte []byte) PeerName + func PeerNameFromString(nameStr string) (PeerName, error) + func PeerNameFromUserInput(userInput string) (PeerName, error) + func (name PeerName) Bin() []byte + func (name PeerName) String() string + type PeerNameSet map[PeerName]struct + type PeerShortID uint16 + type PeerStatus struct + Connections []ConnectionStatus + Name string + NickName string + ShortID PeerShortID + UID PeerUID + Version uint64 + func NewPeerStatusSlice(peers *Peers) []PeerStatus + type PeerSummary struct + HasShortID bool + NameByte []byte + NickName string + ShortID PeerShortID + UID PeerUID + Version uint64 + type PeerUID uint64 + func ParsePeerUID(s string) (PeerUID, error) + type Peers struct + func NewPeers(ourself *LocalPeer) *Peers + func (peers *Peers) ApplyUpdate(update []byte) (PeerNameSet, PeerNameSet, error) + func (peers *Peers) Dereference(peer *Peer) + func (peers *Peers) EncodePeers(names PeerNameSet) []byte + func (peers *Peers) Fetch(name PeerName) *Peer + func (peers *Peers) FetchAndAddRef(name PeerName) *Peer + func (peers *Peers) FetchByShortID(shortID PeerShortID) *Peer + func (peers *Peers) FetchWithDefault(peer *Peer) *Peer + func (peers *Peers) ForEach(fun func(*Peer)) + func (peers *Peers) GarbageCollect() + func (peers *Peers) Names() PeerNameSet + func (peers *Peers) OnGC(callback func(*Peer)) + func (peers *Peers) OnInvalidateShortIDs(callback func()) + type PeersPendingNotifications struct + type ProtocolIntroConn interface + Read func(b []byte) (n int, err error) + SetDeadline func(t time.Time) error + SetReadDeadline func(t time.Time) error + SetWriteDeadline func(t time.Time) error + Write func(b []byte) (n int, err error) + type ProtocolIntroParams struct + Conn ProtocolIntroConn + Features map[string]string + MaxVersion byte + MinVersion byte + Outbound bool + Password []byte + func (params ProtocolIntroParams) DoIntro() (res ProtocolIntroResults, err error) + type ProtocolIntroResults struct + Features map[string]string + Receiver TCPReceiver + Sender TCPSender + SessionKey *[32]byte + Version byte + type ProtocolMsg struct + type ProtocolSender interface + SendProtocolMsg func(m ProtocolMsg) + type ProtocolTag byte + type RemoteConnection struct + func NewRemoteConnection(from, to *Peer, tcpAddr string, outbound bool, established bool) *RemoteConnection + func (conn *RemoteConnection) BreakTie(Connection) ConnectionTieBreak + func (conn *RemoteConnection) ErrorLog(args ...interface{}) + func (conn *RemoteConnection) Established() bool + func (conn *RemoteConnection) Local() *Peer + func (conn *RemoteConnection) Log(args ...interface{}) + func (conn *RemoteConnection) Outbound() bool + func (conn *RemoteConnection) Remote() *Peer + func (conn *RemoteConnection) RemoteTCPAddr() string + func (conn *RemoteConnection) Shutdown(error) + type Router struct + ConnectionMaker *ConnectionMaker + Ourself *LocalPeer + Overlay Overlay + Peers *Peers + Routes *Routes + TopologyGossip Gossip + func NewRouter(config Config, name PeerName, nickName string, overlay Overlay) *Router + func (router *Router) BroadcastTopologyUpdate(update []*Peer) + func (router *Router) Gossip() GossipData + func (router *Router) NewGossip(channelName string, g Gossiper) Gossip + func (router *Router) OnGossip(update []byte) (GossipData, error) + func (router *Router) OnGossipBroadcast(_ PeerName, update []byte) (GossipData, error) + func (router *Router) OnGossipUnicast(sender PeerName, msg []byte) error + func (router *Router) SendAllGossip() + func (router *Router) SendAllGossipDown(conn Connection) + func (router *Router) Start() + func (router *Router) Stop() error + func (router *Router) UsingPassword() bool + type Routes struct + func NewRoutes(ourself *LocalPeer, peers *Peers) *Routes + func (routes *Routes) Broadcast(name PeerName) []PeerName + func (routes *Routes) BroadcastAll(name PeerName) []PeerName + func (routes *Routes) EnsureRecalculated() + func (routes *Routes) OnChange(callback func()) + func (routes *Routes) PeerNames() PeerNameSet + func (routes *Routes) RandomNeighbours(except PeerName) PeerNameSet + func (routes *Routes) Recalculate() + func (routes *Routes) Unicast(name PeerName) (PeerName, bool) + func (routes *Routes) UnicastAll(name PeerName) (PeerName, bool) + type ShortIDPeers struct + type Status struct + BroadcastRoutes []BroadcastRouteStatus + Connections []LocalConnectionStatus + Encryption bool + Name string + NickName string + OverlayDiagnostics interface{} + PeerDiscovery bool + Peers []PeerStatus + Port int + Protocol string + ProtocolMaxVersion int + ProtocolMinVersion int + Targets []string + UnicastRoutes []UnicastRouteStatus + func NewStatus(router *Router) *Status + type SurrogateGossipData struct + func NewSurrogateGossipData(msg []byte) *SurrogateGossipData + func (d *SurrogateGossipData) Encode() [][]byte + func (d *SurrogateGossipData) Merge(other GossipData) + type SurrogateGossiper struct + func (*SurrogateGossiper) Gossip() GossipData + func (*SurrogateGossiper) OnGossip(update []byte) (GossipData, error) + func (*SurrogateGossiper) OnGossipBroadcast(_ PeerName, update []byte) (GossipData, error) + func (*SurrogateGossiper) OnGossipUnicast(sender PeerName, msg []byte) error + type TCPCryptoState struct + func NewTCPCryptoState(sessionKey *[32]byte, outbound bool) *TCPCryptoState + type TCPReceiver interface + Receive func() ([]byte, error) + type TCPSender interface + Send func([]byte) error + type Target struct + type TargetState int + const TargetAttempting + const TargetConnected + const TargetWaiting + type TokenBucket struct + func NewTokenBucket(capacity int64, tokenInterval time.Duration) *TokenBucket + func (tb *TokenBucket) Wait() + type TopologyGossipData struct + func (d *TopologyGossipData) Encode() [][]byte + func (d *TopologyGossipData) Merge(other GossipData) + type UnicastRouteStatus struct + Dest string + Via string + func NewUnicastRouteStatusSlice(routes *Routes) []UnicastRouteStatus + type UnknownPeerError struct + Name PeerName + func (upe UnknownPeerError) Error() string