@@ -6,7 +6,7 @@ supported kaspa messages to and from the appmessage. This package does not deal
6
6
with the specifics of message handling such as what to do when a message is
7
7
received. This provides the caller with a high level of flexibility.
8
8
9
- Kaspa Message Overview
9
+ # Kaspa Message Overview
10
10
11
11
The kaspa protocol consists of exchanging messages between peers. Each
12
12
message is preceded by a header which identifies information about it such as
@@ -22,7 +22,7 @@ messages, all of the details of marshalling and unmarshalling to and from the
22
22
appmessage using kaspa encoding are handled so the caller doesn't have to concern
23
23
themselves with the specifics.
24
24
25
- Message Interaction
25
+ # Message Interaction
26
26
27
27
The following provides a quick summary of how the kaspa messages are intended
28
28
to interact with one another. As stated above, these interactions are not
@@ -45,13 +45,13 @@ interactions in no particular order.
45
45
notfound message (MsgNotFound)
46
46
ping message (MsgPing) pong message (MsgPong)
47
47
48
- Common Parameters
48
+ # Common Parameters
49
49
50
50
There are several common parameters that arise when using this package to read
51
51
and write kaspa messages. The following sections provide a quick overview of
52
52
these parameters so the next sections can build on them.
53
53
54
- Protocol Version
54
+ # Protocol Version
55
55
56
56
The protocol version should be negotiated with the remote peer at a higher
57
57
level than this package via the version (MsgVersion) message exchange, however,
@@ -60,18 +60,18 @@ latest protocol version this package supports and is typically the value to use
60
60
for all outbound connections before a potentially lower protocol version is
61
61
negotiated.
62
62
63
- Kaspa Network
63
+ # Kaspa Network
64
64
65
65
The kaspa network is a magic number which is used to identify the start of a
66
66
message and which kaspa network the message applies to. This package provides
67
67
the following constants:
68
68
69
- appmessage.Mainnet
70
- appmessage.Testnet (Test network)
71
- appmessage.Simnet (Simulation test network)
72
- appmessage.Devnet (Development network)
69
+ appmessage.Mainnet
70
+ appmessage.Testnet (Test network)
71
+ appmessage.Simnet (Simulation test network)
72
+ appmessage.Devnet (Development network)
73
73
74
- Determining Message Type
74
+ # Determining Message Type
75
75
76
76
As discussed in the kaspa message overview section, this package reads
77
77
and writes kaspa messages using a generic interface named Message. In
@@ -89,7 +89,7 @@ switch or type assertion. An example of a type switch follows:
89
89
fmt.Printf("Number of tx in block: %d", msg.Header.TxnCount)
90
90
}
91
91
92
- Reading Messages
92
+ # Reading Messages
93
93
94
94
In order to unmarshall kaspa messages from the appmessage, use the ReadMessage
95
95
function. It accepts any io.Reader, but typically this will be a net.Conn to
@@ -104,7 +104,7 @@ a remote node running a kaspa peer. Example syntax is:
104
104
// Log and handle the error
105
105
}
106
106
107
- Writing Messages
107
+ # Writing Messages
108
108
109
109
In order to marshall kaspa messages to the appmessage, use the WriteMessage
110
110
function. It accepts any io.Writer, but typically this will be a net.Conn to
@@ -122,7 +122,7 @@ from a remote peer is:
122
122
// Log and handle the error
123
123
}
124
124
125
- Errors
125
+ # Errors
126
126
127
127
Errors returned by this package are either the raw errors provided by underlying
128
128
calls to read/write from streams such as io.EOF, io.ErrUnexpectedEOF, and
0 commit comments