Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultP2PPort = "9080"
)
Variables ¶
View Source
var Service = &P2PService{ ctx: context.Background(), }
Functions ¶
func GetP2PPort ¶
func GetP2PPort() string
Types ¶
type Binding ¶
type Binding = bufio.ReadWriter
A binding to another peer, represented by a rw buffer.
type P2PService ¶
type P2PService struct { // The urls under which the peer can be accessed. // This variable is set when `Run` is called. URLs []url.URL // contains filtered or unexported fields }
func (*P2PService) Broadcast ¶
func (service *P2PService) Broadcast(object interface{})
Broadcast an object to all bound peers and the dashboard. The object will be JSON serialized for transfer.
func (*P2PService) Run ¶
func (service *P2PService) Run(bootstrapHost string)
Initialize the blockchain peer. Use the parameter `bootstrapTarget` to add a target url for the bootstrapping service. Note that this method will never return.
func (*P2PService) SubscribeIncoming ¶
func (service *P2PService) SubscribeIncoming(channel chan []byte)
func (*P2PService) SubscribeOutgoing ¶
func (service *P2PService) SubscribeOutgoing(channel chan []byte)
Click to show internal directories.
Click to hide internal directories.