aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet/message/msg_transport.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet/message/msg_transport.go')
-rw-r--r--src/gnunet/message/msg_transport.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gnunet/message/msg_transport.go b/src/gnunet/message/msg_transport.go
index 18d8ceb..fca651f 100644
--- a/src/gnunet/message/msg_transport.go
+++ b/src/gnunet/message/msg_transport.go
@@ -28,6 +28,7 @@ import (
28 28
29 "github.com/bfix/gospel/crypto/ed25519" 29 "github.com/bfix/gospel/crypto/ed25519"
30 "github.com/bfix/gospel/data" 30 "github.com/bfix/gospel/data"
31 "github.com/bfix/gospel/logger"
31) 32)
32 33
33//---------------------------------------------------------------------- 34//----------------------------------------------------------------------
@@ -106,7 +107,9 @@ func NewTransportPingMsg(target *util.PeerID, a *util.Address) *TransportPingMsg
106// String returns a human-readable representation of the message. 107// String returns a human-readable representation of the message.
107func (m *TransportPingMsg) String() string { 108func (m *TransportPingMsg) String() string {
108 a := new(util.Address) 109 a := new(util.Address)
109 data.Unmarshal(a, m.Address) 110 if err := data.Unmarshal(a, m.Address); err != nil {
111 logger.Printf(logger.ERROR, "[TransportPingMsg.String] failed: %s", err.Error())
112 }
110 return fmt.Sprintf("TransportPingMsg{target=%s,addr=%s,challenge=%d}", 113 return fmt.Sprintf("TransportPingMsg{target=%s,addr=%s,challenge=%d}",
111 m.Target, a, m.Challenge) 114 m.Target, a, m.Challenge)
112} 115}
@@ -155,7 +158,7 @@ func NewSignedAddress(a *util.Address) *SignedAddress {
155 return addr 158 return addr
156} 159}
157 160
158// TransportPongMsg is a reponse message for a PING request 161// TransportPongMsg is a response message for a PING request
159type TransportPongMsg struct { 162type TransportPongMsg struct {
160 MsgSize uint16 `order:"big"` // total size of message 163 MsgSize uint16 `order:"big"` // total size of message
161 MsgType uint16 `order:"big"` // TRANSPORT_PING (372) 164 MsgType uint16 `order:"big"` // TRANSPORT_PING (372)
@@ -164,7 +167,7 @@ type TransportPongMsg struct {
164 SignedBlock *SignedAddress // signed block of data 167 SignedBlock *SignedAddress // signed block of data
165} 168}
166 169
167// NewTransportPongMsg creates a reponse message with an address the replying 170// NewTransportPongMsg creates a response message with an address the replying
168// peer wants to be reached. 171// peer wants to be reached.
169func NewTransportPongMsg(challenge uint32, a *util.Address) *TransportPongMsg { 172func NewTransportPongMsg(challenge uint32, a *util.Address) *TransportPongMsg {
170 m := &TransportPongMsg{ 173 m := &TransportPongMsg{
@@ -189,7 +192,7 @@ func (m *TransportPongMsg) String() string {
189 return fmt.Sprintf("TransportPongMsg{addr=%s,challenge=%d}", 192 return fmt.Sprintf("TransportPongMsg{addr=%s,challenge=%d}",
190 a, m.Challenge) 193 a, m.Challenge)
191 } 194 }
192 return fmt.Sprintf("TransportPongMsg{addr=<unkown>,%d}", m.Challenge) 195 return fmt.Sprintf("TransportPongMsg{addr=<unknown>,%d}", m.Challenge)
193} 196}
194 197
195// Header returns the message header in a separate instance. 198// Header returns the message header in a separate instance.
@@ -228,7 +231,7 @@ func (m *TransportPongMsg) Verify(pub *ed25519.PublicKey) (bool, error) {
228// TRANSPORT_SESSION_ACK 231// TRANSPORT_SESSION_ACK
229//---------------------------------------------------------------------- 232//----------------------------------------------------------------------
230 233
231// SessionAckMsg is a message to acknowlege a session request 234// SessionAckMsg is a message to acknowledge a session request
232type SessionAckMsg struct { 235type SessionAckMsg struct {
233 MsgSize uint16 `order:"big"` // total size of message 236 MsgSize uint16 `order:"big"` // total size of message
234 MsgType uint16 `order:"big"` // TRANSPORT_SESSION_ACK (377) 237 MsgType uint16 `order:"big"` // TRANSPORT_SESSION_ACK (377)