lnwire: re-add .String() to the lnwire.Message interface
This commit is contained in:
parent
a4023144d3
commit
7fc6159f0a
@ -69,6 +69,7 @@ type Message interface {
|
|||||||
Command() uint32
|
Command() uint32
|
||||||
MaxPayloadLength(uint32) uint32
|
MaxPayloadLength(uint32) uint32
|
||||||
Validate() error
|
Validate() error
|
||||||
|
String() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeEmptyMessage creates a new empty message of the proper concrete type
|
// makeEmptyMessage creates a new empty message of the proper concrete type
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package lnwire
|
package lnwire
|
||||||
|
|
||||||
import "io"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
// Pong defines a message which is the direct response to a received Ping
|
// Pong defines a message which is the direct response to a received Ping
|
||||||
// message. A Pong reply indicates that a connection is still active. The Pong
|
// message. A Pong reply indicates that a connection is still active. The Pong
|
||||||
@ -75,3 +78,10 @@ func (p *Pong) MaxPayloadLength(uint32) uint32 {
|
|||||||
func (p *Pong) Validate() error {
|
func (p *Pong) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns the string representation of the target Pong.
|
||||||
|
//
|
||||||
|
// This is part of the lnwire.Message interface.
|
||||||
|
func (p *Pong) String() string {
|
||||||
|
return fmt.Sprintf("Pong(%v)", p.Nonce)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package lnwire
|
package lnwire
|
||||||
|
|
||||||
import "io"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
// Ping defines a message which is sent by peers periodically to determine if
|
// Ping defines a message which is sent by peers periodically to determine if
|
||||||
// the connection is still valid. Each ping message should carry a unique nonce
|
// the connection is still valid. Each ping message should carry a unique nonce
|
||||||
@ -74,3 +77,10 @@ func (p Ping) MaxPayloadLength(uint32) uint32 {
|
|||||||
func (p *Ping) Validate() error {
|
func (p *Ping) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String returns the string representation of the target Ping.
|
||||||
|
//
|
||||||
|
// This is part of the lnwire.Message interface.
|
||||||
|
func (p *Ping) String() string {
|
||||||
|
return fmt.Sprintf("Ping(%v)", p.Nonce)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user