aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet/service/dht/path/handling.go
diff options
context:
space:
mode:
authorBernd Fix <brf@hoi-polloi.org>2022-08-15 14:02:05 +0200
committerBernd Fix <brf@hoi-polloi.org>2022-08-15 14:02:05 +0200
commitb62071330cd7e0445e89660d07b7aed098f80285 (patch)
tree85c1bbe055dff8bf027459121dc2fb958a846af4 /src/gnunet/service/dht/path/handling.go
parent835c8e8b45487c1276426034b5afb915853b6eb1 (diff)
downloadgnunet-go-b62071330cd7e0445e89660d07b7aed098f80285.tar.gz
gnunet-go-b62071330cd7e0445e89660d07b7aed098f80285.zip
Milestone 2+3 (NLnet funding)v0.1.30
Diffstat (limited to 'src/gnunet/service/dht/path/handling.go')
-rw-r--r--src/gnunet/service/dht/path/handling.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gnunet/service/dht/path/handling.go b/src/gnunet/service/dht/path/handling.go
index 412f646..b225c82 100644
--- a/src/gnunet/service/dht/path/handling.go
+++ b/src/gnunet/service/dht/path/handling.go
@@ -35,8 +35,8 @@ import (
35 35
36// path flags 36// path flags
37const ( 37const (
38 PathTruncated = iota 38 PathTruncated = 1
39 PathLastHop 39 PathLastHop = 2
40) 40)
41 41
42// Path is the complete list of verified hops a message travelled. 42// Path is the complete list of verified hops a message travelled.
@@ -48,6 +48,7 @@ type Path struct {
48 Expire util.AbsoluteTime `` // expiration time 48 Expire util.AbsoluteTime `` // expiration time
49 TruncOrigin *util.PeerID `opt:"(IsUsed)"` // truncated origin (optional) 49 TruncOrigin *util.PeerID `opt:"(IsUsed)"` // truncated origin (optional)
50 NumList uint16 `order:"big"` // number of list entries 50 NumList uint16 `order:"big"` // number of list entries
51 SplitPos uint16 `order:"big"` // optional split position
51 List []*Entry `size:"NumList"` // list of path entries 52 List []*Entry `size:"NumList"` // list of path entries
52 LastSig *util.PeerSignature `opt:"(Isused)"` // last hop signature 53 LastSig *util.PeerSignature `opt:"(Isused)"` // last hop signature
53 LastHop *util.PeerID `opt:"(IsUsed)"` // last hop peer id 54 LastHop *util.PeerID `opt:"(IsUsed)"` // last hop peer id
@@ -72,6 +73,7 @@ func NewPath(bh *crypto.HashCode, expire util.AbsoluteTime) *Path {
72 Expire: expire, 73 Expire: expire,
73 TruncOrigin: nil, 74 TruncOrigin: nil,
74 NumList: 0, 75 NumList: 0,
76 SplitPos: 0,
75 List: make([]*Entry, 0), 77 List: make([]*Entry, 0),
76 LastSig: nil, 78 LastSig: nil,
77 LastHop: nil, 79 LastHop: nil,
@@ -81,7 +83,7 @@ func NewPath(bh *crypto.HashCode, expire util.AbsoluteTime) *Path {
81// NewPathFromBytes reconstructs a path instance from binary data. The layout 83// NewPathFromBytes reconstructs a path instance from binary data. The layout
82// of the data must match with the layout used in Path.Bytes(). 84// of the data must match with the layout used in Path.Bytes().
83func NewPathFromBytes(buf []byte) (path *Path, err error) { 85func NewPathFromBytes(buf []byte) (path *Path, err error) {
84 if buf == nil || len(buf) == 0 { 86 if len(buf) == 0 {
85 return 87 return
86 } 88 }
87 path = new(Path) 89 path = new(Path)
@@ -116,6 +118,7 @@ func (p *Path) Clone() *Path {
116 Expire: p.Expire, 118 Expire: p.Expire,
117 TruncOrigin: p.TruncOrigin, 119 TruncOrigin: p.TruncOrigin,
118 NumList: p.NumList, 120 NumList: p.NumList,
121 SplitPos: p.SplitPos,
119 List: util.Clone(p.List), 122 List: util.Clone(p.List),
120 LastSig: p.LastSig, 123 LastSig: p.LastSig,
121 LastHop: p.LastHop, 124 LastHop: p.LastHop,