Documentation ¶
Overview ¶
Copyright (c) 2020-2021 The bitcoinpay developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2015-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2020-2021 The bitcoinpay developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2015-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2020-2021 The bitcoinpay developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2015-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2020-2021 The bitcoinpay developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2015-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Copyright (c) 2020-2021 The bitcoinpay developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2015-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Just enough UPnP to be able to forward ports
Index ¶
- type BanPeerMsg
- type NAT
- type PeerServer
- func (s *PeerServer) AddBytesReceived(bytesReceived uint64)
- func (s *PeerServer) AddBytesSent(bytesSent uint64)
- func (s *PeerServer) AddPeer(sp *serverPeer)
- func (s *PeerServer) BanPeer(msg *BanPeerMsg)
- func (s *PeerServer) BroadcastMessage(msg message.Message, exclPeers ...*serverPeer)
- func (s *PeerServer) ConnectedCount() int32
- func (s *PeerServer) ConnectedPeers() []*serverPeer
- func (s *PeerServer) Dial(network, addr string) (net.Conn, error)
- func (s *PeerServer) GetBanlist() map[string]time.Time
- func (s *PeerServer) HasPeer(uuid uuid.UUID) bool
- func (s *PeerServer) OutboundGroupCount(key string) int
- func (s *PeerServer) RelayInventory(invVect *message.InvVect, data interface{})
- func (s *PeerServer) RemoveBan(host string)
- func (p *PeerServer) Start() error
- func (p *PeerServer) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BanPeerMsg ¶
type BanPeerMsg struct {
// contains filtered or unexported fields
}
type NAT ¶
type NAT interface { // Get the external address from outside the NAT. GetExternalAddress() (addr net.IP, err error) // Add a port mapping for protocol ("udp" or "tcp") from externalport to // internal port with description lasting for timeout. AddPortMapping(protocol string, externalPort, internalPort int, description string, timeout int) (mappedExternalPort int, err error) // Remove a previously added port mapping from externalport to // internal port. DeletePortMapping(protocol string, externalPort, internalPort int) (err error) }
NAT is an interface representing a NAT traversal options for example UPNP or NAT-PMP. It provides methods to query and manipulate this traversal to allow access to services.
type PeerServer ¶
type PeerServer struct { TimeSource blockchain.MedianTimeSource BlockManager *blkmgr.BlockManager TxMemPool *mempool.TxPool // contains filtered or unexported fields }
Use start to begin accepting connections from peers. peer server handling communications to and from bitcoinpay peers.
func NewPeerServer ¶
func (*PeerServer) AddBytesReceived ¶
func (s *PeerServer) AddBytesReceived(bytesReceived uint64)
AddBytesReceived adds the passed number of bytes to the total bytes received counter for the server. It is safe for concurrent access.
func (*PeerServer) AddBytesSent ¶
func (s *PeerServer) AddBytesSent(bytesSent uint64)
AddBytesSent adds the passed number of bytes to the total bytes sent counter for the server. It is safe for concurrent access.
func (*PeerServer) AddPeer ¶
func (s *PeerServer) AddPeer(sp *serverPeer)
AddPeer adds a new peer that has already been connected to the server.
func (*PeerServer) BanPeer ¶
func (s *PeerServer) BanPeer(msg *BanPeerMsg)
BanPeer bans a peer that has already been connected to the server by ip.
func (*PeerServer) BroadcastMessage ¶
func (s *PeerServer) BroadcastMessage(msg message.Message, exclPeers ...*serverPeer)
func (*PeerServer) ConnectedCount ¶
func (s *PeerServer) ConnectedCount() int32
ConnectedCount returns the number of currently connected peers.
func (*PeerServer) ConnectedPeers ¶
func (s *PeerServer) ConnectedPeers() []*serverPeer
ConnectedPeers returns an array consisting of all connected peers.
func (*PeerServer) Dial ¶
func (s *PeerServer) Dial(network, addr string) (net.Conn, error)
Dial connects to the address on the named network.
func (*PeerServer) GetBanlist ¶
func (s *PeerServer) GetBanlist() map[string]time.Time
func (*PeerServer) OutboundGroupCount ¶
func (s *PeerServer) OutboundGroupCount(key string) int
OutboundGroupCount returns the number of peers connected to the given outbound group key.
func (*PeerServer) RelayInventory ¶
func (s *PeerServer) RelayInventory(invVect *message.InvVect, data interface{})
RelayInventory relays the passed inventory vector to all connected peers that are not already known to have it.
func (*PeerServer) RemoveBan ¶
func (s *PeerServer) RemoveBan(host string)
func (*PeerServer) Start ¶
func (p *PeerServer) Start() error
func (*PeerServer) Stop ¶
func (p *PeerServer) Stop() error