github.com/btcsuite/btcd@v0.24.0/wire/msggetaddr.go (about)

     1  // Copyright (c) 2013-2015 The btcsuite developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  package wire
     6  
     7  import (
     8  	"io"
     9  )
    10  
    11  // MsgGetAddr implements the Message interface and represents a bitcoin
    12  // getaddr message.  It is used to request a list of known active peers on the
    13  // network from a peer to help identify potential nodes.  The list is returned
    14  // via one or more addr messages (MsgAddr).
    15  //
    16  // This message has no payload.
    17  type MsgGetAddr struct{}
    18  
    19  // BtcDecode decodes r using the bitcoin protocol encoding into the receiver.
    20  // This is part of the Message interface implementation.
    21  func (msg *MsgGetAddr) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) error {
    22  	return nil
    23  }
    24  
    25  // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
    26  // This is part of the Message interface implementation.
    27  func (msg *MsgGetAddr) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
    28  	return nil
    29  }
    30  
    31  // Command returns the protocol command string for the message.  This is part
    32  // of the Message interface implementation.
    33  func (msg *MsgGetAddr) Command() string {
    34  	return CmdGetAddr
    35  }
    36  
    37  // MaxPayloadLength returns the maximum length the payload can be for the
    38  // receiver.  This is part of the Message interface implementation.
    39  func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32 {
    40  	return 0
    41  }
    42  
    43  // NewMsgGetAddr returns a new bitcoin getaddr message that conforms to the
    44  // Message interface.  See MsgGetAddr for details.
    45  func NewMsgGetAddr() *MsgGetAddr {
    46  	return &MsgGetAddr{}
    47  }