@@ -38,7 +38,7 @@ func IsBootnode(b bool) RecordOp {
3838 return func (cs * Counters ) {
3939 cs .Lock ()
4040 defer cs .Unlock ()
41- cs .isBootnode = b
41+ cs .IsBootnode = b
4242 }
4343}
4444
@@ -147,13 +147,15 @@ type Snapshot struct {
147147 LatencyEWMA time.Duration
148148 Reachability p2p.ReachabilityStatus
149149 Healthy bool
150+ IsBootnode bool
150151}
151152
152153// persistentCounters is a helper struct used for persisting selected counters.
153154type persistentCounters struct {
154155 PeerAddress swarm.Address `json:"peerAddress"`
155156 LastSeenTimestamp int64 `json:"lastSeenTimestamp"`
156157 ConnTotalDuration time.Duration `json:"connTotalDuration"`
158+ IsBootnode bool `json:"isBootnode"`
157159}
158160
159161// Counters represents a collection of peer metrics
@@ -164,7 +166,7 @@ type Counters struct {
164166 // Bookkeeping.
165167 isLoggedIn bool
166168 peerAddress swarm.Address
167- isBootnode bool
169+ IsBootnode bool
168170
169171 // Counters.
170172 lastSeenTimestamp int64
@@ -187,6 +189,7 @@ func (cs *Counters) UnmarshalJSON(b []byte) (err error) {
187189 cs .peerAddress = val .PeerAddress
188190 cs .lastSeenTimestamp = val .LastSeenTimestamp
189191 cs .connTotalDuration = val .ConnTotalDuration
192+ cs .IsBootnode = val .IsBootnode
190193 cs .Unlock ()
191194 return nil
192195}
@@ -198,6 +201,7 @@ func (cs *Counters) MarshalJSON() ([]byte, error) {
198201 PeerAddress : cs .peerAddress ,
199202 LastSeenTimestamp : cs .lastSeenTimestamp ,
200203 ConnTotalDuration : cs .connTotalDuration ,
204+ IsBootnode : cs .IsBootnode ,
201205 }
202206 cs .Unlock ()
203207 return json .Marshal (val )
@@ -224,6 +228,7 @@ func (cs *Counters) snapshot(t time.Time) *Snapshot {
224228 LatencyEWMA : cs .latencyEWMA ,
225229 Reachability : cs .ReachabilityStatus ,
226230 Healthy : cs .Healthy ,
231+ IsBootnode : cs .IsBootnode ,
227232 }
228233}
229234
@@ -249,6 +254,7 @@ func NewCollector(db *shed.DB) (*Collector, error) {
249254 peerAddress : val .PeerAddress ,
250255 lastSeenTimestamp : val .LastSeenTimestamp ,
251256 connTotalDuration : val .ConnTotalDuration ,
257+ IsBootnode : val .IsBootnode ,
252258 })
253259 }
254260
@@ -321,7 +327,7 @@ type ExcludeOp func(*Counters) bool
321327// IsBootnode is used to filter bootnode peers.
322328func Bootnode () ExcludeOp {
323329 return func (cs * Counters ) bool {
324- return cs .isBootnode
330+ return cs .IsBootnode
325331 }
326332}
327333
0 commit comments