diff options
Diffstat (limited to 'src/gnunet')
51 files changed, 2864 insertions, 1057 deletions
diff --git a/src/gnunet/build.sh b/src/gnunet/build.sh index 03899f7..ce79ce1 100755 --- a/src/gnunet/build.sh +++ b/src/gnunet/build.sh | |||
@@ -4,4 +4,5 @@ if [ "$1" = "withgen" ]; then | |||
4 | go generate ./... | 4 | go generate ./... |
5 | shift | 5 | shift |
6 | fi | 6 | fi |
7 | go install $* -gcflags "-N -l" ./... | 7 | |
8 | go install $* -trimpath -gcflags "-N -l" ./... | ||
diff --git a/src/gnunet/cmd/zonemaster-go/main.go b/src/gnunet/cmd/zonemaster-go/main.go index 6380db0..fdd3ae9 100644 --- a/src/gnunet/cmd/zonemaster-go/main.go +++ b/src/gnunet/cmd/zonemaster-go/main.go | |||
@@ -75,7 +75,7 @@ func main() { | |||
75 | 75 | ||
76 | // start services under zonemaster umbrella | 76 | // start services under zonemaster umbrella |
77 | ctx, cancel := context.WithCancel(context.Background()) | 77 | ctx, cancel := context.WithCancel(context.Background()) |
78 | srv := zonemaster.NewService(ctx, nil) | 78 | srv := zonemaster.NewService(ctx, nil, config.Cfg.ZoneMaster.PlugIns) |
79 | go srv.Run(ctx) | 79 | go srv.Run(ctx) |
80 | 80 | ||
81 | // start UDS listener if service is specified | 81 | // start UDS listener if service is specified |
@@ -83,7 +83,7 @@ func main() { | |||
83 | sockHdlr := service.NewSocketHandler("zonemaster", srv) | 83 | sockHdlr := service.NewSocketHandler("zonemaster", srv) |
84 | if err = sockHdlr.Start(ctx, config.Cfg.ZoneMaster.Service.Socket, config.Cfg.ZoneMaster.Service.Params); err != nil { | 84 | if err = sockHdlr.Start(ctx, config.Cfg.ZoneMaster.Service.Socket, config.Cfg.ZoneMaster.Service.Params); err != nil { |
85 | logger.Printf(logger.ERROR, "[zonemaster] Error: '%s'", err.Error()) | 85 | logger.Printf(logger.ERROR, "[zonemaster] Error: '%s'", err.Error()) |
86 | return | 86 | _ = sockHdlr.Stop() |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
@@ -101,9 +101,9 @@ func main() { | |||
101 | var rpc *service.JRPCServer | 101 | var rpc *service.JRPCServer |
102 | if rpc, err = service.RunRPCServer(ctx, ep); err != nil { | 102 | if rpc, err = service.RunRPCServer(ctx, ep); err != nil { |
103 | logger.Printf(logger.ERROR, "[zonemaster] RPC failed to start: %s", err.Error()) | 103 | logger.Printf(logger.ERROR, "[zonemaster] RPC failed to start: %s", err.Error()) |
104 | return | 104 | } else { |
105 | srv.InitRPC(rpc) | ||
105 | } | 106 | } |
106 | srv.InitRPC(rpc) | ||
107 | } | 107 | } |
108 | // handle OS signals | 108 | // handle OS signals |
109 | sigCh := make(chan os.Signal, 5) | 109 | sigCh := make(chan os.Signal, 5) |
diff --git a/src/gnunet/config/config.go b/src/gnunet/config/config.go index 05f8cc9..1381d11 100644 --- a/src/gnunet/config/config.go +++ b/src/gnunet/config/config.go | |||
@@ -101,6 +101,7 @@ type ZoneMasterConfig struct { | |||
101 | Period int `json:"period"` // cycle period | 101 | Period int `json:"period"` // cycle period |
102 | Storage util.ParameterSet `json:"storage"` // persistence mechanism for zone data | 102 | Storage util.ParameterSet `json:"storage"` // persistence mechanism for zone data |
103 | GUI string `json:"gui"` // listen address for HTTP GUI | 103 | GUI string `json:"gui"` // listen address for HTTP GUI |
104 | PlugIns []string `json:"plugins"` // list of plugins to load | ||
104 | } | 105 | } |
105 | 106 | ||
106 | //---------------------------------------------------------------------- | 107 | //---------------------------------------------------------------------- |
diff --git a/src/gnunet/config/gnunet-config.json b/src/gnunet/config/gnunet-config.json index cd19450..3f530d3 100644 --- a/src/gnunet/config/gnunet-config.json +++ b/src/gnunet/config/gnunet-config.json | |||
@@ -90,6 +90,7 @@ | |||
90 | "file": "${VAR_LIB}/gns/zonemaster.sqlite3" | 90 | "file": "${VAR_LIB}/gns/zonemaster.sqlite3" |
91 | }, | 91 | }, |
92 | "gui": "127.0.0.1:8100", | 92 | "gui": "127.0.0.1:8100", |
93 | "plugins": [], | ||
93 | "service": { | 94 | "service": { |
94 | "socket": "${RT_USER}/gnunet-service-zonemaster-go.sock", | 95 | "socket": "${RT_USER}/gnunet-service-zonemaster-go.sock", |
95 | "params": { | 96 | "params": { |
diff --git a/src/gnunet/crypto/gns.go b/src/gnunet/crypto/gns.go index a1c26f6..6021d98 100644 --- a/src/gnunet/crypto/gns.go +++ b/src/gnunet/crypto/gns.go | |||
@@ -281,6 +281,11 @@ func NullZonePrivate(ztype enums.GNSType) (*ZonePrivate, uint16) { | |||
281 | return zp, uint16(len(zp.KeyData) + 4) | 281 | return zp, uint16(len(zp.KeyData) + 4) |
282 | } | 282 | } |
283 | 283 | ||
284 | // IsNull returns true for a NULL key | ||
285 | func (zk *ZonePrivate) IsNull() bool { | ||
286 | return util.IsAll(zk.KeyData, 0) | ||
287 | } | ||
288 | |||
284 | // Bytes returns the binary representation | 289 | // Bytes returns the binary representation |
285 | func (zp *ZonePrivate) Bytes() []byte { | 290 | func (zp *ZonePrivate) Bytes() []byte { |
286 | buf := new(bytes.Buffer) | 291 | buf := new(bytes.Buffer) |
@@ -373,6 +378,27 @@ func NewZoneKey(d []byte) (zk *ZoneKey, err error) { | |||
373 | return | 378 | return |
374 | } | 379 | } |
375 | 380 | ||
381 | // NullZoneKey returns a "NULL" ZonePrivate for a given key | ||
382 | func NullZoneKey(ztype enums.GNSType) (*ZoneKey, uint16) { | ||
383 | // get factory for given zone type | ||
384 | impl, ok := zoneImpl[ztype] | ||
385 | if !ok { | ||
386 | return nil, 0 | ||
387 | } | ||
388 | kd := make([]byte, impl.PublicSize) | ||
389 | zp := &ZoneKey{ | ||
390 | Type: ztype, // need key type for length calculation | ||
391 | KeyData: kd, // untyped key data (all 0) | ||
392 | impl: nil, // no implementation! | ||
393 | } | ||
394 | return zp, uint16(len(zp.KeyData) + 4) | ||
395 | } | ||
396 | |||
397 | // IsNull returns true for a NULL key | ||
398 | func (zk *ZoneKey) IsNull() bool { | ||
399 | return util.IsAll(zk.KeyData, 0) | ||
400 | } | ||
401 | |||
376 | // Bytes returns the binary representation (can be used with 'init()') | 402 | // Bytes returns the binary representation (can be used with 'init()') |
377 | func (zk *ZoneKey) Bytes() []byte { | 403 | func (zk *ZoneKey) Bytes() []byte { |
378 | buf := new(bytes.Buffer) | 404 | buf := new(bytes.Buffer) |
diff --git a/src/gnunet/enums/blocktype_string.go b/src/gnunet/enums/blocktype_string.go index cc14d79..b81cd19 100644 --- a/src/gnunet/enums/blocktype_string.go +++ b/src/gnunet/enums/blocktype_string.go | |||
@@ -24,18 +24,19 @@ func _() { | |||
24 | _ = x[BLOCK_TYPE_SET_TEST-24] | 24 | _ = x[BLOCK_TYPE_SET_TEST-24] |
25 | _ = x[BLOCK_TYPE_CONSENSUS_ELEMENT-25] | 25 | _ = x[BLOCK_TYPE_CONSENSUS_ELEMENT-25] |
26 | _ = x[BLOCK_TYPE_SETI_TEST-26] | 26 | _ = x[BLOCK_TYPE_SETI_TEST-26] |
27 | _ = x[BLOCK_TYPE_SETU_TEST-27] | ||
27 | } | 28 | } |
28 | 29 | ||
29 | const ( | 30 | const ( |
30 | _BlockType_name_0 = "BLOCK_TYPE_ANYBLOCK_TYPE_FS_DBLOCKBLOCK_TYPE_FS_IBLOCK" | 31 | _BlockType_name_0 = "BLOCK_TYPE_ANYBLOCK_TYPE_FS_DBLOCKBLOCK_TYPE_FS_IBLOCK" |
31 | _BlockType_name_1 = "BLOCK_TYPE_FS_ONDEMANDBLOCK_TYPE_DHT_HELLOBLOCK_TYPE_TESTBLOCK_TYPE_FS_UBLOCKBLOCK_TYPE_DNSBLOCK_TYPE_GNS_NAMERECORDBLOCK_TYPE_REVOCATIONBLOCK_TYPE_DHT_URL_HELLO" | 32 | _BlockType_name_1 = "BLOCK_TYPE_FS_ONDEMANDBLOCK_TYPE_DHT_HELLOBLOCK_TYPE_TESTBLOCK_TYPE_FS_UBLOCKBLOCK_TYPE_DNSBLOCK_TYPE_GNS_NAMERECORDBLOCK_TYPE_REVOCATIONBLOCK_TYPE_DHT_URL_HELLO" |
32 | _BlockType_name_2 = "BLOCK_TYPE_REGEXBLOCK_TYPE_REGEX_ACCEPTBLOCK_TYPE_SET_TESTBLOCK_TYPE_CONSENSUS_ELEMENTBLOCK_TYPE_SETI_TEST" | 33 | _BlockType_name_2 = "BLOCK_TYPE_REGEXBLOCK_TYPE_REGEX_ACCEPTBLOCK_TYPE_SET_TESTBLOCK_TYPE_CONSENSUS_ELEMENTBLOCK_TYPE_SETI_TESTBLOCK_TYPE_SETU_TEST" |
33 | ) | 34 | ) |
34 | 35 | ||
35 | var ( | 36 | var ( |
36 | _BlockType_index_0 = [...]uint8{0, 14, 34, 54} | 37 | _BlockType_index_0 = [...]uint8{0, 14, 34, 54} |
37 | _BlockType_index_1 = [...]uint8{0, 22, 42, 57, 77, 91, 116, 137, 161} | 38 | _BlockType_index_1 = [...]uint8{0, 22, 42, 57, 77, 91, 116, 137, 161} |
38 | _BlockType_index_2 = [...]uint8{0, 16, 39, 58, 86, 106} | 39 | _BlockType_index_2 = [...]uint8{0, 16, 39, 58, 86, 106, 126} |
39 | ) | 40 | ) |
40 | 41 | ||
41 | func (i BlockType) String() string { | 42 | func (i BlockType) String() string { |
@@ -45,7 +46,7 @@ func (i BlockType) String() string { | |||
45 | case 6 <= i && i <= 13: | 46 | case 6 <= i && i <= 13: |
46 | i -= 6 | 47 | i -= 6 |
47 | return _BlockType_name_1[_BlockType_index_1[i]:_BlockType_index_1[i+1]] | 48 | return _BlockType_name_1[_BlockType_index_1[i]:_BlockType_index_1[i+1]] |
48 | case 22 <= i && i <= 26: | 49 | case 22 <= i && i <= 27: |
49 | i -= 22 | 50 | i -= 22 |
50 | return _BlockType_name_2[_BlockType_index_2[i]:_BlockType_index_2[i+1]] | 51 | return _BlockType_name_2[_BlockType_index_2[i]:_BlockType_index_2[i+1]] |
51 | default: | 52 | default: |
diff --git a/src/gnunet/enums/dht.go b/src/gnunet/enums/dht.go index ac04244..0e760ab 100644 --- a/src/gnunet/enums/dht.go +++ b/src/gnunet/enums/dht.go | |||
@@ -29,7 +29,3 @@ const ( | |||
29 | 29 | ||
30 | DHT_RO_DISCOVERY = 32768 // Peer discovery | 30 | DHT_RO_DISCOVERY = 32768 // Peer discovery |
31 | ) | 31 | ) |
32 | |||
33 | //go:generate go run generate.go gnunet-dht.rec gnunet-dht.tpl dht_block_type.go | ||
34 | |||
35 | //go:generate stringer -type=BlockType dht_block_type.go | ||
diff --git a/src/gnunet/enums/dht_block_type.go b/src/gnunet/enums/dht_block_type.go index db2ffe9..9a03bf0 100644 --- a/src/gnunet/enums/dht_block_type.go +++ b/src/gnunet/enums/dht_block_type.go | |||
@@ -23,6 +23,7 @@ BLOCK_TYPE_REGEX_ACCEPT BlockType = 23 // Block to store a cadet regex accepting | |||
23 | BLOCK_TYPE_SET_TEST BlockType = 24 // Block for testing set/consensus. If first byte of the block is non-zero, the block is considered invalid. | 23 | BLOCK_TYPE_SET_TEST BlockType = 24 // Block for testing set/consensus. If first byte of the block is non-zero, the block is considered invalid. |
24 | BLOCK_TYPE_CONSENSUS_ELEMENT BlockType = 25 // Block type for consensus elements. Contains either special marker elements or a nested block. | 24 | BLOCK_TYPE_CONSENSUS_ELEMENT BlockType = 25 // Block type for consensus elements. Contains either special marker elements or a nested block. |
25 | BLOCK_TYPE_SETI_TEST BlockType = 26 // Block for testing set intersection. If first byte of the block is non-zero, the block is considered invalid. | 25 | BLOCK_TYPE_SETI_TEST BlockType = 26 // Block for testing set intersection. If first byte of the block is non-zero, the block is considered invalid. |
26 | BLOCK_TYPE_SETU_TEST BlockType = 27 // Block for testing set union. If first byte of the block is non-zero, the block is considered invalid. | ||
26 | 27 | ||
27 | ) | 28 | ) |
28 | 29 | ||
diff --git a/src/gnunet/enums/error_codes.go b/src/gnunet/enums/error_codes.go new file mode 100644 index 0000000..2c1caf7 --- /dev/null +++ b/src/gnunet/enums/error_codes.go | |||
@@ -0,0 +1,33 @@ | |||
1 | // Code generated by enum generator; DO NOT EDIT. | ||
2 | |||
3 | //nolint:stylecheck // allow non-camel-case for constants | ||
4 | package enums | ||
5 | |||
6 | type ErrorCode int32 | ||
7 | |||
8 | // Error code values | ||
9 | const ( | ||
10 | EC_NONE ErrorCode = 0 // No error (success). | ||
11 | EC_UNKNOWN ErrorCode = 1 // Unknown and unspecified error. | ||
12 | EC_SERVICE_COMMUNICATION_FAILED ErrorCode = 101 // Communication with service failed. | ||
13 | EC_IDENTITY_NOT_FOUND ErrorCode = 200 // Ego not found. | ||
14 | EC_IDENTITY_NAME_CONFLICT ErrorCode = 201 // Identifier already in use for another ego. | ||
15 | EC_IDENTITY_INVALID ErrorCode = 202 // The given ego is invalid or malformed. | ||
16 | EC_NAMESTORE_UNKNOWN ErrorCode = 5000 // Unknown namestore error. | ||
17 | EC_NAMESTORE_ITERATION_FAILED ErrorCode = 5001 // Zone iteration failed. | ||
18 | EC_NAMESTORE_ZONE_NOT_FOUND ErrorCode = 5002 // Zone not found. | ||
19 | EC_NAMESTORE_RECORD_NOT_FOUND ErrorCode = 5003 // Record not found. | ||
20 | EC_NAMESTORE_RECORD_DELETE_FAILED ErrorCode = 5004 // Zone iteration failed. | ||
21 | EC_NAMESTORE_ZONE_EMPTY ErrorCode = 5005 // Zone does not contain any records. | ||
22 | EC_NAMESTORE_LOOKUP_ERROR ErrorCode = 5006 // Failed to lookup record. | ||
23 | EC_NAMESTORE_NO_RECORDS_GIVEN ErrorCode = 5007 // No records given. | ||
24 | EC_NAMESTORE_RECORD_DATA_INVALID ErrorCode = 5008 // Record data invalid. | ||
25 | EC_NAMESTORE_NO_LABEL_GIVEN ErrorCode = 5009 // No label given. | ||
26 | EC_NAMESTORE_NO_RESULTS ErrorCode = 5010 // No results given. | ||
27 | EC_NAMESTORE_RECORD_EXISTS ErrorCode = 5011 // Record already exists. | ||
28 | EC_NAMESTORE_RECORD_TOO_BIG ErrorCode = 5012 // Record size exceeds maximum limit. | ||
29 | EC_NAMESTORE_BACKEND_FAILED ErrorCode = 5013 // There was an error in the database backend. | ||
30 | EC_NAMESTORE_STORE_FAILED ErrorCode = 5014 // Failed to store the given records. | ||
31 | EC_NAMESTORE_LABEL_INVALID ErrorCode = 5015 // Label invalid or malformed. | ||
32 | |||
33 | ) | ||
diff --git a/src/gnunet/enums/errorcode_string.go b/src/gnunet/enums/errorcode_string.go new file mode 100644 index 0000000..6b00baa --- /dev/null +++ b/src/gnunet/enums/errorcode_string.go | |||
@@ -0,0 +1,63 @@ | |||
1 | // Code generated by "stringer -type=ErrorCode error_codes.go"; DO NOT EDIT. | ||
2 | |||
3 | package enums | ||
4 | |||
5 | import "strconv" | ||
6 | |||
7 | func _() { | ||
8 | // An "invalid array index" compiler error signifies that the constant values have changed. | ||
9 | // Re-run the stringer command to generate them again. | ||
10 | var x [1]struct{} | ||
11 | _ = x[EC_NONE-0] | ||
12 | _ = x[EC_UNKNOWN-1] | ||
13 | _ = x[EC_SERVICE_COMMUNICATION_FAILED-101] | ||
14 | _ = x[EC_IDENTITY_NOT_FOUND-200] | ||
15 | _ = x[EC_IDENTITY_NAME_CONFLICT-201] | ||
16 | _ = x[EC_IDENTITY_INVALID-202] | ||
17 | _ = x[EC_NAMESTORE_UNKNOWN-5000] | ||
18 | _ = x[EC_NAMESTORE_ITERATION_FAILED-5001] | ||
19 | _ = x[EC_NAMESTORE_ZONE_NOT_FOUND-5002] | ||
20 | _ = x[EC_NAMESTORE_RECORD_NOT_FOUND-5003] | ||
21 | _ = x[EC_NAMESTORE_RECORD_DELETE_FAILED-5004] | ||
22 | _ = x[EC_NAMESTORE_ZONE_EMPTY-5005] | ||
23 | _ = x[EC_NAMESTORE_LOOKUP_ERROR-5006] | ||
24 | _ = x[EC_NAMESTORE_NO_RECORDS_GIVEN-5007] | ||
25 | _ = x[EC_NAMESTORE_RECORD_DATA_INVALID-5008] | ||
26 | _ = x[EC_NAMESTORE_NO_LABEL_GIVEN-5009] | ||
27 | _ = x[EC_NAMESTORE_NO_RESULTS-5010] | ||
28 | _ = x[EC_NAMESTORE_RECORD_EXISTS-5011] | ||
29 | _ = x[EC_NAMESTORE_RECORD_TOO_BIG-5012] | ||
30 | _ = x[EC_NAMESTORE_BACKEND_FAILED-5013] | ||
31 | _ = x[EC_NAMESTORE_STORE_FAILED-5014] | ||
32 | _ = x[EC_NAMESTORE_LABEL_INVALID-5015] | ||
33 | } | ||
34 | |||
35 | const ( | ||
36 | _ErrorCode_name_0 = "EC_NONEEC_UNKNOWN" | ||
37 | _ErrorCode_name_1 = "EC_SERVICE_COMMUNICATION_FAILED" | ||
38 | _ErrorCode_name_2 = "EC_IDENTITY_NOT_FOUNDEC_IDENTITY_NAME_CONFLICTEC_IDENTITY_INVALID" | ||
39 | _ErrorCode_name_3 = "EC_NAMESTORE_UNKNOWNEC_NAMESTORE_ITERATION_FAILEDEC_NAMESTORE_ZONE_NOT_FOUNDEC_NAMESTORE_RECORD_NOT_FOUNDEC_NAMESTORE_RECORD_DELETE_FAILEDEC_NAMESTORE_ZONE_EMPTYEC_NAMESTORE_LOOKUP_ERROREC_NAMESTORE_NO_RECORDS_GIVENEC_NAMESTORE_RECORD_DATA_INVALIDEC_NAMESTORE_NO_LABEL_GIVENEC_NAMESTORE_NO_RESULTSEC_NAMESTORE_RECORD_EXISTSEC_NAMESTORE_RECORD_TOO_BIGEC_NAMESTORE_BACKEND_FAILEDEC_NAMESTORE_STORE_FAILEDEC_NAMESTORE_LABEL_INVALID" | ||
40 | ) | ||
41 | |||
42 | var ( | ||
43 | _ErrorCode_index_0 = [...]uint8{0, 7, 17} | ||
44 | _ErrorCode_index_2 = [...]uint8{0, 21, 46, 65} | ||
45 | _ErrorCode_index_3 = [...]uint16{0, 20, 49, 76, 105, 138, 161, 186, 215, 247, 274, 297, 323, 350, 377, 402, 428} | ||
46 | ) | ||
47 | |||
48 | func (i ErrorCode) String() string { | ||
49 | switch { | ||
50 | case 0 <= i && i <= 1: | ||
51 | return _ErrorCode_name_0[_ErrorCode_index_0[i]:_ErrorCode_index_0[i+1]] | ||
52 | case i == 101: | ||
53 | return _ErrorCode_name_1 | ||
54 | case 200 <= i && i <= 202: | ||
55 | i -= 200 | ||
56 | return _ErrorCode_name_2[_ErrorCode_index_2[i]:_ErrorCode_index_2[i+1]] | ||
57 | case 5000 <= i && i <= 5015: | ||
58 | i -= 5000 | ||
59 | return _ErrorCode_name_3[_ErrorCode_index_3[i]:_ErrorCode_index_3[i+1]] | ||
60 | default: | ||
61 | return "ErrorCode(" + strconv.FormatInt(int64(i), 10) + ")" | ||
62 | } | ||
63 | } | ||
diff --git a/src/gnunet/enums/generate.go b/src/gnunet/enums/generate/main.go index 0e02850..aa60be3 100644 --- a/src/gnunet/enums/generate.go +++ b/src/gnunet/enums/generate/main.go | |||
@@ -33,15 +33,17 @@ import ( | |||
33 | 33 | ||
34 | // Record in the GANA registry (for a given type) | 34 | // Record in the GANA registry (for a given type) |
35 | type Record struct { | 35 | type Record struct { |
36 | Number string | 36 | Number string |
37 | Name string | 37 | Name string |
38 | Comment string | 38 | Comment string |
39 | References string | 39 | Package string |
40 | References string | ||
41 | Description string | ||
40 | } | 42 | } |
41 | 43 | ||
42 | // String returns a readable record string | 44 | // String returns a readable record string |
43 | func (rec *Record) String() string { | 45 | func (rec *Record) String() string { |
44 | return fmt.Sprintf("[%s:%s]\n", rec.Number, rec.Name) | 46 | return fmt.Sprintf("[%s:%s]", rec.Number, rec.Name) |
45 | } | 47 | } |
46 | 48 | ||
47 | // go:generate generator to read recfiles and fill templates (not exactly | 49 | // go:generate generator to read recfiles and fill templates (not exactly |
@@ -66,21 +68,24 @@ func main() { | |||
66 | log.Fatal(err) | 68 | log.Fatal(err) |
67 | } | 69 | } |
68 | defer in.Close() | 70 | defer in.Close() |
71 | log.Println("-----------------------------------------------") | ||
72 | log.Printf("Processing %s\n", args[0]) | ||
73 | log.Println("-----------------------------------------------") | ||
69 | 74 | ||
70 | rdr := bufio.NewReader(in) | 75 | rdr := bufio.NewReader(in) |
71 | state := 0 | 76 | state := 0 |
72 | var recs []*Record | 77 | var recs []*Record |
73 | var rec *Record | 78 | var rec *Record |
74 | for { | 79 | done := false |
80 | for !done { | ||
75 | // read next line from recfile | 81 | // read next line from recfile |
76 | buf, _, err := rdr.ReadLine() | 82 | buf, _, err := rdr.ReadLine() |
77 | if err != nil { | 83 | if err != nil { |
78 | if err == io.EOF { | 84 | if err == io.EOF { |
79 | break | 85 | done = true |
80 | } | 86 | } |
81 | } | 87 | } |
82 | line := strings.TrimSpace(string(buf)) | 88 | line := strings.TrimSpace(string(buf)) |
83 | log.Printf("[%d] %s\n", state, line) | ||
84 | 89 | ||
85 | // perform state machine: | 90 | // perform state machine: |
86 | switch state { | 91 | switch state { |
@@ -98,9 +103,11 @@ func main() { | |||
98 | // read record data | 103 | // read record data |
99 | case 1: | 104 | case 1: |
100 | if len(line) == 0 { | 105 | if len(line) == 0 { |
101 | // record done; add to list | 106 | // record done |
102 | log.Println("Record: " + rec.String()) | 107 | if rec.Package == "GNUnet" || rec.Package == "" { |
103 | recs = append(recs, rec) | 108 | log.Println("Record: " + rec.String()) |
109 | recs = append(recs, rec) | ||
110 | } | ||
104 | rec = nil | 111 | rec = nil |
105 | state = 0 | 112 | state = 0 |
106 | continue | 113 | continue |
@@ -110,10 +117,16 @@ func main() { | |||
110 | switch kv[0] { | 117 | switch kv[0] { |
111 | case "Number": | 118 | case "Number": |
112 | rec.Number = strings.TrimSpace(kv[1]) | 119 | rec.Number = strings.TrimSpace(kv[1]) |
120 | case "Value": | ||
121 | rec.Number = strings.TrimSpace(kv[1]) | ||
113 | case "Name": | 122 | case "Name": |
114 | rec.Name = strings.TrimSpace(kv[1]) | 123 | rec.Name = strings.TrimSpace(kv[1]) |
115 | case "Comment": | 124 | case "Comment": |
116 | rec.Comment = strings.TrimSpace(kv[1]) | 125 | rec.Comment = strings.TrimSpace(kv[1]) |
126 | case "Description": | ||
127 | rec.Description = strings.TrimSpace(kv[1]) | ||
128 | case "Package": | ||
129 | rec.Package = strings.TrimSpace(kv[1]) | ||
117 | case "References": | 130 | case "References": |
118 | rec.References = strings.TrimSpace(kv[1]) | 131 | rec.References = strings.TrimSpace(kv[1]) |
119 | } | 132 | } |
diff --git a/src/gnunet/enums/generators.go b/src/gnunet/enums/generators.go new file mode 100644 index 0000000..4c11f55 --- /dev/null +++ b/src/gnunet/enums/generators.go | |||
@@ -0,0 +1,57 @@ | |||
1 | // This file is part of gnunet-go, a GNUnet-implementation in Golang. | ||
2 | // Copyright (C) 2019-2022 Bernd Fix >Y< | ||
3 | // | ||
4 | // gnunet-go is free software: you can redistribute it and/or modify it | ||
5 | // under the terms of the GNU Affero General Public License as published | ||
6 | // by the Free Software Foundation, either version 3 of the License, | ||
7 | // or (at your option) any later version. | ||
8 | // | ||
9 | // gnunet-go is distributed in the hope that it will be useful, but | ||
10 | // WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | // Affero General Public License for more details. | ||
13 | // | ||
14 | // You should have received a copy of the GNU Affero General Public License | ||
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | // | ||
17 | // SPDX-License-Identifier: AGPL3.0-or-later | ||
18 | |||
19 | package enums | ||
20 | |||
21 | //---------------------------------------------------------------------- | ||
22 | // Signature purposes | ||
23 | //---------------------------------------------------------------------- | ||
24 | |||
25 | //go:generate go run generate/main.go gnunet-signature.rec gnunet-signature.tpl signature_purpose.go | ||
26 | |||
27 | //go:generate stringer -type=SigPurpose signature_purpose.go | ||
28 | |||
29 | //---------------------------------------------------------------------- | ||
30 | // Error codes | ||
31 | //---------------------------------------------------------------------- | ||
32 | |||
33 | //go:generate go run generate/main.go gnunet-error-codes.rec gnunet-error-codes.tpl error_codes.go | ||
34 | |||
35 | //go:generate stringer -type=ErrorCode error_codes.go | ||
36 | |||
37 | //---------------------------------------------------------------------- | ||
38 | // DHT block types | ||
39 | //---------------------------------------------------------------------- | ||
40 | |||
41 | //go:generate go run generate/main.go gnunet-dht.rec gnunet-dht.tpl dht_block_type.go | ||
42 | |||
43 | //go:generate stringer -type=BlockType dht_block_type.go | ||
44 | |||
45 | //---------------------------------------------------------------------- | ||
46 | // GNS record types | ||
47 | //---------------------------------------------------------------------- | ||
48 | |||
49 | //go:generate go run generate/main.go gnunet-gns.rec gnunet-gns.tpl gns_type.go | ||
50 | |||
51 | //go:generate stringer -type=GNSType gns_type.go | ||
52 | |||
53 | //---------------------------------------------------------------------- | ||
54 | // GNS record flags | ||
55 | //---------------------------------------------------------------------- | ||
56 | |||
57 | //go:generate go run generate/main.go gnunet-gns-flags.rec gnunet-gns-flags.tpl gns_flags.go | ||
diff --git a/src/gnunet/enums/gns.go b/src/gnunet/enums/gns.go index 8f786f8..8a98d2d 100644 --- a/src/gnunet/enums/gns.go +++ b/src/gnunet/enums/gns.go | |||
@@ -19,16 +19,34 @@ | |||
19 | //nolint:stylecheck // allow non-camel-case for constants | 19 | //nolint:stylecheck // allow non-camel-case for constants |
20 | package enums | 20 | package enums |
21 | 21 | ||
22 | // GNSFlag type | 22 | //---------------------------------------------------------------------- |
23 | type GNSFlag uint32 | 23 | // GNS filters |
24 | //---------------------------------------------------------------------- | ||
25 | |||
26 | type GNSFilter uint16 | ||
24 | 27 | ||
25 | const ( | 28 | const ( |
26 | // GNS record flags | 29 | // GNS filters |
27 | GNS_FLAG_PRIVATE GNSFlag = 2 // Record is not shared on the DHT | 30 | GNS_FILTER_NONE GNSFilter = 0 |
28 | GNS_FLAG_SUPPL GNSFlag = 4 // Supplemental records (e.g. NICK) in a block | 31 | GNS_FILTER_INCLUDE_MAINTENANCE GNSFilter = 1 |
29 | GNS_FLAG_EXPREL GNSFlag = 8 // Expire time in record is in relative time. | 32 | GNS_FILTER_OMIT_PRIVATE GNSFilter = 2 |
30 | GNS_FLAG_SHADOW GNSFlag = 16 // Record is ignored if non-expired records of same type exist in block | 33 | ) |
34 | |||
35 | //---------------------------------------------------------------------- | ||
36 | // GNS type/flag combination (spec) | ||
37 | //---------------------------------------------------------------------- | ||
38 | |||
39 | // GNSSpec is the combination of type and flags | ||
40 | type GNSSpec struct { | ||
41 | Type GNSType | ||
42 | Flags GNSFlag | ||
43 | } | ||
44 | |||
45 | //---------------------------------------------------------------------- | ||
46 | // Local settings | ||
47 | //---------------------------------------------------------------------- | ||
31 | 48 | ||
49 | const ( | ||
32 | // GNS_LocalOptions | 50 | // GNS_LocalOptions |
33 | GNS_LO_DEFAULT = 0 // Defaults, look in cache, then in DHT. | 51 | GNS_LO_DEFAULT = 0 // Defaults, look in cache, then in DHT. |
34 | GNS_LO_NO_DHT = 1 // Never look in the DHT, keep request to local cache. | 52 | GNS_LO_NO_DHT = 1 // Never look in the DHT, keep request to local cache. |
@@ -38,13 +56,3 @@ const ( | |||
38 | 56 | ||
39 | GNS_REPLICATION_LEVEL = 10 | 57 | GNS_REPLICATION_LEVEL = 10 |
40 | ) | 58 | ) |
41 | |||
42 | //go:generate go run generate.go gnunet-gns.rec gnunet-gns.tpl gns_type.go | ||
43 | |||
44 | //go:generate stringer -type=GNSType gns_type.go | ||
45 | |||
46 | // GNSSpec is the combination of type and flags | ||
47 | type GNSSpec struct { | ||
48 | Type GNSType | ||
49 | Flags GNSFlag | ||
50 | } | ||
diff --git a/src/gnunet/enums/gns_flags.go b/src/gnunet/enums/gns_flags.go new file mode 100644 index 0000000..e5458cb --- /dev/null +++ b/src/gnunet/enums/gns_flags.go | |||
@@ -0,0 +1,46 @@ | |||
1 | // Code generated by enum generator; DO NOT EDIT. | ||
2 | |||
3 | //nolint:stylecheck // allow non-camel-case for constants | ||
4 | package enums | ||
5 | |||
6 | //---------------------------------------------------------------------- | ||
7 | // Resource Record Flags | ||
8 | //---------------------------------------------------------------------- | ||
9 | |||
10 | // GNSFlag type | ||
11 | type GNSFlag uint16 | ||
12 | |||
13 | const ( | ||
14 | // GNS record flags | ||
15 | |||
16 | GNS_FLAG_CRITICAL GNSFlag = (1<<(15-15)) // This record is critical. If it cannot be processed (for example because the record type is unknown) resolution MUST fail | ||
17 | |||
18 | GNS_FLAG_SHADOW GNSFlag = (1<<(15-14)) // This record should not be used unless all (other) records in the set with an absolute expiration time have expired. | ||
19 | |||
20 | GNS_FLAG_SUPPLEMENTAL GNSFlag = (1<<(15-13)) // This is a supplemental record. | ||
21 | |||
22 | GNS_FLAG_RELATIVE_EXPIRATION GNSFlag = (1<<(15-1)) // This expiration time of the record is a relative time (not an absolute time). Used in GNUnet implementation. | ||
23 | |||
24 | GNS_FLAG_PRIVATE GNSFlag = (1<<(15-0)) // This is a private record of this peer and it should thus not be published. | ||
25 | |||
26 | ) | ||
27 | |||
28 | // List flags as strings | ||
29 | func (gf GNSFlag) List() (flags []string) { | ||
30 | if gf&GNS_FLAG_PRIVATE != 0 { | ||
31 | flags = append(flags, "Private") | ||
32 | } | ||
33 | if gf&GNS_FLAG_SHADOW != 0 { | ||
34 | flags = append(flags, "Shadow") | ||
35 | } | ||
36 | if gf&GNS_FLAG_SUPPLEMENTAL != 0 { | ||
37 | flags = append(flags, "Suppl") | ||
38 | } | ||
39 | if gf&GNS_FLAG_CRITICAL != 0 { | ||
40 | flags = append(flags, "Critical") | ||
41 | } | ||
42 | if gf&GNS_FLAG_RELATIVE_EXPIRATION != 0 { | ||
43 | flags = append(flags, "TTL") | ||
44 | } | ||
45 | return | ||
46 | } | ||
diff --git a/src/gnunet/enums/gns_type.go b/src/gnunet/enums/gns_type.go index d4cf6a6..1b10c89 100644 --- a/src/gnunet/enums/gns_type.go +++ b/src/gnunet/enums/gns_type.go | |||
@@ -69,5 +69,7 @@ GNS_TYPE_EDKEY GNSType = 65556 // Record type for EDKEY zone delegations. | |||
69 | GNS_TYPE_ERIS_READ_CAPABILITY GNSType = 65557 // Encoding for Robust Immutable Storage (ERIS) binary read capability | 69 | GNS_TYPE_ERIS_READ_CAPABILITY GNSType = 65557 // Encoding for Robust Immutable Storage (ERIS) binary read capability |
70 | GNS_TYPE_MESSENGER_ROOM_ENTRY GNSType = 65558 // Record type to share an entry of a messenger room | 70 | GNS_TYPE_MESSENGER_ROOM_ENTRY GNSType = 65558 // Record type to share an entry of a messenger room |
71 | GNS_TYPE_TOMBSTONE GNSType = 65559 // Record type to indicate a previously delete record (PRIVATE only) | 71 | GNS_TYPE_TOMBSTONE GNSType = 65559 // Record type to indicate a previously delete record (PRIVATE only) |
72 | GNS_TYPE_MESSENGER_ROOM_DETAILS GNSType = 65560 // Record type to store details about a messenger room | ||
73 | GNS_TYPE_DID_DOCUMENT GNSType = 65561 // Record type to store DID Documents | ||
72 | 74 | ||
73 | ) | 75 | ) |
diff --git a/src/gnunet/enums/gnstype_string.go b/src/gnunet/enums/gnstype_string.go index 1a55f01..d0d55e7 100644 --- a/src/gnunet/enums/gnstype_string.go +++ b/src/gnunet/enums/gnstype_string.go | |||
@@ -69,9 +69,11 @@ func _() { | |||
69 | _ = x[GNS_TYPE_ERIS_READ_CAPABILITY-65557] | 69 | _ = x[GNS_TYPE_ERIS_READ_CAPABILITY-65557] |
70 | _ = x[GNS_TYPE_MESSENGER_ROOM_ENTRY-65558] | 70 | _ = x[GNS_TYPE_MESSENGER_ROOM_ENTRY-65558] |
71 | _ = x[GNS_TYPE_TOMBSTONE-65559] | 71 | _ = x[GNS_TYPE_TOMBSTONE-65559] |
72 | _ = x[GNS_TYPE_MESSENGER_ROOM_DETAILS-65560] | ||
73 | _ = x[GNS_TYPE_DID_DOCUMENT-65561] | ||
72 | } | 74 | } |
73 | 75 | ||
74 | const _GNSType_name = "GNS_TYPE_ANYGNS_TYPE_DNS_AGNS_TYPE_DNS_NSGNS_TYPE_DNS_CNAMEGNS_TYPE_DNS_SOAGNS_TYPE_DNS_PTRGNS_TYPE_DNS_MXGNS_TYPE_DNS_TXTGNS_TYPE_DNS_RPGNS_TYPE_DNS_AFSDBGNS_TYPE_DNS_SIGGNS_TYPE_DNS_KEYGNS_TYPE_DNS_AAAAGNS_TYPE_DNS_LOCGNS_TYPE_DNS_SRVGNS_TYPE_DNS_NAPTRGNS_TYPE_DNS_KXGNS_TYPE_DNS_CERTGNS_TYPE_DNS_DNAMEGNS_TYPE_DNS_APLGNS_TYPE_DNS_DSGNS_TYPE_DNS_SSHFPGNS_TYPE_DNS_IPSECKEYGNS_TYPE_DNS_RRSIGGNS_TYPE_DNS_NSECGNS_TYPE_DNS_DNSKEYGNS_TYPE_DNS_DHCIDGNS_TYPE_DNS_NSEC3GNS_TYPE_DNS_NSEC3PARAMGNS_TYPE_DNS_TLSAGNS_TYPE_DNS_HIPGNS_TYPE_DNS_CDSGNS_TYPE_DNS_CDNSKEYGNS_TYPE_DNS_TKEYGNS_TYPE_DNS_TSIGGNS_TYPE_DNS_URIGNS_TYPE_DNS_CAAGNS_TYPE_DNS_TAGNS_TYPE_DNS_DLVGNS_TYPE_PKEYGNS_TYPE_NICKGNS_TYPE_LEHOGNS_TYPE_VPNGNS_TYPE_GNS2DNSGNS_TYPE_BOXGNS_TYPE_PLACEGNS_TYPE_PHONEGNS_TYPE_RECLAIM_ATTRIBUTEGNS_TYPE_RECLAIM_TICKETGNS_TYPE_DELEGATEGNS_TYPE_ATTRIBUTEGNS_TYPE_RECLAIM_ATTRIBUTE_REFGNS_TYPE_REDIRECTGNS_TYPE_RECLAIM_OIDC_CLIENTGNS_TYPE_RECLAIM_OIDC_REDIRECTGNS_TYPE_RECLAIM_CREDENTIALGNS_TYPE_RECLAIM_PRESENTATIONGNS_TYPE_EDKEYGNS_TYPE_ERIS_READ_CAPABILITYGNS_TYPE_MESSENGER_ROOM_ENTRYGNS_TYPE_TOMBSTONE" | 76 | const _GNSType_name = "GNS_TYPE_ANYGNS_TYPE_DNS_AGNS_TYPE_DNS_NSGNS_TYPE_DNS_CNAMEGNS_TYPE_DNS_SOAGNS_TYPE_DNS_PTRGNS_TYPE_DNS_MXGNS_TYPE_DNS_TXTGNS_TYPE_DNS_RPGNS_TYPE_DNS_AFSDBGNS_TYPE_DNS_SIGGNS_TYPE_DNS_KEYGNS_TYPE_DNS_AAAAGNS_TYPE_DNS_LOCGNS_TYPE_DNS_SRVGNS_TYPE_DNS_NAPTRGNS_TYPE_DNS_KXGNS_TYPE_DNS_CERTGNS_TYPE_DNS_DNAMEGNS_TYPE_DNS_APLGNS_TYPE_DNS_DSGNS_TYPE_DNS_SSHFPGNS_TYPE_DNS_IPSECKEYGNS_TYPE_DNS_RRSIGGNS_TYPE_DNS_NSECGNS_TYPE_DNS_DNSKEYGNS_TYPE_DNS_DHCIDGNS_TYPE_DNS_NSEC3GNS_TYPE_DNS_NSEC3PARAMGNS_TYPE_DNS_TLSAGNS_TYPE_DNS_HIPGNS_TYPE_DNS_CDSGNS_TYPE_DNS_CDNSKEYGNS_TYPE_DNS_TKEYGNS_TYPE_DNS_TSIGGNS_TYPE_DNS_URIGNS_TYPE_DNS_CAAGNS_TYPE_DNS_TAGNS_TYPE_DNS_DLVGNS_TYPE_PKEYGNS_TYPE_NICKGNS_TYPE_LEHOGNS_TYPE_VPNGNS_TYPE_GNS2DNSGNS_TYPE_BOXGNS_TYPE_PLACEGNS_TYPE_PHONEGNS_TYPE_RECLAIM_ATTRIBUTEGNS_TYPE_RECLAIM_TICKETGNS_TYPE_DELEGATEGNS_TYPE_ATTRIBUTEGNS_TYPE_RECLAIM_ATTRIBUTE_REFGNS_TYPE_REDIRECTGNS_TYPE_RECLAIM_OIDC_CLIENTGNS_TYPE_RECLAIM_OIDC_REDIRECTGNS_TYPE_RECLAIM_CREDENTIALGNS_TYPE_RECLAIM_PRESENTATIONGNS_TYPE_EDKEYGNS_TYPE_ERIS_READ_CAPABILITYGNS_TYPE_MESSENGER_ROOM_ENTRYGNS_TYPE_TOMBSTONEGNS_TYPE_MESSENGER_ROOM_DETAILSGNS_TYPE_DID_DOCUMENT" |
75 | 77 | ||
76 | var _GNSType_map = map[GNSType]string{ | 78 | var _GNSType_map = map[GNSType]string{ |
77 | 0: _GNSType_name[0:12], | 79 | 0: _GNSType_name[0:12], |
@@ -135,6 +137,8 @@ var _GNSType_map = map[GNSType]string{ | |||
135 | 65557: _GNSType_name[1019:1048], | 137 | 65557: _GNSType_name[1019:1048], |
136 | 65558: _GNSType_name[1048:1077], | 138 | 65558: _GNSType_name[1048:1077], |
137 | 65559: _GNSType_name[1077:1095], | 139 | 65559: _GNSType_name[1077:1095], |
140 | 65560: _GNSType_name[1095:1126], | ||
141 | 65561: _GNSType_name[1126:1147], | ||
138 | } | 142 | } |
139 | 143 | ||
140 | func (i GNSType) String() string { | 144 | func (i GNSType) String() string { |
diff --git a/src/gnunet/enums/gnunet-error-codes.rec b/src/gnunet/enums/gnunet-error-codes.rec new file mode 100644 index 0000000..e833bb5 --- /dev/null +++ b/src/gnunet/enums/gnunet-error-codes.rec | |||
@@ -0,0 +1,136 @@ | |||
1 | # -*- mode: rec -*- | ||
2 | # | ||
3 | # Registry for GNUnet errors. | ||
4 | # | ||
5 | %rec: GnunetErrorCode | ||
6 | %key: Value | ||
7 | %typedef: ValueRange_t range 0 9999 | ||
8 | %type: Value ValueRange_t | ||
9 | %mandatory: Value | ||
10 | %typedef: Description_t regexp |^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\(\)\.,;!"':#\/ -]*$| | ||
11 | %type: Description Description_t | ||
12 | %mandatory: Description | ||
13 | %typedef: Name_t regexp /^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/ | ||
14 | %type: Name Name_t | ||
15 | %unique: Name | ||
16 | %mandatory: Name | ||
17 | # A status of 0 means no HTTP status is associated | ||
18 | %type: HttpStatus rec HttpStatusCode | ||
19 | %mandatory: HttpStatus | ||
20 | %sort: Value | ||
21 | |||
22 | Value: 0 | ||
23 | Name: NONE | ||
24 | Description: No error (success). | ||
25 | HttpStatus: 0 | ||
26 | |||
27 | Value: 1 | ||
28 | Name: UNKNOWN | ||
29 | Description: Unknown and unspecified error. | ||
30 | HttpStatus: 500 | ||
31 | |||
32 | Value: 101 | ||
33 | Name: SERVICE_COMMUNICATION_FAILED | ||
34 | Description: Communication with service failed. | ||
35 | HttpStatus: 500 | ||
36 | |||
37 | # IDENTITY Error Codes | ||
38 | |||
39 | Value: 200 | ||
40 | Name: IDENTITY_NOT_FOUND | ||
41 | Description: Ego not found. | ||
42 | HttpStatus: 404 | ||
43 | |||
44 | Value: 201 | ||
45 | Name: IDENTITY_NAME_CONFLICT | ||
46 | Description: Identifier already in use for another ego. | ||
47 | HttpStatus: 409 | ||
48 | |||
49 | Value: 202 | ||
50 | Name: IDENTITY_INVALID | ||
51 | Description: The given ego is invalid or malformed. | ||
52 | HttpStatus: 500 | ||
53 | |||
54 | # NAMESTORE Error Codes | ||
55 | |||
56 | Value: 5000 | ||
57 | Name: NAMESTORE_UNKNOWN | ||
58 | Description: Unknown namestore error. | ||
59 | HttpStatus: 500 | ||
60 | |||
61 | Value: 5001 | ||
62 | Name: NAMESTORE_ITERATION_FAILED | ||
63 | Description: Zone iteration failed. | ||
64 | HttpStatus: 500 | ||
65 | |||
66 | Value: 5002 | ||
67 | Name: NAMESTORE_ZONE_NOT_FOUND | ||
68 | Description: Zone not found. | ||
69 | HttpStatus: 404 | ||
70 | |||
71 | Value: 5003 | ||
72 | Name: NAMESTORE_RECORD_NOT_FOUND | ||
73 | Description: Record not found. | ||
74 | HttpStatus: 404 | ||
75 | |||
76 | Value: 5004 | ||
77 | Name: NAMESTORE_RECORD_DELETE_FAILED | ||
78 | Description: Zone iteration failed. | ||
79 | HttpStatus: 500 | ||
80 | |||
81 | Value: 5005 | ||
82 | Name: NAMESTORE_ZONE_EMPTY | ||
83 | Description: Zone does not contain any records. | ||
84 | HttpStatus: 404 | ||
85 | |||
86 | Value: 5006 | ||
87 | Name: NAMESTORE_LOOKUP_ERROR | ||
88 | Description: Failed to lookup record. | ||
89 | HttpStatus: 500 | ||
90 | |||
91 | Value: 5007 | ||
92 | Name: NAMESTORE_NO_RECORDS_GIVEN | ||
93 | Description: No records given. | ||
94 | HttpStatus: 400 | ||
95 | |||
96 | Value: 5008 | ||
97 | Name: NAMESTORE_RECORD_DATA_INVALID | ||
98 | Description: Record data invalid. | ||
99 | HttpStatus: 400 | ||
100 | |||
101 | Value: 5009 | ||
102 | Name: NAMESTORE_NO_LABEL_GIVEN | ||
103 | Description: No label given. | ||
104 | HttpStatus: 400 | ||
105 | |||
106 | Value: 5010 | ||
107 | Name: NAMESTORE_NO_RESULTS | ||
108 | Description: No results given. | ||
109 | HttpStatus: 404 | ||
110 | |||
111 | Value: 5011 | ||
112 | Name: NAMESTORE_RECORD_EXISTS | ||
113 | Description: Record already exists. | ||
114 | HttpStatus: 409 | ||
115 | |||
116 | Value: 5012 | ||
117 | Name: NAMESTORE_RECORD_TOO_BIG | ||
118 | Description: Record size exceeds maximum limit. | ||
119 | HttpStatus: 500 | ||
120 | |||
121 | Value: 5013 | ||
122 | Name: NAMESTORE_BACKEND_FAILED | ||
123 | Description: There was an error in the database backend. | ||
124 | HttpStatus: 500 | ||
125 | |||
126 | Value: 5014 | ||
127 | Name: NAMESTORE_STORE_FAILED | ||
128 | Description: Failed to store the given records. | ||
129 | HttpStatus: 500 | ||
130 | |||
131 | Value: 5015 | ||
132 | Name: NAMESTORE_LABEL_INVALID | ||
133 | Description: Label invalid or malformed. | ||
134 | HttpStatus: 400 | ||
135 | |||
136 | |||
diff --git a/src/gnunet/enums/gnunet-error-codes.tpl b/src/gnunet/enums/gnunet-error-codes.tpl new file mode 100644 index 0000000..44d1d1e --- /dev/null +++ b/src/gnunet/enums/gnunet-error-codes.tpl | |||
@@ -0,0 +1,12 @@ | |||
1 | // Code generated by enum generator; DO NOT EDIT. | ||
2 | |||
3 | //nolint:stylecheck // allow non-camel-case for constants | ||
4 | package enums | ||
5 | |||
6 | type ErrorCode int32 | ||
7 | |||
8 | // Error code values | ||
9 | const ( | ||
10 | {{ range $i, $kv := . }}EC_{{.Name}} ErrorCode = {{.Number}} // {{.Description}} | ||
11 | {{ end }} | ||
12 | ) | ||
diff --git a/src/gnunet/enums/gnunet-gns-flags.rec b/src/gnunet/enums/gnunet-gns-flags.rec new file mode 100644 index 0000000..22aa750 --- /dev/null +++ b/src/gnunet/enums/gnunet-gns-flags.rec | |||
@@ -0,0 +1,43 @@ | |||
1 | # -*- mode: rec -*- | ||
2 | # | ||
3 | # Registry for GNU Name System record flags | ||
4 | # | ||
5 | |||
6 | %rec: RecordType | ||
7 | %key: Number | ||
8 | %typedef: FlagRange_t range 0 15 | ||
9 | %type: Number FlagRange_t | ||
10 | %mandatory: Number | ||
11 | %typedef: Name_t regexp /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]*$/ | ||
12 | %type: Name Name_t | ||
13 | %unique: Name | ||
14 | %mandatory: Name | ||
15 | %mandatory: Comment | ||
16 | %allowed: Contact | ||
17 | %allowed: References | ||
18 | %sort: Number Name Contact References | ||
19 | |||
20 | Number: 15 | ||
21 | Name: CRITICAL | ||
22 | Comment: This record is critical. If it cannot be processed (for example because the record type is unknown) resolution MUST fail | ||
23 | References: https://lsd.gnunet.org/lsd0001 | ||
24 | |||
25 | Number: 14 | ||
26 | Name: SHADOW | ||
27 | Comment: This record should not be used unless all (other) records in the set with an absolute expiration time have expired. | ||
28 | References: https://lsd.gnunet.org/lsd0001 | ||
29 | |||
30 | Number: 13 | ||
31 | Name: SUPPLEMENTAL | ||
32 | Comment: This is a supplemental record. | ||
33 | References: https://lsd.gnunet.org/lsd0001 | ||
34 | |||
35 | Number: 1 | ||
36 | Name: RELATIVE_EXPIRATION | ||
37 | Comment: This expiration time of the record is a relative time (not an absolute time). Used in GNUnet implementation. | ||
38 | References: https://git.gnunet.org/gnunet.git | ||
39 | |||
40 | Number: 0 | ||
41 | Name: PRIVATE | ||
42 | Comment: This is a private record of this peer and it should thus not be published. | ||
43 | References: https://git.gnunet.org/gnunet.git | ||
diff --git a/src/gnunet/enums/gnunet-gns-flags.tpl b/src/gnunet/enums/gnunet-gns-flags.tpl new file mode 100644 index 0000000..8b434b2 --- /dev/null +++ b/src/gnunet/enums/gnunet-gns-flags.tpl | |||
@@ -0,0 +1,38 @@ | |||
1 | // Code generated by enum generator; DO NOT EDIT. | ||
2 | |||
3 | //nolint:stylecheck // allow non-camel-case for constants | ||
4 | package enums | ||
5 | |||
6 | //---------------------------------------------------------------------- | ||
7 | // Resource Record Flags | ||
8 | //---------------------------------------------------------------------- | ||
9 | |||
10 | // GNSFlag type | ||
11 | type GNSFlag uint16 | ||
12 | |||
13 | const ( | ||
14 | // GNS record flags | ||
15 | {{ range $i, $kv := . }} | ||
16 | GNS_FLAG_{{.Name}} GNSFlag = (1<<(15-{{.Number}})) // {{.Comment}} | ||
17 | {{ end }} | ||
18 | ) | ||
19 | |||
20 | // List flags as strings | ||
21 | func (gf GNSFlag) List() (flags []string) { | ||
22 | if gf&GNS_FLAG_PRIVATE != 0 { | ||
23 | flags = append(flags, "Private") | ||
24 | } | ||
25 | if gf&GNS_FLAG_SHADOW != 0 { | ||
26 | flags = append(flags, "Shadow") | ||
27 | } | ||
28 | if gf&GNS_FLAG_SUPPLEMENTAL != 0 { | ||
29 | flags = append(flags, "Suppl") | ||
30 | } | ||
31 | if gf&GNS_FLAG_CRITICAL != 0 { | ||
32 | flags = append(flags, "Critical") | ||
33 | } | ||
34 | if gf&GNS_FLAG_RELATIVE_EXPIRATION != 0 { | ||
35 | flags = append(flags, "TTL") | ||
36 | } | ||
37 | return | ||
38 | } | ||
diff --git a/src/gnunet/enums/gnunet-gns.rec b/src/gnunet/enums/gnunet-gns.rec index 8fc0c77..dd91cd5 100644 --- a/src/gnunet/enums/gnunet-gns.rec +++ b/src/gnunet/enums/gnunet-gns.rec | |||
@@ -19,32 +19,32 @@ | |||
19 | Number: 65536 | 19 | Number: 65536 |
20 | Name: PKEY | 20 | Name: PKEY |
21 | Comment: GNS zone transfer | 21 | Comment: GNS zone transfer |
22 | References: LSD0001 | 22 | References: https://lsd.gnunet.org/lsd0001 |
23 | 23 | ||
24 | Number: 65537 | 24 | Number: 65537 |
25 | Name: NICK | 25 | Name: NICK |
26 | Comment: GNS nick names | 26 | Comment: GNS nick names |
27 | References: LSD0001 | 27 | References: https://lsd.gnunet.org/lsd0001 |
28 | 28 | ||
29 | Number: 65538 | 29 | Number: 65538 |
30 | Name: LEHO | 30 | Name: LEHO |
31 | Comment: legacy hostnames | 31 | Comment: legacy hostnames |
32 | References: LSD0001 | 32 | References: https://lsd.gnunet.org/lsd0001 |
33 | 33 | ||
34 | Number: 65539 | 34 | Number: 65539 |
35 | Name: VPN | 35 | Name: VPN |
36 | Comment: VPN resolution | 36 | Comment: VPN resolution |
37 | References: LSD0001 | 37 | References: https://lsd.gnunet.org/lsd0001 |
38 | 38 | ||
39 | Number: 65540 | 39 | Number: 65540 |
40 | Name: GNS2DNS | 40 | Name: GNS2DNS |
41 | Comment: Delegation to DNS | 41 | Comment: Delegation to DNS |
42 | References: LSD0001 | 42 | References: https://lsd.gnunet.org/lsd0001 |
43 | 43 | ||
44 | Number: 65541 | 44 | Number: 65541 |
45 | Name: BOX | 45 | Name: BOX |
46 | Comment: Boxed records (see TLSA/SRV handling in GNS) | 46 | Comment: Boxed records (see TLSA/SRV handling in GNS) |
47 | References: LSD0001 | 47 | References: https://lsd.gnunet.org/lsd0001 |
48 | 48 | ||
49 | Number: 65542 | 49 | Number: 65542 |
50 | Name: PLACE | 50 | Name: PLACE |
@@ -84,7 +84,7 @@ Contact: schanzen@gnunet.org | |||
84 | Number: 65551 | 84 | Number: 65551 |
85 | Name: REDIRECT | 85 | Name: REDIRECT |
86 | Comment: Resolver redirects | 86 | Comment: Resolver redirects |
87 | Contact: LSD0001 | 87 | Contact: https://lsd.gnunet.org/lsd0001 |
88 | 88 | ||
89 | Number: 65552 | 89 | Number: 65552 |
90 | Name: RECLAIM_OIDC_CLIENT | 90 | Name: RECLAIM_OIDC_CLIENT |
@@ -130,3 +130,8 @@ Number: 65560 | |||
130 | Name: MESSENGER_ROOM_DETAILS | 130 | Name: MESSENGER_ROOM_DETAILS |
131 | Comment: Record type to store details about a messenger room | 131 | Comment: Record type to store details about a messenger room |
132 | Contact: thejackimonster@gmail.com | 132 | Contact: thejackimonster@gmail.com |
133 | |||
134 | Number: 65561 | ||
135 | Name: DID_DOCUMENT | ||
136 | Comment: Record type to store DID Documents | ||
137 | Contact: schanzen@gnunet.org | ||
diff --git a/src/gnunet/enums/gnunet-signature.rec b/src/gnunet/enums/gnunet-signature.rec index 79f9796..fbd57e4 100644 --- a/src/gnunet/enums/gnunet-signature.rec +++ b/src/gnunet/enums/gnunet-signature.rec | |||
@@ -1,6 +1,6 @@ | |||
1 | # -*- mode: rec -*- | 1 | # -*- mode: rec -*- |
2 | # | 2 | # |
3 | # Registry for GNUnet Signature purposes | 3 | # Registry for Signature purposes |
4 | # | 4 | # |
5 | 5 | ||
6 | %rec: SignaturePurpose | 6 | %rec: SignaturePurpose |
@@ -12,172 +12,572 @@ | |||
12 | %unique: Name | 12 | %unique: Name |
13 | %mandatory: Name | 13 | %mandatory: Name |
14 | %mandatory: Comment | 14 | %mandatory: Comment |
15 | %mandatory: Package | ||
15 | %allowed: Subsystem | 16 | %allowed: Subsystem |
16 | %sort: Number Name | 17 | %sort: Number Name |
17 | 18 | ||
18 | 19 | ||
20 | #----------------------------------------------------------------------------- | ||
21 | # GNUnet | ||
22 | |||
19 | Number: 0 | 23 | Number: 0 |
20 | Name: TEST | 24 | Name: TEST |
21 | Comment: Test signature, not valid for anything other than writing a test. (Note that the signature verification code will accept this value). | 25 | Comment: Test signature, not valid for anything other than writing a test. (Note that the signature verification code will accept this value). |
26 | Package: GNUnet | ||
22 | Subsystem: GNUnet | 27 | Subsystem: GNUnet |
23 | 28 | ||
24 | Number: 1 | 29 | Number: 1 |
25 | Name: TRANSPORT_PONG_OWN | 30 | Name: TRANSPORT_PONG_OWN |
26 | Comment: Signature for confirming that this peer uses a particular address. | 31 | Comment: Signature for confirming that this peer uses a particular address. |
32 | Package: GNUnet | ||
27 | Subsystem: GNUnet-TRANSPORT | 33 | Subsystem: GNUnet-TRANSPORT |
28 | 34 | ||
29 | Number: 2 | 35 | Number: 2 |
30 | Name: TRANSPORT_DISCONNECT | 36 | Name: TRANSPORT_DISCONNECT |
31 | Comment: Signature for confirming that this peer intends to disconnect. | 37 | Comment: Signature for confirming that this peer intends to disconnect. |
38 | Package: GNUnet | ||
32 | Subsystem: GNUnet-TRANSPORT | 39 | Subsystem: GNUnet-TRANSPORT |
33 | 40 | ||
34 | Number: 3 | 41 | Number: 3 |
35 | Name: REVOCATION | 42 | Name: REVOCATION |
36 | Comment: Signature for confirming a key revocation. | 43 | Comment: Signature for confirming a key revocation. |
44 | Package: GNUnet | ||
37 | Subsystem: GNUnet-Revocation | 45 | Subsystem: GNUnet-Revocation |
38 | 46 | ||
39 | Number: 4 | 47 | Number: 4 |
40 | Name: NAMESPACE_ADVERTISEMENT | 48 | Name: NAMESPACE_ADVERTISEMENT |
41 | Comment: Signature for a namespace/pseudonym advertisement (by the namespace owner). | 49 | Comment: Signature for a namespace/pseudonym advertisement (by the namespace owner). |
50 | Package: GNUnet | ||
42 | Subsystem: GNUnet-FS | 51 | Subsystem: GNUnet-FS |
43 | 52 | ||
44 | Number: 5 | 53 | Number: 5 |
45 | Name: PEER_PLACEMENT | 54 | Name: PEER_PLACEMENT |
46 | Comment: Signature by which a peer affirms that it is providing a certain bit of content for use in LOCation URIs. | 55 | Comment: Signature by which a peer affirms that it is providing a certain bit of content for use in LOCation URIs. |
56 | Package: GNUnet | ||
47 | Subsystem: GNUnet-FS | 57 | Subsystem: GNUnet-FS |
48 | 58 | ||
49 | Number: 6 | 59 | Number: 6 |
50 | Name: DHT_HOP | 60 | Name: DHT_HOP |
51 | Comment: Signature by which a peer affirms that it forwarded a message in the DHT. | 61 | Comment: Signature by which a peer affirms that it forwarded a message in the DHT. |
62 | Package: GNUnet | ||
52 | Subsystem: GNUnet-DHT | 63 | Subsystem: GNUnet-DHT |
53 | 64 | ||
54 | Number: 7 | 65 | Number: 7 |
55 | Name: HELLO | 66 | Name: HELLO |
56 | Comment: Signature by which a peer affirms its address. | 67 | Comment: Signature by which a peer affirms its address. |
68 | Package: GNUnet | ||
57 | Subsystem: GNUnet-HELLO | 69 | Subsystem: GNUnet-HELLO |
58 | 70 | ||
59 | |||
60 | Number: 11 | 71 | Number: 11 |
61 | Name: DNS_RECORD | 72 | Name: DNS_RECORD |
62 | Comment: Signature on a GNUNET_DNS_Advertisement. | 73 | Comment: Signature on a GNUNET_DNS_Advertisement. |
74 | Package: GNUnet | ||
63 | Subsystem: GNUnet-DNS+Exit | 75 | Subsystem: GNUnet-DNS+Exit |
64 | 76 | ||
65 | Number: 12 | 77 | Number: 12 |
66 | Name: CHAT_MESSAGE | 78 | Name: CHAT_MESSAGE |
67 | Comment: Signature of a chat message. | 79 | Comment: Signature of a chat message. |
80 | Package: GNUnet | ||
68 | Subsystem: GNUnet-MESSENGER | 81 | Subsystem: GNUnet-MESSENGER |
69 | 82 | ||
70 | Number: 13 | 83 | Number: 13 |
71 | Name: CHAT_RECEIPT | 84 | Name: CHAT_RECEIPT |
72 | Comment: Signature of confirmation receipt for a chat message. | 85 | Comment: Signature of confirmation receipt for a chat message. |
86 | Package: GNUnet | ||
73 | Subsystem: GNUnet-MESSENGER | 87 | Subsystem: GNUnet-MESSENGER |
74 | 88 | ||
75 | Number: 14 | 89 | Number: 14 |
76 | Name: NSE_SEND | 90 | Name: NSE_SEND |
77 | Comment: Signature of a network size estimate message. | 91 | Comment: Signature of a network size estimate message. |
92 | Package: GNUnet | ||
78 | Subsystem: GNUnet-NSE | 93 | Subsystem: GNUnet-NSE |
79 | 94 | ||
80 | Number: 15 | 95 | Number: 15 |
81 | Name: GNS_RECORD_SIGN | 96 | Name: GNS_RECORD_SIGN |
82 | Comment: Signature of a gnunet naming system record block | 97 | Comment: Signature of a gnunet naming system record block |
98 | Package: GNUnet | ||
83 | Subsystem: GNUnet-GNSRECORD | 99 | Subsystem: GNUnet-GNSRECORD |
84 | 100 | ||
85 | Number: 16 | 101 | Number: 16 |
86 | Name: SET_ECC_KEY | 102 | Name: SET_ECC_KEY |
87 | Comment: Purpose is to set a session key. | 103 | Comment: Purpose is to set a session key. |
104 | Package: GNUnet | ||
88 | Subsystem: GNUnet-CORE | 105 | Subsystem: GNUnet-CORE |
89 | 106 | ||
90 | Number: 17 | 107 | Number: 17 |
91 | Name: FS_UBLOCK | 108 | Name: FS_UBLOCK |
92 | Comment: UBlock Signature, done using DSS, not ECC | 109 | Comment: UBlock Signature, done using DSS, not ECC |
110 | Package: GNUnet | ||
93 | Subsystem: GNUnet-FS | 111 | Subsystem: GNUnet-FS |
94 | 112 | ||
95 | Number: 18 | 113 | Number: 18 |
96 | Name: REGEX_ACCEPT | 114 | Name: REGEX_ACCEPT |
97 | Comment: Accept state in regex DFA. Peer affirms that it offers the matching service. | 115 | Comment: Accept state in regex DFA. Peer affirms that it offers the matching service. |
116 | Package: GNUnet | ||
98 | Subsystem: GNUnet-REGEX | 117 | Subsystem: GNUnet-REGEX |
99 | 118 | ||
100 | Number: 20 | 119 | Number: 20 |
101 | Name: CONVERSATION_RING | 120 | Name: CONVERSATION_RING |
102 | Comment: Signature of a conversation ring. | 121 | Comment: Signature of a conversation ring. |
122 | Package: GNUnet | ||
103 | Subsystem: GNUnet-CONVERSATION | 123 | Subsystem: GNUnet-CONVERSATION |
104 | 124 | ||
105 | Number: 21 | 125 | Number: 21 |
106 | Name: SECRETSHARING_DKG1 | 126 | Name: SECRETSHARING_DKG1 |
107 | Comment: Signature for the first round of distributed key generation. | 127 | Comment: Signature for the first round of distributed key generation. |
128 | Package: GNUnet | ||
108 | Subsystem: GNUnet-SECRETSHARING | 129 | Subsystem: GNUnet-SECRETSHARING |
109 | 130 | ||
110 | Number: 22 | 131 | Number: 22 |
111 | Name: SECRETSHARING_DKG2 | 132 | Name: SECRETSHARING_DKG2 |
112 | Comment: Signature for the second round of distributed key generation. | 133 | Comment: Signature for the second round of distributed key generation. |
134 | Package: GNUnet | ||
113 | Subsystem: GNUnet-SECRETSHARING | 135 | Subsystem: GNUnet-SECRETSHARING |
114 | 136 | ||
115 | Number: 23 | 137 | Number: 23 |
116 | Name: SECRETSHARING_DECRYPTION | 138 | Name: SECRETSHARING_DECRYPTION |
117 | Comment: Signature for the cooperative decryption. | 139 | Comment: Signature for the cooperative decryption. |
140 | Package: GNUnet | ||
118 | Subsystem: GNUnet-SECRETSHARING | 141 | Subsystem: GNUnet-SECRETSHARING |
119 | 142 | ||
120 | Number: 27 | 143 | Number: 27 |
121 | Name: RECLAIM_CODE_SIGN | 144 | Name: RECLAIM_CODE_SIGN |
122 | Comment: Signature for a GNUid Ticket | 145 | Comment: Signature for a GNUid Ticket |
146 | Package: GNUnet | ||
123 | Subsystem: Reclaim | 147 | Subsystem: Reclaim |
124 | 148 | ||
125 | Number: 28 | 149 | Number: 28 |
126 | Name: DELEGATE | 150 | Name: DELEGATE |
127 | Comment: Signature for a GNUnet credential | 151 | Comment: Signature for a GNUnet credential |
152 | Package: GNUnet | ||
128 | Subsystem: Reclaim | 153 | Subsystem: Reclaim |
129 | 154 | ||
130 | Number: 29 | 155 | Number: 29 |
131 | Name: TRANSPORT_ADDRESS | 156 | Name: TRANSPORT_ADDRESS |
132 | Comment: Signature by a peer affirming that this is one of its addresses for the given time period. | 157 | Comment: Signature by a peer affirming that this is one of its addresses for the given time period. |
158 | Package: GNUnet | ||
133 | Subsystem: GNUnet-TRANSPORT | 159 | Subsystem: GNUnet-TRANSPORT |
134 | 160 | ||
135 | Number: 30 | 161 | Number: 30 |
136 | Name: TRANSPORT_EPHEMERAL | 162 | Name: TRANSPORT_EPHEMERAL |
137 | Comment: Signature by a peer affirming that the given ephemeral key is currently in use by that peer's transport service. | 163 | Comment: Signature by a peer affirming that the given ephemeral key is currently in use by that peer's transport service. |
164 | Package: GNUnet | ||
138 | Subsystem: GNUnet-TRANSPORT | 165 | Subsystem: GNUnet-TRANSPORT |
139 | 166 | ||
140 | Number: 31 | 167 | Number: 31 |
141 | Name: COMMUNICATOR_TCP_HANDSHAKE | 168 | Name: COMMUNICATOR_TCP_HANDSHAKE |
142 | Comment: Signature used by TCP communicator handshake. | 169 | Comment: Signature used by TCP communicator handshake. |
170 | Package: GNUnet | ||
143 | Subsystem: GNUnet-TRANSPORT-TCP | 171 | Subsystem: GNUnet-TRANSPORT-TCP |
144 | 172 | ||
145 | Number: 32 | 173 | Number: 32 |
146 | Name: COMMUNICATOR_TCP_REKEY | 174 | Name: COMMUNICATOR_TCP_REKEY |
147 | Comment: Signature used by TCP communicator rekey. | 175 | Comment: Signature used by TCP communicator rekey. |
176 | Package: GNUnet | ||
148 | Subsystem: GNUnet-TRANSPORT-TCP | 177 | Subsystem: GNUnet-TRANSPORT-TCP |
149 | 178 | ||
150 | Number: 33 | 179 | Number: 33 |
151 | Name: COMMUNICATOR_UDP_HANDSHAKE | 180 | Name: COMMUNICATOR_UDP_HANDSHAKE |
152 | Comment: Signature used by UDP communicator handshake. | 181 | Comment: Signature used by UDP communicator handshake. |
182 | Package: GNUnet | ||
153 | Subsystem: GNUnet-TRANSPORT-UDP | 183 | Subsystem: GNUnet-TRANSPORT-UDP |
154 | 184 | ||
155 | Number: 34 | 185 | Number: 34 |
156 | Name: COMMUNICATOR_UDP_BROADCAST | 186 | Name: COMMUNICATOR_UDP_BROADCAST |
157 | Comment: Signature used by UDP broadcasts. | 187 | Comment: Signature used by UDP broadcasts. |
188 | Package: GNUnet | ||
158 | Subsystem: GNUnet-TRANSPORT-UDP | 189 | Subsystem: GNUnet-TRANSPORT-UDP |
159 | 190 | ||
160 | Number: 35 | 191 | Number: 35 |
161 | Name: TRANSPORT_CHALLENGE | 192 | Name: TRANSPORT_CHALLENGE |
162 | Comment: Signature by a peer affirming that it received a challenge (and stating how long it expects the address on which the challenge was received to remain valid). | 193 | Comment: Signature by a peer affirming that it received a challenge (and stating how long it expects the address on which the challenge was received to remain valid). |
194 | Package: GNUnet | ||
163 | Subsystem: GNUnet-TRANSPORT | 195 | Subsystem: GNUnet-TRANSPORT |
164 | 196 | ||
165 | Number: 36 | 197 | Number: 36 |
166 | Name: TRANSPORT_DV_HOP | 198 | Name: TRANSPORT_DV_HOP |
167 | Comment: Signature by a peer affirming that it is on a DV path. | 199 | Comment: Signature by a peer affirming that it is on a DV path. |
200 | Package: GNUnet | ||
168 | Subsystem: GNUnet-TRANSPORT | 201 | Subsystem: GNUnet-TRANSPORT |
169 | 202 | ||
170 | Number: 37 | 203 | Number: 37 |
171 | Name: TRANSPORT_DV_INITIATOR | 204 | Name: TRANSPORT_DV_INITIATOR |
172 | Comment: Signature by a peer affirming that it originated the DV path. | 205 | Comment: Signature by a peer affirming that it originated the DV path. |
206 | Package: GNUnet | ||
173 | Subsystem: GNUnet-TRANSPORT | 207 | Subsystem: GNUnet-TRANSPORT |
174 | 208 | ||
175 | Number: 38 | 209 | Number: 38 |
176 | Name: CADET_CONNECTION_INITIATOR | 210 | Name: CADET_CONNECTION_INITIATOR |
177 | Comment: Signature by a peer that like to create a connection. | 211 | Comment: Signature by a peer that like to create a connection. |
212 | Package: GNUnet | ||
178 | Subsystem: GNUnet-CADET | 213 | Subsystem: GNUnet-CADET |
179 | 214 | ||
180 | Number: 39 | 215 | Number: 39 |
181 | Name: COMMUNICATOR_TCP_HANDSHAKE_ACK | 216 | Name: COMMUNICATOR_TCP_HANDSHAKE_ACK |
182 | Comment: Signature by a peer sending back the nonce received at initial handshake. | 217 | Comment: Signature by a peer sending back the nonce received at initial handshake. |
218 | Package: GNUnet | ||
183 | Subsystem: GNUnet-TRANSPORT-TCP | 219 | Subsystem: GNUnet-TRANSPORT-TCP |
220 | |||
221 | #----------------------------------------------------------------------------- | ||
222 | # GNU Taler, >= 1000 | ||
223 | |||
224 | # | ||
225 | # Exchange offline signatures (with master key) | ||
226 | # | ||
227 | Number: 1018 | ||
228 | Name: MASTER_DRAIN_PROFIT | ||
229 | Comment: Affirm wiring of exchange profits to operator account. | ||
230 | Package: GNU Taler | ||
231 | |||
232 | Number: 1019 | ||
233 | Name: MASTER_PARTNER_DETAILS | ||
234 | Comment: Signature affirming a partner configuration for wads. | ||
235 | Package: GNU Taler | ||
236 | |||
237 | Number: 1020 | ||
238 | Name: MASTER_SIGNING_KEY_REVOKED | ||
239 | Comment: The given revocation key was revoked and must no longer be used. | ||
240 | Package: GNU Taler | ||
241 | |||
242 | Number: 1021 | ||
243 | Name: MASTER_ADD_WIRE | ||
244 | Comment: Add payto URI to the list of our wire methods. | ||
245 | Package: GNU Taler | ||
246 | |||
247 | Number: 1022 | ||
248 | Name: MASTER_GLOBAL_FEES | ||
249 | Comment: Signature over global set of fees charged by the exchange. | ||
250 | Package: GNU Taler | ||
251 | |||
252 | Number: 1023 | ||
253 | Name: MASTER_DEL_WIRE | ||
254 | Comment: Remove payto URI from the list of our wire methods. | ||
255 | Package: GNU Taler | ||
256 | |||
257 | Number: 1024 | ||
258 | Name: MASTER_SIGNING_KEY_VALIDITY | ||
259 | Comment: Purpose for signing public keys signed by the exchange master key. | ||
260 | Package: GNU Taler | ||
261 | |||
262 | Number: 1025 | ||
263 | Name: MASTER_DENOMINATION_KEY_VALIDITY | ||
264 | Comment: Purpose for denomination keys signed by the exchange master key. | ||
265 | Package: GNU Taler | ||
266 | |||
267 | Number: 1026 | ||
268 | Name: MASTER_ADD_AUDITOR | ||
269 | Comment: Add an auditor to the list of our auditors. | ||
270 | Package: GNU Taler | ||
271 | |||
272 | Number: 1027 | ||
273 | Name: MASTER_DEL_AUDITOR | ||
274 | Comment: Remove an auditor from the list of our auditors. | ||
275 | Package: GNU Taler | ||
276 | |||
277 | Number: 1028 | ||
278 | Name: MASTER_WIRE_FEES | ||
279 | Comment: Fees charged per (aggregate) wire transfer to the merchant. | ||
280 | Package: GNU Taler | ||
281 | |||
282 | Number: 1029 | ||
283 | Name: MASTER_DENOMINATION_KEY_REVOKED | ||
284 | Comment: The given revocation key was revoked and must no longer be used. | ||
285 | Package: GNU Taler | ||
286 | |||
287 | Number: 1030 | ||
288 | Name: MASTER_WIRE_DETAILS | ||
289 | Comment: Signature where the Exchange confirms its IBAN details in the /wire response. | ||
290 | Package: GNU Taler | ||
291 | |||
292 | Number: 1031 | ||
293 | Name: MASTER_EXTENSION | ||
294 | Comment: Set the configuration of an extension (age-restriction or peer2peer) | ||
295 | Package: GNU Taler | ||
296 | |||
297 | |||
298 | # | ||
299 | # Exchange online signatures (with signing key) | ||
300 | # | ||
301 | |||
302 | Number: 1032 | ||
303 | Name: EXCHANGE_RESERVE_STATUS | ||
304 | Comment: Purpose for the state of a reserve, signed by the exchange's signing key. | ||
305 | Package: GNU Taler | ||
306 | |||
307 | Number: 1033 | ||
308 | Name: EXCHANGE_CONFIRM_DEPOSIT | ||
309 | Comment: Signature where the Exchange confirms a deposit request. | ||
310 | Package: GNU Taler | ||
311 | |||
312 | Number: 1034 | ||
313 | Name: EXCHANGE_CONFIRM_MELT | ||
314 | Comment: Signature where the exchange (current signing key) confirms the no-reveal index for cut-and-choose and the validity of the melted coins. | ||
315 | Package: GNU Taler | ||
316 | |||
317 | Number: 1035 | ||
318 | Name: EXCHANGE_KEY_SET | ||
319 | Comment: Signature where the Exchange confirms the full /keys response set. | ||
320 | Package: GNU Taler | ||
321 | |||
322 | Number: 1036 | ||
323 | Name: EXCHANGE_CONFIRM_WIRE | ||
324 | Comment: Signature where the Exchange confirms the /track/transaction response. | ||
325 | Package: GNU Taler | ||
326 | |||
327 | Number: 1037 | ||
328 | Name: EXCHANGE_CONFIRM_WIRE_DEPOSIT | ||
329 | Comment: Signature where the Exchange confirms the /wire/deposit response. | ||
330 | Package: GNU Taler | ||
331 | |||
332 | Number: 1038 | ||
333 | Name: EXCHANGE_CONFIRM_REFUND | ||
334 | Comment: Signature where the Exchange confirms a refund request. | ||
335 | Package: GNU Taler | ||
336 | |||
337 | Number: 1039 | ||
338 | Name: EXCHANGE_CONFIRM_RECOUP | ||
339 | Comment: Signature where the Exchange confirms a recoup. | ||
340 | Package: GNU Taler | ||
341 | |||
342 | Number: 1040 | ||
343 | Name: EXCHANGE_RESERVE_CLOSED | ||
344 | Comment: Signature where the Exchange confirms it closed a reserve. | ||
345 | Package: GNU Taler | ||
346 | |||
347 | Number: 1041 | ||
348 | Name: EXCHANGE_CONFIRM_RECOUP_REFRESH | ||
349 | Comment: Signature where the Exchange confirms a recoup-refresh operation. | ||
350 | Package: GNU Taler | ||
351 | |||
352 | Number: 1042 | ||
353 | Name: EXCHANGE_AFFIRM_DENOM_UNKNOWN | ||
354 | Comment: Signature where the Exchange confirms that it does not know a denomination (hash). | ||
355 | Package: GNU Taler | ||
356 | |||
357 | Number: 1043 | ||
358 | Name: EXCHANGE_AFFIRM_DENOM_EXPIRED | ||
359 | Comment: Signature where the Exchange confirms that it does not consider a denomination valid for the given operation at this time. | ||
360 | Package: GNU Taler | ||
361 | |||
362 | Number: 1044 | ||
363 | Name: EXCHANGE_ACCOUNT_SETUP_SUCCESS | ||
364 | Comment: Signature by which an exchange affirms that an account successfully passed the KYC checks. | ||
365 | Package: GNU Taler | ||
366 | |||
367 | Number: 1045 | ||
368 | Name: EXCHANGE_CONFIRM_PURSE_CREATION | ||
369 | Comment: Signature by which the exchange affirms that a purse was created with a certain amount deposited into it. | ||
370 | Package: GNU Taler | ||
371 | |||
372 | Number: 1046 | ||
373 | Name: EXCHANGE_CONFIRM_PURSE_MERGED | ||
374 | Comment: Signature by which the exchange affirms that a purse was merged into a reserve with a certain amount in it. | ||
375 | Package: GNU Taler | ||
376 | |||
377 | Number: 1047 | ||
378 | Name: EXCHANGE_PURSE_STATUS | ||
379 | Comment: Purpose for the state of a purse, signed by the exchange's signing key. | ||
380 | Package: GNU Taler | ||
381 | |||
382 | Number: 1048 | ||
383 | Name: EXCHANGE_RESERVE_ATTEST_DETAILS | ||
384 | Comment: Signature by which the exchange attests identity attributes of a particular reserve owner. | ||
385 | Package: GNU Taler | ||
386 | |||
387 | Number: 1049 | ||
388 | Name: EXCHANGE_CONFIRM_PURSE_REFUND | ||
389 | Comment: Signature by which the exchange confirms that a purse expired and a coin was refunded. | ||
390 | Package: GNU Taler | ||
391 | |||
392 | # | ||
393 | # Auditor signatures | ||
394 | # | ||
395 | |||
396 | Number: 1064 | ||
397 | Name: AUDITOR_EXCHANGE_KEYS | ||
398 | Comment: Signature where the auditor confirms that he is aware of certain denomination keys from the exchange. | ||
399 | Package: GNU Taler | ||
400 | |||
401 | # | ||
402 | # Merchant signatures | ||
403 | # | ||
404 | |||
405 | Number: 1101 | ||
406 | Name: MERCHANT_CONTRACT | ||
407 | Comment: Signature where the merchant confirms a contract (to the customer). | ||
408 | Package: GNU Taler | ||
409 | |||
410 | Number: 1102 | ||
411 | Name: MERCHANT_REFUND | ||
412 | Comment: Signature where the merchant confirms a refund (of a coin). | ||
413 | Package: GNU Taler | ||
414 | |||
415 | Number: 1103 | ||
416 | Name: MERCHANT_TRACK_TRANSACTION | ||
417 | Comment: Signature where the merchant confirms that he needs the wire transfer identifier for a deposit operation. | ||
418 | Package: GNU Taler | ||
419 | |||
420 | Number: 1104 | ||
421 | Name: MERCHANT_PAYMENT_OK | ||
422 | Comment: Signature where the merchant confirms that the payment was successful | ||
423 | Package: GNU Taler | ||
424 | |||
425 | Number: 1107 | ||
426 | Name: MERCHANT_WIRE_DETAILS | ||
427 | Comment: Signature where the merchant confirms its own (salted) wire details (not yet really used). | ||
428 | Package: GNU Taler | ||
429 | |||
430 | # | ||
431 | # Wallet signatures | ||
432 | # | ||
433 | |||
434 | Number: 1200 | ||
435 | Name: WALLET_RESERVE_WITHDRAW | ||
436 | Comment: Signature where the reserve key confirms a withdraw request. Signed with the reserve private key. | ||
437 | Package: GNU Taler | ||
438 | |||
439 | Number: 1201 | ||
440 | Name: WALLET_COIN_DEPOSIT | ||
441 | Comment: Signature made by the wallet of a user to confirm a deposit of a coin. | ||
442 | Package: GNU Taler | ||
443 | |||
444 | Number: 1202 | ||
445 | Name: WALLET_COIN_MELT | ||
446 | Comment: Signature using a coin key confirming the melting of a coin. Signed with the coin's private key. | ||
447 | Package: GNU Taler | ||
448 | |||
449 | Number: 1203 | ||
450 | Name: WALLET_COIN_RECOUP | ||
451 | Comment: Signature using a coin key requesting recoup. Signed with the coin's private key. | ||
452 | Package: GNU Taler | ||
453 | |||
454 | Number: 1204 | ||
455 | Name: WALLET_COIN_LINK | ||
456 | Comment: Signature using a coin key authenticating link data. Signed with the old coin's private key. | ||
457 | Package: GNU Taler | ||
458 | |||
459 | Number: 1205 | ||
460 | Name: WALLET_ACCOUNT_SETUP | ||
461 | Comment: Signature using a reserve key by which a wallet requests a payment target UUID for itself. Signs over just a purpose (no body), as the signature only serves to demonstrate that the request comes from the wallet controlling the private key, and not some third party. | ||
462 | Package: GNU Taler | ||
463 | |||
464 | Number: 1206 | ||
465 | Name: WALLET_COIN_RECOUP_REFRESH | ||
466 | Comment: Signature using a coin key requesting recoup-refresh. Signed with the coin private key. | ||
467 | Package: GNU Taler | ||
468 | |||
469 | Number: 1207 | ||
470 | Name: WALLET_AGE_ATTESTATION | ||
471 | Comment: Signature using a age restriction key for attestation of a particular age/age-group. | ||
472 | Package: GNU Taler | ||
473 | |||
474 | Number: 1208 | ||
475 | Name: WALLET_RESERVE_HISTORY | ||
476 | Comment: Request full reserve history and pay for it. Signed with the reserve private key. | ||
477 | Package: GNU Taler | ||
478 | |||
479 | Number: 1209 | ||
480 | Name: WALLET_RESERVE_STATUS | ||
481 | Comment: Request detailed account status (for free). Signed with the reserve private key. | ||
482 | Package: GNU Taler | ||
483 | |||
484 | Number: 1210 | ||
485 | Name: WALLET_PURSE_CREATE | ||
486 | Comment: Request purse creation (without reserve). Signed by the purse private key. | ||
487 | Package: GNU Taler | ||
488 | |||
489 | Number: 1211 | ||
490 | Name: WALLET_PURSE_DEPOSIT | ||
491 | Comment: Request coin to be deposited into a purse. Signed with the coin private key. | ||
492 | Package: GNU Taler | ||
493 | |||
494 | Number: 1212 | ||
495 | Name: WALLET_PURSE_STATUS | ||
496 | Comment: Request purse status. Signed with the purse private key. | ||
497 | Package: GNU Taler | ||
498 | |||
499 | Number: 1213 | ||
500 | Name: WALLET_PURSE_MERGE | ||
501 | Comment: Request purse to be merged with a reserve. Signed with the purse private key. | ||
502 | Package: GNU Taler | ||
503 | |||
504 | Number: 1214 | ||
505 | Name: WALLET_ACCOUNT_MERGE | ||
506 | Comment: Request purse to be merged with a reserve. Signed by the reserve private key. | ||
507 | Package: GNU Taler | ||
508 | |||
509 | Number: 1215 | ||
510 | Name: WALLET_RESERVE_CLOSE | ||
511 | Comment: Request account to be closed. Signed with the reserve private key. | ||
512 | Package: GNU Taler | ||
513 | |||
514 | Number: 1216 | ||
515 | Name: WALLET_PURSE_ECONTRACT | ||
516 | Comment: Associates encrypted contract with a purse. Signed with the purse private key. | ||
517 | Package: GNU Taler | ||
518 | |||
519 | Number: 1217 | ||
520 | Name: WALLET_RESERVE_OPEN | ||
521 | Comment: Request reserve to be kept open. Signed with the reserve private key. | ||
522 | Package: GNU Taler | ||
523 | |||
524 | Number: 1218 | ||
525 | Name: WALLET_RESERVE_OPEN_DEPOSIT | ||
526 | Comment: Request coin to be used to pay for reserve to be kept open. Signed with the coin private key. | ||
527 | Package: GNU Taler | ||
528 | |||
529 | Number: 1219 | ||
530 | Name: WALLET_RESERVE_ATTEST_DETAILS | ||
531 | Comment: Request attestation about reserve owner. Signed by the reserve private key. | ||
532 | Package: GNU Taler | ||
533 | |||
534 | # | ||
535 | # Security module signatures | ||
536 | # | ||
537 | |||
538 | Number: 1250 | ||
539 | Name: SM_RSA_DENOMINATION_KEY | ||
540 | Comment: Signature on a denomination key announcement. | ||
541 | Package: GNU Taler | ||
542 | |||
543 | Number: 1251 | ||
544 | Name: SM_SIGNING_KEY | ||
545 | Comment: Signature on an exchange message signing key announcement. | ||
546 | Package: GNU Taler | ||
547 | |||
548 | Number: 1252 | ||
549 | Name: SM_CS_DENOMINATION_KEY | ||
550 | Comment: Signature on a denomination key announcement. | ||
551 | Package: GNU Taler | ||
552 | |||
553 | # | ||
554 | # Test signatures | ||
555 | # | ||
556 | |||
557 | Number: 1302 | ||
558 | Name: CLIENT_TEST_EDDSA | ||
559 | Comment: EdDSA test signature. | ||
560 | Package: GNU Taler | ||
561 | |||
562 | Number: 1303 | ||
563 | Name: EXCHANGE_TEST_EDDSA | ||
564 | Comment: EdDSA test signature. | ||
565 | Package: GNU Taler | ||
566 | |||
567 | # | ||
568 | # GNU Anastasis signatures, >= 1400 | ||
569 | # | ||
570 | |||
571 | Number: 1400 | ||
572 | Name: ANASTASIS_POLICY_UPLOAD | ||
573 | Comment: EdDSA signature for a policy upload. | ||
574 | Package: GNU Taler | ||
575 | |||
576 | # | ||
577 | # Sync signatures, >= 1450 | ||
578 | # | ||
579 | |||
580 | Number: 1450 | ||
581 | Name: SYNC_BACKUP_UPLOAD | ||
582 | Comment: EdDSA signature for a backup upload. | ||
583 | Package: GNU Taler | ||
diff --git a/src/gnunet/enums/messages.go b/src/gnunet/enums/messages.go index ca76d3a..400888a 100644 --- a/src/gnunet/enums/messages.go +++ b/src/gnunet/enums/messages.go | |||
@@ -367,27 +367,31 @@ const ( | |||
367 | // NAMESTORE message types | 367 | // NAMESTORE message types |
368 | //------------------------------------------------------------------ | 368 | //------------------------------------------------------------------ |
369 | 369 | ||
370 | MSG_NAMESTORE_RECORD_STORE MsgType = 435 // Client to service: store records (as authority) | 370 | MSG_NAMESTORE_RECORD_STORE MsgType = 435 // Client to service: store records (as authority) |
371 | MSG_NAMESTORE_RECORD_STORE_RESPONSE MsgType = 436 // Service to client: result of store operation. | 371 | MSG_NAMESTORE_RECORD_STORE_RESPONSE MsgType = 436 // Service to client: result of store operation. |
372 | MSG_NAMESTORE_RECORD_LOOKUP MsgType = 437 // Client to service: lookup label | 372 | MSG_NAMESTORE_RECORD_LOOKUP MsgType = 437 // Client to service: lookup label |
373 | MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE MsgType = 438 // Service to client: lookup label | 373 | MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE MsgType = 438 // Service to client: lookup label |
374 | MSG_NAMESTORE_ZONE_TO_NAME MsgType = 439 // Client to service: "reverse" lookup for zone name based on zone key | 374 | MSG_NAMESTORE_ZONE_TO_NAME MsgType = 439 // Client to service: "reverse" lookup for zone name based on zone key |
375 | MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE MsgType = 440 // Service to client: result of zone-to-name lookup. | 375 | MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE MsgType = 440 // Service to client: result of zone-to-name lookup. |
376 | MSG_NAMESTORE_MONITOR_START MsgType = 441 // Client to service: start monitoring (yields sequence of "ZONE_ITERATION_RESPONSES" --- forever). | 376 | MSG_NAMESTORE_MONITOR_START MsgType = 441 // Client to service: start monitoring (yields sequence of "ZONE_ITERATION_RESPONSES" --- forever). |
377 | MSG_NAMESTORE_MONITOR_SYNC MsgType = 442 // Service to client: you're now in sync. | 377 | MSG_NAMESTORE_MONITOR_SYNC MsgType = 442 // Service to client: you're now in sync. |
378 | MSG_NAMESTORE_RECORD_RESULT MsgType = 443 // Service to client: here is a (plaintext) record you requested. | 378 | MSG_NAMESTORE_RECORD_RESULT MsgType = 443 // Service to client: here is a (plaintext) record you requested. |
379 | MSG_NAMESTORE_MONITOR_NEXT MsgType = 444 // Client to service: I am now ready for the next (set of) monitor events. Monitoring equivalent of #NAMESTORE_ZONE_ITERATION_NEXT. | 379 | MSG_NAMESTORE_MONITOR_NEXT MsgType = 444 // Client to service: I am now ready for the next (set of) monitor events. Monitoring equivalent of #NAMESTORE_ZONE_ITERATION_NEXT. |
380 | MSG_NAMESTORE_ZONE_ITERATION_START MsgType = 445 // Client to service: please start iteration; receives "NAMESTORE_LOOKUP_NAME_RESPONSE" messages in return. | 380 | MSG_NAMESTORE_ZONE_ITERATION_START MsgType = 445 // Client to service: please start iteration; receives "NAMESTORE_LOOKUP_NAME_RESPONSE" messages in return. |
381 | MSG_NAMESTORE_ZONE_ITERATION_NEXT MsgType = 447 // Client to service: next record(s) in iteration please. | 381 | MSG_NAMESTORE_ZONE_ITERATION_NEXT MsgType = 447 // Client to service: next record(s) in iteration please. |
382 | MSG_NAMESTORE_ZONE_ITERATION_STOP MsgType = 448 // Client to service: stop iterating. | 382 | MSG_NAMESTORE_ZONE_ITERATION_STOP MsgType = 448 // Client to service: stop iterating. |
383 | MSG_NAMESTORE_ZONE_ITERATION_END MsgType = 449 // Service to client: done iterating. | ||
384 | MSG_NAMESTORE_TX_CONTROL MsgType = 1750 // Begin, Commit or Rollback | ||
385 | MSG_NAMESTORE_TX_CONTROL_RESULT MsgType = 1751 // status message for control message | ||
386 | MSG_NAMESTORE_RECORD_EDIT MsgType = 1752 // open and lock records for editing message | ||
383 | 387 | ||
384 | //------------------------------------------------------------------ | 388 | //------------------------------------------------------------------ |
385 | // LOCKMANAGER message types | 389 | // LOCKMANAGER message types |
386 | //------------------------------------------------------------------ | 390 | //------------------------------------------------------------------ |
387 | 391 | ||
388 | MSG_LOCKMANAGER_ACQUIREMsgType = 450 // Message to acquire Lock | 392 | MSG_LOCKMANAGER_ACQUIREMsgType MsgType = 450 // Message to acquire Lock |
389 | MSG_LOCKMANAGER_RELEASEMsgType = 451 // Message to release lock | 393 | MSG_LOCKMANAGER_RELEASEMsgType MsgType = 451 // Message to release lock |
390 | MSG_LOCKMANAGER_SUCCESSMsgType = 452 // SUCCESS reply from lockmanager | 394 | MSG_LOCKMANAGER_SUCCESSMsgType MsgType = 452 // SUCCESS reply from lockmanager |
391 | 395 | ||
392 | //------------------------------------------------------------------ | 396 | //------------------------------------------------------------------ |
393 | // TESTBED message types | 397 | // TESTBED message types |
diff --git a/src/gnunet/enums/msgtype_string.go b/src/gnunet/enums/msgtype_string.go index bab1e22..2d2b308 100644 --- a/src/gnunet/enums/msgtype_string.go +++ b/src/gnunet/enums/msgtype_string.go | |||
@@ -232,6 +232,13 @@ func _() { | |||
232 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_START-445] | 232 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_START-445] |
233 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_NEXT-447] | 233 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_NEXT-447] |
234 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_STOP-448] | 234 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_STOP-448] |
235 | _ = x[MSG_NAMESTORE_ZONE_ITERATION_END-449] | ||
236 | _ = x[MSG_NAMESTORE_TX_CONTROL-1750] | ||
237 | _ = x[MSG_NAMESTORE_TX_CONTROL_RESULT-1751] | ||
238 | _ = x[MSG_NAMESTORE_RECORD_EDIT-1752] | ||
239 | _ = x[MSG_LOCKMANAGER_ACQUIREMsgType-450] | ||
240 | _ = x[MSG_LOCKMANAGER_RELEASEMsgType-451] | ||
241 | _ = x[MSG_LOCKMANAGER_SUCCESSMsgType-452] | ||
235 | _ = x[MSG_TESTBED_INIT-460] | 242 | _ = x[MSG_TESTBED_INIT-460] |
236 | _ = x[MSG_TESTBED_ADD_HOST-461] | 243 | _ = x[MSG_TESTBED_ADD_HOST-461] |
237 | _ = x[MSG_TESTBED_ADD_HOST_SUCCESS-462] | 244 | _ = x[MSG_TESTBED_ADD_HOST_SUCCESS-462] |
@@ -556,7 +563,7 @@ func _() { | |||
556 | _ = x[MSG_ALL-65535] | 563 | _ = x[MSG_ALL-65535] |
557 | } | 564 | } |
558 | 565 | ||
559 | const _MsgType_name = "MSG_TESTMSG_DUMMYMSG_DUMMY2MSG_RESOLVER_REQUESTMSG_RESOLVER_RESPONSEMSG_REQUEST_AGPLMSG_RESPONSE_AGPLMSG_ARM_STARTMSG_ARM_STOPMSG_ARM_RESULTMSG_ARM_STATUSMSG_ARM_LISTMSG_ARM_LIST_RESULTMSG_ARM_MONITORMSG_ARM_TESTMSG_HELLO_LEGACYMSG_HELLOMSG_FRAGMENTMSG_FRAGMENT_ACKMSG_WLAN_DATA_TO_HELPERMSG_WLAN_DATA_FROM_HELPERMSG_WLAN_HELPER_CONTROLMSG_WLAN_ADVERTISEMENTMSG_WLAN_DATAMSG_DV_RECVMSG_DV_SENDMSG_DV_SEND_ACKMSG_DV_ROUTEMSG_DV_STARTMSG_DV_CONNECTMSG_DV_DISCONNECTMSG_DV_SEND_NACKMSG_DV_DISTANCE_CHANGEDMSG_DV_BOXMSG_TRANSPORT_XU_MESSAGEMSG_TRANSPORT_UDP_MESSAGEMSG_TRANSPORT_UDP_ACKMSG_TRANSPORT_TCP_NAT_PROBEMSG_TRANSPORT_TCP_WELCOMEMSG_TRANSPORT_ATSMSG_NAT_TESTMSG_CORE_INITMSG_CORE_INIT_REPLYMSG_CORE_NOTIFY_CONNECTMSG_CORE_NOTIFY_DISCONNECTMSG_CORE_NOTIFY_STATUS_CHANGEMSG_CORE_NOTIFY_INBOUNDMSG_CORE_NOTIFY_OUTBOUNDMSG_CORE_SEND_REQUESTMSG_CORE_SEND_READYMSG_CORE_SENDMSG_CORE_MONITOR_PEERSMSG_CORE_MONITOR_NOTIFYMSG_CORE_ENCRYPTED_MESSAGEMSG_CORE_PINGMSG_CORE_PONGMSG_CORE_HANGUPMSG_CORE_COMPRESSED_TYPE_MAPMSG_CORE_BINARY_TYPE_MAPMSG_CORE_EPHEMERAL_KEYMSG_CORE_CONFIRM_TYPE_MAPMSG_DATASTORE_RESERVEMSG_DATASTORE_RELEASE_RESERVEMSG_DATASTORE_STATUSMSG_DATASTORE_PUTMSG_DATASTORE_GETMSG_DATASTORE_GET_REPLICATIONMSG_DATASTORE_GET_ZERO_ANONYMITYMSG_DATASTORE_DATAMSG_DATASTORE_DATA_ENDMSG_DATASTORE_REMOVEMSG_DATASTORE_DROPMSG_DATASTORE_GET_KEYMSG_FS_REQUEST_LOC_SIGNMSG_FS_REQUEST_LOC_SIGNATUREMSG_FS_INDEX_STARTMSG_FS_INDEX_START_OKMSG_FS_INDEX_START_FAILEDMSG_FS_INDEX_LIST_GETMSG_FS_INDEX_LIST_ENTRYMSG_FS_INDEX_LIST_ENDMSG_FS_UNINDEXMSG_FS_UNINDEX_OKMSG_FS_START_SEARCHMSG_FS_GETMSG_FS_PUTMSG_FS_MIGRATION_STOPMSG_FS_CADET_QUERYMSG_FS_CADET_REPLYMSG_DHT_CLIENT_PUTMSG_DHT_CLIENT_GETMSG_DHT_CLIENT_GET_STOPMSG_DHT_CLIENT_RESULTMSG_DHT_P2P_PUTMSG_DHT_P2P_GETMSG_DHT_P2P_RESULTMSG_DHT_MONITOR_GETMSG_DHT_MONITOR_GET_RESPMSG_DHT_MONITOR_PUTMSG_DHT_MONITOR_PUT_RESPMSG_DHT_MONITOR_STARTMSG_DHT_MONITOR_STOPMSG_DHT_CLIENT_GET_RESULTS_KNOWNMSG_DHT_P2P_HELLOMSG_DHT_COREMSG_DHT_CLIENT_HELLO_URLMSG_HOSTLIST_ADVERTISEMENTMSG_DHT_CLIENT_HELLO_GETMSG_STATISTICS_SETMSG_STATISTICS_GETMSG_STATISTICS_VALUEMSG_STATISTICS_ENDMSG_STATISTICS_WATCHMSG_STATISTICS_WATCH_VALUEMSG_STATISTICS_DISCONNECTMSG_STATISTICS_DISCONNECT_CONFIRMMSG_VPN_HELPERMSG_VPN_ICMP_TO_SERVICEMSG_VPN_ICMP_TO_INTERNETMSG_VPN_ICMP_TO_VPNMSG_VPN_DNS_TO_INTERNETMSG_VPN_DNS_FROM_INTERNETMSG_VPN_TCP_TO_SERVICE_STARTMSG_VPN_TCP_TO_INTERNET_STARTMSG_VPN_TCP_DATA_TO_EXITMSG_VPN_TCP_DATA_TO_VPNMSG_VPN_UDP_TO_SERVICEMSG_VPN_UDP_TO_INTERNETMSG_VPN_UDP_REPLYMSG_VPN_CLIENT_REDIRECT_TO_IPMSG_VPN_CLIENT_REDIRECT_TO_SERVICEMSG_VPN_CLIENT_USE_IPMSG_DNS_CLIENT_INITMSG_DNS_CLIENT_REQUESTMSG_DNS_CLIENT_RESPONSEMSG_DNS_HELPERMSG_CHAT_JOIN_REQUESTMSG_CHAT_JOIN_NOTIFICATIONMSG_CHAT_LEAVE_NOTIFICATIONMSG_CHAT_MESSAGE_NOTIFICATIONMSG_CHAT_TRANSMIT_REQUESTMSG_CHAT_CONFIRMATION_RECEIPTMSG_CHAT_CONFIRMATION_NOTIFICATIONMSG_CHAT_P2P_JOIN_NOTIFICATIONMSG_CHAT_P2P_LEAVE_NOTIFICATIONMSG_CHAT_P2P_SYNC_REQUESTMSG_CHAT_P2P_MESSAGE_NOTIFICATIONMSG_CHAT_P2P_CONFIRMATION_RECEIPTMSG_NSE_STARTMSG_NSE_P2P_FLOODMSG_NSE_ESTIMATEMSG_PEERINFO_GETMSG_PEERINFO_GET_ALLMSG_PEERINFO_INFOMSG_PEERINFO_INFO_ENDMSG_PEERINFO_NOTIFYMSG_ATS_STARTMSG_ATS_REQUEST_ADDRESSMSG_ATS_REQUEST_ADDRESS_CANCELMSG_ATS_ADDRESS_UPDATEMSG_ATS_ADDRESS_DESTROYEDMSG_ATS_ADDRESS_SUGGESTIONMSG_ATS_PEER_INFORMATIONMSG_ATS_RESERVATION_REQUESTMSG_ATS_RESERVATION_RESULTMSG_ATS_PREFERENCE_CHANGEMSG_ATS_SESSION_RELEASEMSG_ATS_ADDRESS_ADDMSG_ATS_ADDRESSLIST_REQUESTMSG_ATS_ADDRESSLIST_RESPONSEMSG_ATS_PREFERENCE_FEEDBACKMSG_TRANSPORT_STARTMSG_TRANSPORT_CONNECTMSG_TRANSPORT_DISCONNECTMSG_TRANSPORT_SENDMSG_TRANSPORT_SEND_OKMSG_TRANSPORT_RECVMSG_TRANSPORT_SET_QUOTAMSG_TRANSPORT_ADDRESS_TO_STRINGMSG_TRANSPORT_ADDRESS_TO_STRING_REPLYMSG_TRANSPORT_BLACKLIST_INITMSG_TRANSPORT_BLACKLIST_QUERYMSG_TRANSPORT_BLACKLIST_REPLYMSG_TRANSPORT_PINGMSG_TRANSPORT_PONGMSG_TRANSPORT_SESSION_SYNMSG_TRANSPORT_SESSION_SYN_ACKMSG_TRANSPORT_SESSION_ACKMSG_TRANSPORT_SESSION_DISCONNECTMSG_TRANSPORT_SESSION_QUOTAMSG_TRANSPORT_MONITOR_PEER_REQUESTMSG_TRANSPORT_SESSION_KEEPALIVEMSG_TRANSPORT_SESSION_KEEPALIVE_RESPONSEMSG_TRANSPORT_MONITOR_PEER_RESPONSEMSG_TRANSPORT_BROADCAST_BEACONMSG_TRANSPORT_TRAFFIC_METRICMSG_TRANSPORT_MONITOR_PLUGIN_STARTMSG_TRANSPORT_MONITOR_PLUGIN_EVENTMSG_TRANSPORT_MONITOR_PLUGIN_SYNCMSG_TRANSPORT_MONITOR_PEER_RESPONSE_ENDMSG_FS_PUBLISH_HELPER_PROGRESS_FILEMSG_FS_PUBLISH_HELPER_PROGRESS_DIRECTORYMSG_FS_PUBLISH_HELPER_ERRORMSG_FS_PUBLISH_HELPER_SKIP_FILEMSG_FS_PUBLISH_HELPER_COUNTING_DONEMSG_FS_PUBLISH_HELPER_META_DATAMSG_FS_PUBLISH_HELPER_FINISHEDMSG_NAMECACHE_LOOKUP_BLOCKMSG_NAMECACHE_LOOKUP_BLOCK_RESPONSEMSG_NAMECACHE_BLOCK_CACHEMSG_NAMECACHE_BLOCK_CACHE_RESPONSEMSG_NAMESTORE_RECORD_STOREMSG_NAMESTORE_RECORD_STORE_RESPONSEMSG_NAMESTORE_RECORD_LOOKUPMSG_NAMESTORE_RECORD_LOOKUP_RESPONSEMSG_NAMESTORE_ZONE_TO_NAMEMSG_NAMESTORE_ZONE_TO_NAME_RESPONSEMSG_NAMESTORE_MONITOR_STARTMSG_NAMESTORE_MONITOR_SYNCMSG_NAMESTORE_RECORD_RESULTMSG_NAMESTORE_MONITOR_NEXTMSG_NAMESTORE_ZONE_ITERATION_STARTMSG_NAMESTORE_ZONE_ITERATION_NEXTMSG_NAMESTORE_ZONE_ITERATION_STOPMSG_TESTBED_INITMSG_TESTBED_ADD_HOSTMSG_TESTBED_ADD_HOST_SUCCESSMSG_TESTBED_LINK_CONTROLLERSMSG_TESTBED_CREATE_PEERMSG_TESTBED_RECONFIGURE_PEERMSG_TESTBED_START_PEERMSG_TESTBED_STOP_PEERMSG_TESTBED_DESTROY_PEERMSG_TESTBED_CONFIGURE_UNDERLAY_LINKMSG_TESTBED_OVERLAY_CONNECTMSG_TESTBED_PEER_EVENTMSG_TESTBED_PEER_CONNECT_EVENTMSG_TESTBED_OPERATION_FAIL_EVENTMSG_TESTBED_CREATE_PEER_SUCCESSMSG_TESTBED_GENERIC_OPERATION_SUCCESSMSG_TESTBED_GET_PEER_INFORMATIONMSG_TESTBED_PEER_INFORMATIONMSG_TESTBED_REMOTE_OVERLAY_CONNECTMSG_TESTBED_GET_SLAVE_CONFIGURATIONMSG_TESTBED_SLAVE_CONFIGURATIONMSG_TESTBED_LINK_CONTROLLERS_RESULTMSG_TESTBED_SHUTDOWN_PEERSMSG_TESTBED_MANAGE_PEER_SERVICEMSG_TESTBED_BARRIER_INITMSG_TESTBED_BARRIER_CANCELMSG_TESTBED_BARRIER_STATUSMSG_TESTBED_BARRIER_WAITMSG_TESTBED_MAXMSG_TESTBED_HELPER_INITMSG_TESTBED_HELPER_REPLYMSG_GNS_LOOKUPMSG_GNS_LOOKUP_RESULTMSG_GNS_REVERSE_LOOKUPMSG_GNS_REVERSE_LOOKUP_RESULTMSG_CONSENSUS_CLIENT_JOINMSG_CONSENSUS_CLIENT_INSERTMSG_CONSENSUS_CLIENT_BEGINMSG_CONSENSUS_CLIENT_RECEIVED_ELEMENTMSG_CONSENSUS_CLIENT_CONCLUDEMSG_CONSENSUS_CLIENT_CONCLUDE_DONEMSG_CONSENSUS_CLIENT_ACKMSG_CONSENSUS_P2P_DELTA_ESTIMATEMSG_CONSENSUS_P2P_DIFFERENCE_DIGESTMSG_CONSENSUS_P2P_ELEMENTSMSG_CONSENSUS_P2P_ELEMENTS_REQUESTMSG_CONSENSUS_P2P_ELEMENTS_REPORTMSG_CONSENSUS_P2P_HELLOMSG_CONSENSUS_P2P_SYNCEDMSG_CONSENSUS_P2P_FINMSG_SET_UNION_P2P_REQUEST_FULLMSG_SET_UNION_P2P_DEMANDMSG_SET_UNION_P2P_INQUIRYMSG_SET_UNION_P2P_OFFERMSG_SET_REJECTMSG_SET_CANCELMSG_SET_ITER_ACKMSG_SET_RESULTMSG_SET_ADDMSG_SET_REMOVEMSG_SET_LISTENMSG_SET_ACCEPTMSG_SET_EVALUATEMSG_SET_CONCLUDEMSG_SET_REQUESTMSG_SET_CREATEMSG_SET_P2P_OPERATION_REQUESTMSG_SET_UNION_P2P_SEMSG_SET_UNION_P2P_IBFMSG_SET_P2P_ELEMENTSMSG_SET_P2P_ELEMENT_REQUESTSMSG_SET_UNION_P2P_DONEMSG_SET_ITER_REQUESTMSG_SET_ITER_ELEMENTMSG_SET_ITER_DONEMSG_SET_UNION_P2P_SECMSG_SET_INTERSECTION_P2P_ELEMENT_INFOMSG_SET_INTERSECTION_P2P_BFMSG_SET_INTERSECTION_P2P_DONEMSG_SET_COPY_LAZY_PREPAREMSG_SET_COPY_LAZY_RESPONSEMSG_SET_COPY_LAZY_CONNECTMSG_SET_UNION_P2P_FULL_DONEMSG_SET_UNION_P2P_FULL_ELEMENTMSG_SET_UNION_P2P_OVERMSG_TESTBED_LOGGER_MSGMSG_TESTBED_LOGGER_ACKMSG_REGEX_ANNOUNCEMSG_REGEX_SEARCHMSG_REGEX_RESULTMSG_IDENTITY_STARTMSG_IDENTITY_RESULT_CODEMSG_IDENTITY_UPDATEMSG_IDENTITY_GET_DEFAULTMSG_IDENTITY_SET_DEFAULTMSG_IDENTITY_CREATEMSG_IDENTITY_RENAMEMSG_IDENTITY_DELETEMSG_IDENTITY_LOOKUPMSG_IDENTITY_LOOKUP_BY_NAMEMSG_REVOCATION_QUERYMSG_REVOCATION_QUERY_RESPONSEMSG_REVOCATION_REVOKEMSG_REVOCATION_REVOKE_RESPONSEMSG_SCALARPRODUCT_CLIENT_TO_ALICEMSG_SCALARPRODUCT_CLIENT_TO_BOBMSG_SCALARPRODUCT_CLIENT_MULTIPART_ALICEMSG_SCALARPRODUCT_CLIENT_MULTIPART_BOBMSG_SCALARPRODUCT_SESSION_INITIALIZATIONMSG_SCALARPRODUCT_ALICE_CRYPTODATAMSG_SCALARPRODUCT_BOB_CRYPTODATAMSG_SCALARPRODUCT_BOB_CRYPTODATA_MULTIPARTMSG_SCALARPRODUCT_RESULTMSG_SCALARPRODUCT_ECC_SESSION_INITIALIZATIONMSG_SCALARPRODUCT_ECC_ALICE_CRYPTODATAMSG_SCALARPRODUCT_ECC_BOB_CRYPTODATAMSG_PSYCSTORE_MEMBERSHIP_STOREMSG_PSYCSTORE_MEMBERSHIP_TESTMSG_PSYCSTORE_FRAGMENT_STOREMSG_PSYCSTORE_FRAGMENT_GETMSG_PSYCSTORE_MESSAGE_GETMSG_PSYCSTORE_MESSAGE_GET_FRAGMENTMSG_PSYCSTORE_COUNTERS_GETMSG_PSYCSTORE_STATE_MODIFYMSG_PSYCSTORE_STATE_SYNCMSG_PSYCSTORE_STATE_RESETMSG_PSYCSTORE_STATE_HASH_UPDATEMSG_PSYCSTORE_STATE_GETMSG_PSYCSTORE_STATE_GET_PREFIXMSG_PSYCSTORE_RESULT_CODEMSG_PSYCSTORE_RESULT_FRAGMENTMSG_PSYCSTORE_RESULT_COUNTERSMSG_PSYCSTORE_RESULT_STATEMSG_PSYC_RESULT_CODEMSG_PSYC_MASTER_STARTMSG_PSYC_MASTER_START_ACKMSG_PSYC_SLAVE_JOINMSG_PSYC_SLAVE_JOIN_ACKMSG_PSYC_PART_REQUESTMSG_PSYC_PART_ACKMSG_PSYC_JOIN_REQUESTMSG_PSYC_JOIN_DECISIONMSG_PSYC_CHANNEL_MEMBERSHIP_STOREMSG_PSYC_MESSAGEMSG_PSYC_MESSAGE_HEADERMSG_PSYC_MESSAGE_METHODMSG_PSYC_MESSAGE_MODIFIERMSG_PSYC_MESSAGE_MOD_CONTMSG_PSYC_MESSAGE_DATAMSG_PSYC_MESSAGE_ENDMSG_PSYC_MESSAGE_CANCELMSG_PSYC_MESSAGE_ACKMSG_PSYC_HISTORY_REPLAYMSG_PSYC_HISTORY_RESULTMSG_PSYC_STATE_GETMSG_PSYC_STATE_GET_PREFIXMSG_PSYC_STATE_RESULTMSG_CONVERSATION_AUDIOMSG_CONVERSATION_CS_PHONE_REGISTERMSG_CONVERSATION_CS_PHONE_PICK_UPMSG_CONVERSATION_CS_PHONE_HANG_UPMSG_CONVERSATION_CS_PHONE_CALLMSG_CONVERSATION_CS_PHONE_RINGMSG_CONVERSATION_CS_PHONE_SUSPENDMSG_CONVERSATION_CS_PHONE_RESUMEMSG_CONVERSATION_CS_PHONE_PICKED_UPMSG_CONVERSATION_CS_AUDIOMSG_CONVERSATION_CADET_PHONE_RINGMSG_CONVERSATION_CADET_PHONE_HANG_UPMSG_CONVERSATION_CADET_PHONE_PICK_UPMSG_CONVERSATION_CADET_PHONE_SUSPENDMSG_CONVERSATION_CADET_PHONE_RESUMEMSG_CONVERSATION_CADET_AUDIOMSG_MULTICAST_ORIGIN_STARTMSG_MULTICAST_MEMBER_JOINMSG_MULTICAST_JOIN_REQUESTMSG_MULTICAST_JOIN_DECISIONMSG_MULTICAST_PART_REQUESTMSG_MULTICAST_PART_ACKMSG_MULTICAST_GROUP_ENDMSG_MULTICAST_MESSAGEMSG_MULTICAST_REQUESTMSG_MULTICAST_FRAGMENT_ACKMSG_MULTICAST_REPLAY_REQUESTMSG_MULTICAST_REPLAY_RESPONSEMSG_MULTICAST_REPLAY_RESPONSE_ENDMSG_SECRETSHARING_CLIENT_GENERATEMSG_SECRETSHARING_CLIENT_DECRYPTMSG_SECRETSHARING_CLIENT_DECRYPT_DONEMSG_SECRETSHARING_CLIENT_SECRET_READYMSG_PEERSTORE_STOREMSG_PEERSTORE_ITERATEMSG_PEERSTORE_ITERATE_RECORDMSG_PEERSTORE_ITERATE_ENDMSG_PEERSTORE_WATCHMSG_PEERSTORE_WATCH_RECORDMSG_PEERSTORE_WATCH_CANCELMSG_SOCIAL_RESULT_CODEMSG_SOCIAL_HOST_ENTERMSG_SOCIAL_HOST_ENTER_ACKMSG_SOCIAL_GUEST_ENTERMSG_SOCIAL_GUEST_ENTER_BY_NAMEMSG_SOCIAL_GUEST_ENTER_ACKMSG_SOCIAL_ENTRY_REQUESTMSG_SOCIAL_ENTRY_DECISIONMSG_SOCIAL_PLACE_LEAVEMSG_SOCIAL_PLACE_LEAVE_ACKMSG_SOCIAL_ZONE_ADD_PLACEMSG_SOCIAL_ZONE_ADD_NYMMSG_SOCIAL_APP_CONNECTMSG_SOCIAL_APP_DETACHMSG_SOCIAL_APP_EGOMSG_SOCIAL_APP_EGO_ENDMSG_SOCIAL_APP_PLACEMSG_SOCIAL_APP_PLACE_ENDMSG_SOCIAL_MSG_PROC_SETMSG_SOCIAL_MSG_PROC_CLEARMSG_XDHT_P2P_TRAIL_SETUPMSG_XDHT_P2P_TRAIL_SETUP_RESULTMSG_XDHT_P2P_VERIFY_SUCCESSORMSG_XDHT_P2P_NOTIFY_NEW_SUCCESSORMSG_XDHT_P2P_VERIFY_SUCCESSOR_RESULTMSG_XDHT_P2P_GET_RESULTMSG_XDHT_P2P_TRAIL_SETUP_REJECTIONMSG_XDHT_P2P_TRAIL_TEARDOWNMSG_XDHT_P2P_ADD_TRAILMSG_XDHT_P2P_PUTMSG_XDHT_P2P_GETMSG_XDHT_P2P_NOTIFY_SUCCESSOR_CONFIRMATIONMSG_DHT_ACT_MALICIOUSMSG_DHT_CLIENT_ACT_MALICIOUS_OKMSG_WDHT_RANDOM_WALKMSG_WDHT_RANDOM_WALK_RESPONSEMSG_WDHT_TRAIL_DESTROYMSG_WDHT_TRAIL_ROUTEMSG_WDHT_SUCCESSOR_FINDMSG_WDHT_GETMSG_WDHT_PUTMSG_WDHT_GET_RESULTMSG_RPS_PP_CHECK_LIVEMSG_RPS_PP_PUSHMSG_RPS_PP_PULL_REQUESTMSG_RPS_PP_PULL_REPLYMSG_RPS_CS_SEEDMSG_RPS_ACT_MALICIOUSMSG_RPS_CS_SUB_STARTMSG_RPS_CS_SUB_STOPMSG_RECLAIM_ATTRIBUTE_STOREMSG_RECLAIM_SUCCESS_RESPONSEMSG_RECLAIM_ATTRIBUTE_ITERATION_STARTMSG_RECLAIM_ATTRIBUTE_ITERATION_STOPMSG_RECLAIM_ATTRIBUTE_ITERATION_NEXTMSG_RECLAIM_ATTRIBUTE_RESULTMSG_RECLAIM_ISSUE_TICKETMSG_RECLAIM_TICKET_RESULTMSG_RECLAIM_REVOKE_TICKETMSG_RECLAIM_REVOKE_TICKET_RESULTMSG_RECLAIM_CONSUME_TICKETMSG_RECLAIM_CONSUME_TICKET_RESULTMSG_RECLAIM_TICKET_ITERATION_STARTMSG_RECLAIM_TICKET_ITERATION_STOPMSG_RECLAIM_TICKET_ITERATION_NEXTMSG_RECLAIM_ATTRIBUTE_DELETEMSG_CREDENTIAL_VERIFYMSG_CREDENTIAL_VERIFY_RESULTMSG_CREDENTIAL_COLLECTMSG_CREDENTIAL_COLLECT_RESULTMSG_CADET_CONNECTION_CREATEMSG_CADET_CONNECTION_CREATE_ACKMSG_CADET_CONNECTION_BROKENMSG_CADET_CONNECTION_DESTROYMSG_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTEDMSG_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACKMSG_CADET_TUNNEL_ENCRYPTED_POLLMSG_CADET_TUNNEL_KXMSG_CADET_TUNNEL_ENCRYPTEDMSG_CADET_TUNNEL_KX_AUTHMSG_CADET_CHANNEL_APP_DATAMSG_CADET_CHANNEL_APP_DATA_ACKMSG_CADET_CHANNEL_KEEPALIVEMSG_CADET_CHANNEL_OPENMSG_CADET_CHANNEL_DESTROYMSG_CADET_CHANNEL_OPEN_ACKMSG_CADET_CHANNEL_OPEN_NACK_DEPRECATEDMSG_CADET_LOCAL_DATAMSG_CADET_LOCAL_ACKMSG_CADET_LOCAL_PORT_OPENMSG_CADET_LOCAL_PORT_CLOSEMSG_CADET_LOCAL_CHANNEL_CREATEMSG_CADET_LOCAL_CHANNEL_DESTROYMSG_CADET_LOCAL_REQUEST_INFO_CHANNELMSG_CADET_LOCAL_INFO_CHANNELMSG_CADET_LOCAL_INFO_CHANNEL_ENDMSG_CADET_LOCAL_REQUEST_INFO_PEERSMSG_CADET_LOCAL_INFO_PEERSMSG_CADET_LOCAL_INFO_PEERS_ENDMSG_CADET_LOCAL_REQUEST_INFO_PATHMSG_CADET_LOCAL_INFO_PATHMSG_CADET_LOCAL_INFO_PATH_ENDMSG_CADET_LOCAL_REQUEST_INFO_TUNNELSMSG_CADET_LOCAL_INFO_TUNNELSMSG_CADET_LOCAL_INFO_TUNNELS_ENDMSG_CADET_CLIMSG_NAT_REGISTERMSG_NAT_HANDLE_STUNMSG_NAT_REQUEST_CONNECTION_REVERSALMSG_NAT_CONNECTION_REVERSAL_REQUESTEDMSG_NAT_ADDRESS_CHANGEMSG_NAT_AUTO_CFG_RESULTMSG_NAT_AUTO_REQUEST_CFGMSG_AUCTION_CLIENT_CREATEMSG_AUCTION_CLIENT_JOINMSG_AUCTION_CLIENT_OUTCOMEMSG_RPS_CS_DEBUG_VIEW_REQUESTMSG_RPS_CS_DEBUG_VIEW_REPLYMSG_RPS_CS_DEBUG_VIEW_CANCELMSG_RPS_CS_DEBUG_STREAM_REQUESTMSG_RPS_CS_DEBUG_STREAM_REPLYMSG_RPS_CS_DEBUG_STREAM_CANCELMSG_ALL" | 566 | const _MsgType_name = "MSG_TESTMSG_DUMMYMSG_DUMMY2MSG_RESOLVER_REQUESTMSG_RESOLVER_RESPONSEMSG_REQUEST_AGPLMSG_RESPONSE_AGPLMSG_ARM_STARTMSG_ARM_STOPMSG_ARM_RESULTMSG_ARM_STATUSMSG_ARM_LISTMSG_ARM_LIST_RESULTMSG_ARM_MONITORMSG_ARM_TESTMSG_HELLO_LEGACYMSG_HELLOMSG_FRAGMENTMSG_FRAGMENT_ACKMSG_WLAN_DATA_TO_HELPERMSG_WLAN_DATA_FROM_HELPERMSG_WLAN_HELPER_CONTROLMSG_WLAN_ADVERTISEMENTMSG_WLAN_DATAMSG_DV_RECVMSG_DV_SENDMSG_DV_SEND_ACKMSG_DV_ROUTEMSG_DV_STARTMSG_DV_CONNECTMSG_DV_DISCONNECTMSG_DV_SEND_NACKMSG_DV_DISTANCE_CHANGEDMSG_DV_BOXMSG_TRANSPORT_XU_MESSAGEMSG_TRANSPORT_UDP_MESSAGEMSG_TRANSPORT_UDP_ACKMSG_TRANSPORT_TCP_NAT_PROBEMSG_TRANSPORT_TCP_WELCOMEMSG_TRANSPORT_ATSMSG_NAT_TESTMSG_CORE_INITMSG_CORE_INIT_REPLYMSG_CORE_NOTIFY_CONNECTMSG_CORE_NOTIFY_DISCONNECTMSG_CORE_NOTIFY_STATUS_CHANGEMSG_CORE_NOTIFY_INBOUNDMSG_CORE_NOTIFY_OUTBOUNDMSG_CORE_SEND_REQUESTMSG_CORE_SEND_READYMSG_CORE_SENDMSG_CORE_MONITOR_PEERSMSG_CORE_MONITOR_NOTIFYMSG_CORE_ENCRYPTED_MESSAGEMSG_CORE_PINGMSG_CORE_PONGMSG_CORE_HANGUPMSG_CORE_COMPRESSED_TYPE_MAPMSG_CORE_BINARY_TYPE_MAPMSG_CORE_EPHEMERAL_KEYMSG_CORE_CONFIRM_TYPE_MAPMSG_DATASTORE_RESERVEMSG_DATASTORE_RELEASE_RESERVEMSG_DATASTORE_STATUSMSG_DATASTORE_PUTMSG_DATASTORE_GETMSG_DATASTORE_GET_REPLICATIONMSG_DATASTORE_GET_ZERO_ANONYMITYMSG_DATASTORE_DATAMSG_DATASTORE_DATA_ENDMSG_DATASTORE_REMOVEMSG_DATASTORE_DROPMSG_DATASTORE_GET_KEYMSG_FS_REQUEST_LOC_SIGNMSG_FS_REQUEST_LOC_SIGNATUREMSG_FS_INDEX_STARTMSG_FS_INDEX_START_OKMSG_FS_INDEX_START_FAILEDMSG_FS_INDEX_LIST_GETMSG_FS_INDEX_LIST_ENTRYMSG_FS_INDEX_LIST_ENDMSG_FS_UNINDEXMSG_FS_UNINDEX_OKMSG_FS_START_SEARCHMSG_FS_GETMSG_FS_PUTMSG_FS_MIGRATION_STOPMSG_FS_CADET_QUERYMSG_FS_CADET_REPLYMSG_DHT_CLIENT_PUTMSG_DHT_CLIENT_GETMSG_DHT_CLIENT_GET_STOPMSG_DHT_CLIENT_RESULTMSG_DHT_P2P_PUTMSG_DHT_P2P_GETMSG_DHT_P2P_RESULTMSG_DHT_MONITOR_GETMSG_DHT_MONITOR_GET_RESPMSG_DHT_MONITOR_PUTMSG_DHT_MONITOR_PUT_RESPMSG_DHT_MONITOR_STARTMSG_DHT_MONITOR_STOPMSG_DHT_CLIENT_GET_RESULTS_KNOWNMSG_DHT_P2P_HELLOMSG_DHT_COREMSG_DHT_CLIENT_HELLO_URLMSG_HOSTLIST_ADVERTISEMENTMSG_DHT_CLIENT_HELLO_GETMSG_STATISTICS_SETMSG_STATISTICS_GETMSG_STATISTICS_VALUEMSG_STATISTICS_ENDMSG_STATISTICS_WATCHMSG_STATISTICS_WATCH_VALUEMSG_STATISTICS_DISCONNECTMSG_STATISTICS_DISCONNECT_CONFIRMMSG_VPN_HELPERMSG_VPN_ICMP_TO_SERVICEMSG_VPN_ICMP_TO_INTERNETMSG_VPN_ICMP_TO_VPNMSG_VPN_DNS_TO_INTERNETMSG_VPN_DNS_FROM_INTERNETMSG_VPN_TCP_TO_SERVICE_STARTMSG_VPN_TCP_TO_INTERNET_STARTMSG_VPN_TCP_DATA_TO_EXITMSG_VPN_TCP_DATA_TO_VPNMSG_VPN_UDP_TO_SERVICEMSG_VPN_UDP_TO_INTERNETMSG_VPN_UDP_REPLYMSG_VPN_CLIENT_REDIRECT_TO_IPMSG_VPN_CLIENT_REDIRECT_TO_SERVICEMSG_VPN_CLIENT_USE_IPMSG_DNS_CLIENT_INITMSG_DNS_CLIENT_REQUESTMSG_DNS_CLIENT_RESPONSEMSG_DNS_HELPERMSG_CHAT_JOIN_REQUESTMSG_CHAT_JOIN_NOTIFICATIONMSG_CHAT_LEAVE_NOTIFICATIONMSG_CHAT_MESSAGE_NOTIFICATIONMSG_CHAT_TRANSMIT_REQUESTMSG_CHAT_CONFIRMATION_RECEIPTMSG_CHAT_CONFIRMATION_NOTIFICATIONMSG_CHAT_P2P_JOIN_NOTIFICATIONMSG_CHAT_P2P_LEAVE_NOTIFICATIONMSG_CHAT_P2P_SYNC_REQUESTMSG_CHAT_P2P_MESSAGE_NOTIFICATIONMSG_CHAT_P2P_CONFIRMATION_RECEIPTMSG_NSE_STARTMSG_NSE_P2P_FLOODMSG_NSE_ESTIMATEMSG_PEERINFO_GETMSG_PEERINFO_GET_ALLMSG_PEERINFO_INFOMSG_PEERINFO_INFO_ENDMSG_PEERINFO_NOTIFYMSG_ATS_STARTMSG_ATS_REQUEST_ADDRESSMSG_ATS_REQUEST_ADDRESS_CANCELMSG_ATS_ADDRESS_UPDATEMSG_ATS_ADDRESS_DESTROYEDMSG_ATS_ADDRESS_SUGGESTIONMSG_ATS_PEER_INFORMATIONMSG_ATS_RESERVATION_REQUESTMSG_ATS_RESERVATION_RESULTMSG_ATS_PREFERENCE_CHANGEMSG_ATS_SESSION_RELEASEMSG_ATS_ADDRESS_ADDMSG_ATS_ADDRESSLIST_REQUESTMSG_ATS_ADDRESSLIST_RESPONSEMSG_ATS_PREFERENCE_FEEDBACKMSG_TRANSPORT_STARTMSG_TRANSPORT_CONNECTMSG_TRANSPORT_DISCONNECTMSG_TRANSPORT_SENDMSG_TRANSPORT_SEND_OKMSG_TRANSPORT_RECVMSG_TRANSPORT_SET_QUOTAMSG_TRANSPORT_ADDRESS_TO_STRINGMSG_TRANSPORT_ADDRESS_TO_STRING_REPLYMSG_TRANSPORT_BLACKLIST_INITMSG_TRANSPORT_BLACKLIST_QUERYMSG_TRANSPORT_BLACKLIST_REPLYMSG_TRANSPORT_PINGMSG_TRANSPORT_PONGMSG_TRANSPORT_SESSION_SYNMSG_TRANSPORT_SESSION_SYN_ACKMSG_TRANSPORT_SESSION_ACKMSG_TRANSPORT_SESSION_DISCONNECTMSG_TRANSPORT_SESSION_QUOTAMSG_TRANSPORT_MONITOR_PEER_REQUESTMSG_TRANSPORT_SESSION_KEEPALIVEMSG_TRANSPORT_SESSION_KEEPALIVE_RESPONSEMSG_TRANSPORT_MONITOR_PEER_RESPONSEMSG_TRANSPORT_BROADCAST_BEACONMSG_TRANSPORT_TRAFFIC_METRICMSG_TRANSPORT_MONITOR_PLUGIN_STARTMSG_TRANSPORT_MONITOR_PLUGIN_EVENTMSG_TRANSPORT_MONITOR_PLUGIN_SYNCMSG_TRANSPORT_MONITOR_PEER_RESPONSE_ENDMSG_FS_PUBLISH_HELPER_PROGRESS_FILEMSG_FS_PUBLISH_HELPER_PROGRESS_DIRECTORYMSG_FS_PUBLISH_HELPER_ERRORMSG_FS_PUBLISH_HELPER_SKIP_FILEMSG_FS_PUBLISH_HELPER_COUNTING_DONEMSG_FS_PUBLISH_HELPER_META_DATAMSG_FS_PUBLISH_HELPER_FINISHEDMSG_NAMECACHE_LOOKUP_BLOCKMSG_NAMECACHE_LOOKUP_BLOCK_RESPONSEMSG_NAMECACHE_BLOCK_CACHEMSG_NAMECACHE_BLOCK_CACHE_RESPONSEMSG_NAMESTORE_RECORD_STOREMSG_NAMESTORE_RECORD_STORE_RESPONSEMSG_NAMESTORE_RECORD_LOOKUPMSG_NAMESTORE_RECORD_LOOKUP_RESPONSEMSG_NAMESTORE_ZONE_TO_NAMEMSG_NAMESTORE_ZONE_TO_NAME_RESPONSEMSG_NAMESTORE_MONITOR_STARTMSG_NAMESTORE_MONITOR_SYNCMSG_NAMESTORE_RECORD_RESULTMSG_NAMESTORE_MONITOR_NEXTMSG_NAMESTORE_ZONE_ITERATION_STARTMSG_NAMESTORE_ZONE_ITERATION_NEXTMSG_NAMESTORE_ZONE_ITERATION_STOPMSG_NAMESTORE_ZONE_ITERATION_ENDMSG_LOCKMANAGER_ACQUIREMsgTypeMSG_LOCKMANAGER_RELEASEMsgTypeMSG_LOCKMANAGER_SUCCESSMsgTypeMSG_TESTBED_INITMSG_TESTBED_ADD_HOSTMSG_TESTBED_ADD_HOST_SUCCESSMSG_TESTBED_LINK_CONTROLLERSMSG_TESTBED_CREATE_PEERMSG_TESTBED_RECONFIGURE_PEERMSG_TESTBED_START_PEERMSG_TESTBED_STOP_PEERMSG_TESTBED_DESTROY_PEERMSG_TESTBED_CONFIGURE_UNDERLAY_LINKMSG_TESTBED_OVERLAY_CONNECTMSG_TESTBED_PEER_EVENTMSG_TESTBED_PEER_CONNECT_EVENTMSG_TESTBED_OPERATION_FAIL_EVENTMSG_TESTBED_CREATE_PEER_SUCCESSMSG_TESTBED_GENERIC_OPERATION_SUCCESSMSG_TESTBED_GET_PEER_INFORMATIONMSG_TESTBED_PEER_INFORMATIONMSG_TESTBED_REMOTE_OVERLAY_CONNECTMSG_TESTBED_GET_SLAVE_CONFIGURATIONMSG_TESTBED_SLAVE_CONFIGURATIONMSG_TESTBED_LINK_CONTROLLERS_RESULTMSG_TESTBED_SHUTDOWN_PEERSMSG_TESTBED_MANAGE_PEER_SERVICEMSG_TESTBED_BARRIER_INITMSG_TESTBED_BARRIER_CANCELMSG_TESTBED_BARRIER_STATUSMSG_TESTBED_BARRIER_WAITMSG_TESTBED_MAXMSG_TESTBED_HELPER_INITMSG_TESTBED_HELPER_REPLYMSG_GNS_LOOKUPMSG_GNS_LOOKUP_RESULTMSG_GNS_REVERSE_LOOKUPMSG_GNS_REVERSE_LOOKUP_RESULTMSG_CONSENSUS_CLIENT_JOINMSG_CONSENSUS_CLIENT_INSERTMSG_CONSENSUS_CLIENT_BEGINMSG_CONSENSUS_CLIENT_RECEIVED_ELEMENTMSG_CONSENSUS_CLIENT_CONCLUDEMSG_CONSENSUS_CLIENT_CONCLUDE_DONEMSG_CONSENSUS_CLIENT_ACKMSG_CONSENSUS_P2P_DELTA_ESTIMATEMSG_CONSENSUS_P2P_DIFFERENCE_DIGESTMSG_CONSENSUS_P2P_ELEMENTSMSG_CONSENSUS_P2P_ELEMENTS_REQUESTMSG_CONSENSUS_P2P_ELEMENTS_REPORTMSG_CONSENSUS_P2P_HELLOMSG_CONSENSUS_P2P_SYNCEDMSG_CONSENSUS_P2P_FINMSG_SET_UNION_P2P_REQUEST_FULLMSG_SET_UNION_P2P_DEMANDMSG_SET_UNION_P2P_INQUIRYMSG_SET_UNION_P2P_OFFERMSG_SET_REJECTMSG_SET_CANCELMSG_SET_ITER_ACKMSG_SET_RESULTMSG_SET_ADDMSG_SET_REMOVEMSG_SET_LISTENMSG_SET_ACCEPTMSG_SET_EVALUATEMSG_SET_CONCLUDEMSG_SET_REQUESTMSG_SET_CREATEMSG_SET_P2P_OPERATION_REQUESTMSG_SET_UNION_P2P_SEMSG_SET_UNION_P2P_IBFMSG_SET_P2P_ELEMENTSMSG_SET_P2P_ELEMENT_REQUESTSMSG_SET_UNION_P2P_DONEMSG_SET_ITER_REQUESTMSG_SET_ITER_ELEMENTMSG_SET_ITER_DONEMSG_SET_UNION_P2P_SECMSG_SET_INTERSECTION_P2P_ELEMENT_INFOMSG_SET_INTERSECTION_P2P_BFMSG_SET_INTERSECTION_P2P_DONEMSG_SET_COPY_LAZY_PREPAREMSG_SET_COPY_LAZY_RESPONSEMSG_SET_COPY_LAZY_CONNECTMSG_SET_UNION_P2P_FULL_DONEMSG_SET_UNION_P2P_FULL_ELEMENTMSG_SET_UNION_P2P_OVERMSG_TESTBED_LOGGER_MSGMSG_TESTBED_LOGGER_ACKMSG_REGEX_ANNOUNCEMSG_REGEX_SEARCHMSG_REGEX_RESULTMSG_IDENTITY_STARTMSG_IDENTITY_RESULT_CODEMSG_IDENTITY_UPDATEMSG_IDENTITY_GET_DEFAULTMSG_IDENTITY_SET_DEFAULTMSG_IDENTITY_CREATEMSG_IDENTITY_RENAMEMSG_IDENTITY_DELETEMSG_IDENTITY_LOOKUPMSG_IDENTITY_LOOKUP_BY_NAMEMSG_REVOCATION_QUERYMSG_REVOCATION_QUERY_RESPONSEMSG_REVOCATION_REVOKEMSG_REVOCATION_REVOKE_RESPONSEMSG_SCALARPRODUCT_CLIENT_TO_ALICEMSG_SCALARPRODUCT_CLIENT_TO_BOBMSG_SCALARPRODUCT_CLIENT_MULTIPART_ALICEMSG_SCALARPRODUCT_CLIENT_MULTIPART_BOBMSG_SCALARPRODUCT_SESSION_INITIALIZATIONMSG_SCALARPRODUCT_ALICE_CRYPTODATAMSG_SCALARPRODUCT_BOB_CRYPTODATAMSG_SCALARPRODUCT_BOB_CRYPTODATA_MULTIPARTMSG_SCALARPRODUCT_RESULTMSG_SCALARPRODUCT_ECC_SESSION_INITIALIZATIONMSG_SCALARPRODUCT_ECC_ALICE_CRYPTODATAMSG_SCALARPRODUCT_ECC_BOB_CRYPTODATAMSG_PSYCSTORE_MEMBERSHIP_STOREMSG_PSYCSTORE_MEMBERSHIP_TESTMSG_PSYCSTORE_FRAGMENT_STOREMSG_PSYCSTORE_FRAGMENT_GETMSG_PSYCSTORE_MESSAGE_GETMSG_PSYCSTORE_MESSAGE_GET_FRAGMENTMSG_PSYCSTORE_COUNTERS_GETMSG_PSYCSTORE_STATE_MODIFYMSG_PSYCSTORE_STATE_SYNCMSG_PSYCSTORE_STATE_RESETMSG_PSYCSTORE_STATE_HASH_UPDATEMSG_PSYCSTORE_STATE_GETMSG_PSYCSTORE_STATE_GET_PREFIXMSG_PSYCSTORE_RESULT_CODEMSG_PSYCSTORE_RESULT_FRAGMENTMSG_PSYCSTORE_RESULT_COUNTERSMSG_PSYCSTORE_RESULT_STATEMSG_PSYC_RESULT_CODEMSG_PSYC_MASTER_STARTMSG_PSYC_MASTER_START_ACKMSG_PSYC_SLAVE_JOINMSG_PSYC_SLAVE_JOIN_ACKMSG_PSYC_PART_REQUESTMSG_PSYC_PART_ACKMSG_PSYC_JOIN_REQUESTMSG_PSYC_JOIN_DECISIONMSG_PSYC_CHANNEL_MEMBERSHIP_STOREMSG_PSYC_MESSAGEMSG_PSYC_MESSAGE_HEADERMSG_PSYC_MESSAGE_METHODMSG_PSYC_MESSAGE_MODIFIERMSG_PSYC_MESSAGE_MOD_CONTMSG_PSYC_MESSAGE_DATAMSG_PSYC_MESSAGE_ENDMSG_PSYC_MESSAGE_CANCELMSG_PSYC_MESSAGE_ACKMSG_PSYC_HISTORY_REPLAYMSG_PSYC_HISTORY_RESULTMSG_PSYC_STATE_GETMSG_PSYC_STATE_GET_PREFIXMSG_PSYC_STATE_RESULTMSG_CONVERSATION_AUDIOMSG_CONVERSATION_CS_PHONE_REGISTERMSG_CONVERSATION_CS_PHONE_PICK_UPMSG_CONVERSATION_CS_PHONE_HANG_UPMSG_CONVERSATION_CS_PHONE_CALLMSG_CONVERSATION_CS_PHONE_RINGMSG_CONVERSATION_CS_PHONE_SUSPENDMSG_CONVERSATION_CS_PHONE_RESUMEMSG_CONVERSATION_CS_PHONE_PICKED_UPMSG_CONVERSATION_CS_AUDIOMSG_CONVERSATION_CADET_PHONE_RINGMSG_CONVERSATION_CADET_PHONE_HANG_UPMSG_CONVERSATION_CADET_PHONE_PICK_UPMSG_CONVERSATION_CADET_PHONE_SUSPENDMSG_CONVERSATION_CADET_PHONE_RESUMEMSG_CONVERSATION_CADET_AUDIOMSG_MULTICAST_ORIGIN_STARTMSG_MULTICAST_MEMBER_JOINMSG_MULTICAST_JOIN_REQUESTMSG_MULTICAST_JOIN_DECISIONMSG_MULTICAST_PART_REQUESTMSG_MULTICAST_PART_ACKMSG_MULTICAST_GROUP_ENDMSG_MULTICAST_MESSAGEMSG_MULTICAST_REQUESTMSG_MULTICAST_FRAGMENT_ACKMSG_MULTICAST_REPLAY_REQUESTMSG_MULTICAST_REPLAY_RESPONSEMSG_MULTICAST_REPLAY_RESPONSE_ENDMSG_SECRETSHARING_CLIENT_GENERATEMSG_SECRETSHARING_CLIENT_DECRYPTMSG_SECRETSHARING_CLIENT_DECRYPT_DONEMSG_SECRETSHARING_CLIENT_SECRET_READYMSG_PEERSTORE_STOREMSG_PEERSTORE_ITERATEMSG_PEERSTORE_ITERATE_RECORDMSG_PEERSTORE_ITERATE_ENDMSG_PEERSTORE_WATCHMSG_PEERSTORE_WATCH_RECORDMSG_PEERSTORE_WATCH_CANCELMSG_SOCIAL_RESULT_CODEMSG_SOCIAL_HOST_ENTERMSG_SOCIAL_HOST_ENTER_ACKMSG_SOCIAL_GUEST_ENTERMSG_SOCIAL_GUEST_ENTER_BY_NAMEMSG_SOCIAL_GUEST_ENTER_ACKMSG_SOCIAL_ENTRY_REQUESTMSG_SOCIAL_ENTRY_DECISIONMSG_SOCIAL_PLACE_LEAVEMSG_SOCIAL_PLACE_LEAVE_ACKMSG_SOCIAL_ZONE_ADD_PLACEMSG_SOCIAL_ZONE_ADD_NYMMSG_SOCIAL_APP_CONNECTMSG_SOCIAL_APP_DETACHMSG_SOCIAL_APP_EGOMSG_SOCIAL_APP_EGO_ENDMSG_SOCIAL_APP_PLACEMSG_SOCIAL_APP_PLACE_ENDMSG_SOCIAL_MSG_PROC_SETMSG_SOCIAL_MSG_PROC_CLEARMSG_XDHT_P2P_TRAIL_SETUPMSG_XDHT_P2P_TRAIL_SETUP_RESULTMSG_XDHT_P2P_VERIFY_SUCCESSORMSG_XDHT_P2P_NOTIFY_NEW_SUCCESSORMSG_XDHT_P2P_VERIFY_SUCCESSOR_RESULTMSG_XDHT_P2P_GET_RESULTMSG_XDHT_P2P_TRAIL_SETUP_REJECTIONMSG_XDHT_P2P_TRAIL_TEARDOWNMSG_XDHT_P2P_ADD_TRAILMSG_XDHT_P2P_PUTMSG_XDHT_P2P_GETMSG_XDHT_P2P_NOTIFY_SUCCESSOR_CONFIRMATIONMSG_DHT_ACT_MALICIOUSMSG_DHT_CLIENT_ACT_MALICIOUS_OKMSG_WDHT_RANDOM_WALKMSG_WDHT_RANDOM_WALK_RESPONSEMSG_WDHT_TRAIL_DESTROYMSG_WDHT_TRAIL_ROUTEMSG_WDHT_SUCCESSOR_FINDMSG_WDHT_GETMSG_WDHT_PUTMSG_WDHT_GET_RESULTMSG_RPS_PP_CHECK_LIVEMSG_RPS_PP_PUSHMSG_RPS_PP_PULL_REQUESTMSG_RPS_PP_PULL_REPLYMSG_RPS_CS_SEEDMSG_RPS_ACT_MALICIOUSMSG_RPS_CS_SUB_STARTMSG_RPS_CS_SUB_STOPMSG_RECLAIM_ATTRIBUTE_STOREMSG_RECLAIM_SUCCESS_RESPONSEMSG_RECLAIM_ATTRIBUTE_ITERATION_STARTMSG_RECLAIM_ATTRIBUTE_ITERATION_STOPMSG_RECLAIM_ATTRIBUTE_ITERATION_NEXTMSG_RECLAIM_ATTRIBUTE_RESULTMSG_RECLAIM_ISSUE_TICKETMSG_RECLAIM_TICKET_RESULTMSG_RECLAIM_REVOKE_TICKETMSG_RECLAIM_REVOKE_TICKET_RESULTMSG_RECLAIM_CONSUME_TICKETMSG_RECLAIM_CONSUME_TICKET_RESULTMSG_RECLAIM_TICKET_ITERATION_STARTMSG_RECLAIM_TICKET_ITERATION_STOPMSG_RECLAIM_TICKET_ITERATION_NEXTMSG_RECLAIM_ATTRIBUTE_DELETEMSG_CREDENTIAL_VERIFYMSG_CREDENTIAL_VERIFY_RESULTMSG_CREDENTIAL_COLLECTMSG_CREDENTIAL_COLLECT_RESULTMSG_CADET_CONNECTION_CREATEMSG_CADET_CONNECTION_CREATE_ACKMSG_CADET_CONNECTION_BROKENMSG_CADET_CONNECTION_DESTROYMSG_CADET_CONNECTION_PATH_CHANGED_UNIMPLEMENTEDMSG_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACKMSG_CADET_TUNNEL_ENCRYPTED_POLLMSG_CADET_TUNNEL_KXMSG_CADET_TUNNEL_ENCRYPTEDMSG_CADET_TUNNEL_KX_AUTHMSG_CADET_CHANNEL_APP_DATAMSG_CADET_CHANNEL_APP_DATA_ACKMSG_CADET_CHANNEL_KEEPALIVEMSG_CADET_CHANNEL_OPENMSG_CADET_CHANNEL_DESTROYMSG_CADET_CHANNEL_OPEN_ACKMSG_CADET_CHANNEL_OPEN_NACK_DEPRECATEDMSG_CADET_LOCAL_DATAMSG_CADET_LOCAL_ACKMSG_CADET_LOCAL_PORT_OPENMSG_CADET_LOCAL_PORT_CLOSEMSG_CADET_LOCAL_CHANNEL_CREATEMSG_CADET_LOCAL_CHANNEL_DESTROYMSG_CADET_LOCAL_REQUEST_INFO_CHANNELMSG_CADET_LOCAL_INFO_CHANNELMSG_CADET_LOCAL_INFO_CHANNEL_ENDMSG_CADET_LOCAL_REQUEST_INFO_PEERSMSG_CADET_LOCAL_INFO_PEERSMSG_CADET_LOCAL_INFO_PEERS_ENDMSG_CADET_LOCAL_REQUEST_INFO_PATHMSG_CADET_LOCAL_INFO_PATHMSG_CADET_LOCAL_INFO_PATH_ENDMSG_CADET_LOCAL_REQUEST_INFO_TUNNELSMSG_CADET_LOCAL_INFO_TUNNELSMSG_CADET_LOCAL_INFO_TUNNELS_ENDMSG_CADET_CLIMSG_NAT_REGISTERMSG_NAT_HANDLE_STUNMSG_NAT_REQUEST_CONNECTION_REVERSALMSG_NAT_CONNECTION_REVERSAL_REQUESTEDMSG_NAT_ADDRESS_CHANGEMSG_NAT_AUTO_CFG_RESULTMSG_NAT_AUTO_REQUEST_CFGMSG_AUCTION_CLIENT_CREATEMSG_AUCTION_CLIENT_JOINMSG_AUCTION_CLIENT_OUTCOMEMSG_RPS_CS_DEBUG_VIEW_REQUESTMSG_RPS_CS_DEBUG_VIEW_REPLYMSG_RPS_CS_DEBUG_VIEW_CANCELMSG_RPS_CS_DEBUG_STREAM_REQUESTMSG_RPS_CS_DEBUG_STREAM_REPLYMSG_RPS_CS_DEBUG_STREAM_CANCELMSG_NAMESTORE_TX_CONTROLMSG_NAMESTORE_TX_CONTROL_RESULTMSG_NAMESTORE_RECORD_EDITMSG_ALL" |
560 | 567 | ||
561 | var _MsgType_map = map[MsgType]string{ | 568 | var _MsgType_map = map[MsgType]string{ |
562 | 1: _MsgType_name[0:8], | 569 | 1: _MsgType_name[0:8], |
@@ -783,326 +790,333 @@ var _MsgType_map = map[MsgType]string{ | |||
783 | 445: _MsgType_name[4976:5010], | 790 | 445: _MsgType_name[4976:5010], |
784 | 447: _MsgType_name[5010:5043], | 791 | 447: _MsgType_name[5010:5043], |
785 | 448: _MsgType_name[5043:5076], | 792 | 448: _MsgType_name[5043:5076], |
786 | 460: _MsgType_name[5076:5092], | 793 | 449: _MsgType_name[5076:5108], |
787 | 461: _MsgType_name[5092:5112], | 794 | 450: _MsgType_name[5108:5138], |
788 | 462: _MsgType_name[5112:5140], | 795 | 451: _MsgType_name[5138:5168], |
789 | 463: _MsgType_name[5140:5168], | 796 | 452: _MsgType_name[5168:5198], |
790 | 464: _MsgType_name[5168:5191], | 797 | 460: _MsgType_name[5198:5214], |
791 | 465: _MsgType_name[5191:5219], | 798 | 461: _MsgType_name[5214:5234], |
792 | 466: _MsgType_name[5219:5241], | 799 | 462: _MsgType_name[5234:5262], |
793 | 467: _MsgType_name[5241:5262], | 800 | 463: _MsgType_name[5262:5290], |
794 | 468: _MsgType_name[5262:5286], | 801 | 464: _MsgType_name[5290:5313], |
795 | 469: _MsgType_name[5286:5321], | 802 | 465: _MsgType_name[5313:5341], |
796 | 470: _MsgType_name[5321:5348], | 803 | 466: _MsgType_name[5341:5363], |
797 | 471: _MsgType_name[5348:5370], | 804 | 467: _MsgType_name[5363:5384], |
798 | 472: _MsgType_name[5370:5400], | 805 | 468: _MsgType_name[5384:5408], |
799 | 473: _MsgType_name[5400:5432], | 806 | 469: _MsgType_name[5408:5443], |
800 | 474: _MsgType_name[5432:5463], | 807 | 470: _MsgType_name[5443:5470], |
801 | 475: _MsgType_name[5463:5500], | 808 | 471: _MsgType_name[5470:5492], |
802 | 476: _MsgType_name[5500:5532], | 809 | 472: _MsgType_name[5492:5522], |
803 | 477: _MsgType_name[5532:5560], | 810 | 473: _MsgType_name[5522:5554], |
804 | 478: _MsgType_name[5560:5594], | 811 | 474: _MsgType_name[5554:5585], |
805 | 479: _MsgType_name[5594:5629], | 812 | 475: _MsgType_name[5585:5622], |
806 | 480: _MsgType_name[5629:5660], | 813 | 476: _MsgType_name[5622:5654], |
807 | 481: _MsgType_name[5660:5695], | 814 | 477: _MsgType_name[5654:5682], |
808 | 482: _MsgType_name[5695:5721], | 815 | 478: _MsgType_name[5682:5716], |
809 | 483: _MsgType_name[5721:5752], | 816 | 479: _MsgType_name[5716:5751], |
810 | 484: _MsgType_name[5752:5776], | 817 | 480: _MsgType_name[5751:5782], |
811 | 485: _MsgType_name[5776:5802], | 818 | 481: _MsgType_name[5782:5817], |
812 | 486: _MsgType_name[5802:5828], | 819 | 482: _MsgType_name[5817:5843], |
813 | 487: _MsgType_name[5828:5852], | 820 | 483: _MsgType_name[5843:5874], |
814 | 488: _MsgType_name[5852:5867], | 821 | 484: _MsgType_name[5874:5898], |
815 | 495: _MsgType_name[5867:5890], | 822 | 485: _MsgType_name[5898:5924], |
816 | 496: _MsgType_name[5890:5914], | 823 | 486: _MsgType_name[5924:5950], |
817 | 500: _MsgType_name[5914:5928], | 824 | 487: _MsgType_name[5950:5974], |
818 | 501: _MsgType_name[5928:5949], | 825 | 488: _MsgType_name[5974:5989], |
819 | 502: _MsgType_name[5949:5971], | 826 | 495: _MsgType_name[5989:6012], |
820 | 503: _MsgType_name[5971:6000], | 827 | 496: _MsgType_name[6012:6036], |
821 | 520: _MsgType_name[6000:6025], | 828 | 500: _MsgType_name[6036:6050], |
822 | 521: _MsgType_name[6025:6052], | 829 | 501: _MsgType_name[6050:6071], |
823 | 522: _MsgType_name[6052:6078], | 830 | 502: _MsgType_name[6071:6093], |
824 | 523: _MsgType_name[6078:6115], | 831 | 503: _MsgType_name[6093:6122], |
825 | 524: _MsgType_name[6115:6144], | 832 | 520: _MsgType_name[6122:6147], |
826 | 525: _MsgType_name[6144:6178], | 833 | 521: _MsgType_name[6147:6174], |
827 | 540: _MsgType_name[6178:6202], | 834 | 522: _MsgType_name[6174:6200], |
828 | 541: _MsgType_name[6202:6234], | 835 | 523: _MsgType_name[6200:6237], |
829 | 542: _MsgType_name[6234:6269], | 836 | 524: _MsgType_name[6237:6266], |
830 | 543: _MsgType_name[6269:6295], | 837 | 525: _MsgType_name[6266:6300], |
831 | 544: _MsgType_name[6295:6329], | 838 | 540: _MsgType_name[6300:6324], |
832 | 545: _MsgType_name[6329:6362], | 839 | 541: _MsgType_name[6324:6356], |
833 | 546: _MsgType_name[6362:6385], | 840 | 542: _MsgType_name[6356:6391], |
834 | 547: _MsgType_name[6385:6409], | 841 | 543: _MsgType_name[6391:6417], |
835 | 548: _MsgType_name[6409:6430], | 842 | 544: _MsgType_name[6417:6451], |
836 | 565: _MsgType_name[6430:6460], | 843 | 545: _MsgType_name[6451:6484], |
837 | 566: _MsgType_name[6460:6484], | 844 | 546: _MsgType_name[6484:6507], |
838 | 567: _MsgType_name[6484:6509], | 845 | 547: _MsgType_name[6507:6531], |
839 | 568: _MsgType_name[6509:6532], | 846 | 548: _MsgType_name[6531:6552], |
840 | 569: _MsgType_name[6532:6546], | 847 | 565: _MsgType_name[6552:6582], |
841 | 570: _MsgType_name[6546:6560], | 848 | 566: _MsgType_name[6582:6606], |
842 | 571: _MsgType_name[6560:6576], | 849 | 567: _MsgType_name[6606:6631], |
843 | 572: _MsgType_name[6576:6590], | 850 | 568: _MsgType_name[6631:6654], |
844 | 573: _MsgType_name[6590:6601], | 851 | 569: _MsgType_name[6654:6668], |
845 | 574: _MsgType_name[6601:6615], | 852 | 570: _MsgType_name[6668:6682], |
846 | 575: _MsgType_name[6615:6629], | 853 | 571: _MsgType_name[6682:6698], |
847 | 576: _MsgType_name[6629:6643], | 854 | 572: _MsgType_name[6698:6712], |
848 | 577: _MsgType_name[6643:6659], | 855 | 573: _MsgType_name[6712:6723], |
849 | 578: _MsgType_name[6659:6675], | 856 | 574: _MsgType_name[6723:6737], |
850 | 579: _MsgType_name[6675:6690], | 857 | 575: _MsgType_name[6737:6751], |
851 | 580: _MsgType_name[6690:6704], | 858 | 576: _MsgType_name[6751:6765], |
852 | 581: _MsgType_name[6704:6733], | 859 | 577: _MsgType_name[6765:6781], |
853 | 582: _MsgType_name[6733:6753], | 860 | 578: _MsgType_name[6781:6797], |
854 | 583: _MsgType_name[6753:6774], | 861 | 579: _MsgType_name[6797:6812], |
855 | 584: _MsgType_name[6774:6794], | 862 | 580: _MsgType_name[6812:6826], |
856 | 585: _MsgType_name[6794:6822], | 863 | 581: _MsgType_name[6826:6855], |
857 | 586: _MsgType_name[6822:6844], | 864 | 582: _MsgType_name[6855:6875], |
858 | 587: _MsgType_name[6844:6864], | 865 | 583: _MsgType_name[6875:6896], |
859 | 588: _MsgType_name[6864:6884], | 866 | 584: _MsgType_name[6896:6916], |
860 | 589: _MsgType_name[6884:6901], | 867 | 585: _MsgType_name[6916:6944], |
861 | 590: _MsgType_name[6901:6922], | 868 | 586: _MsgType_name[6944:6966], |
862 | 591: _MsgType_name[6922:6959], | 869 | 587: _MsgType_name[6966:6986], |
863 | 592: _MsgType_name[6959:6986], | 870 | 588: _MsgType_name[6986:7006], |
864 | 593: _MsgType_name[6986:7015], | 871 | 589: _MsgType_name[7006:7023], |
865 | 594: _MsgType_name[7015:7040], | 872 | 590: _MsgType_name[7023:7044], |
866 | 595: _MsgType_name[7040:7066], | 873 | 591: _MsgType_name[7044:7081], |
867 | 596: _MsgType_name[7066:7091], | 874 | 592: _MsgType_name[7081:7108], |
868 | 597: _MsgType_name[7091:7118], | 875 | 593: _MsgType_name[7108:7137], |
869 | 598: _MsgType_name[7118:7148], | 876 | 594: _MsgType_name[7137:7162], |
870 | 599: _MsgType_name[7148:7170], | 877 | 595: _MsgType_name[7162:7188], |
871 | 600: _MsgType_name[7170:7192], | 878 | 596: _MsgType_name[7188:7213], |
872 | 601: _MsgType_name[7192:7214], | 879 | 597: _MsgType_name[7213:7240], |
873 | 620: _MsgType_name[7214:7232], | 880 | 598: _MsgType_name[7240:7270], |
874 | 621: _MsgType_name[7232:7248], | 881 | 599: _MsgType_name[7270:7292], |
875 | 622: _MsgType_name[7248:7264], | 882 | 600: _MsgType_name[7292:7314], |
876 | 624: _MsgType_name[7264:7282], | 883 | 601: _MsgType_name[7314:7336], |
877 | 625: _MsgType_name[7282:7306], | 884 | 620: _MsgType_name[7336:7354], |
878 | 626: _MsgType_name[7306:7325], | 885 | 621: _MsgType_name[7354:7370], |
879 | 627: _MsgType_name[7325:7349], | 886 | 622: _MsgType_name[7370:7386], |
880 | 628: _MsgType_name[7349:7373], | 887 | 624: _MsgType_name[7386:7404], |
881 | 629: _MsgType_name[7373:7392], | 888 | 625: _MsgType_name[7404:7428], |
882 | 630: _MsgType_name[7392:7411], | 889 | 626: _MsgType_name[7428:7447], |
883 | 631: _MsgType_name[7411:7430], | 890 | 627: _MsgType_name[7447:7471], |
884 | 632: _MsgType_name[7430:7449], | 891 | 628: _MsgType_name[7471:7495], |
885 | 633: _MsgType_name[7449:7476], | 892 | 629: _MsgType_name[7495:7514], |
886 | 636: _MsgType_name[7476:7496], | 893 | 630: _MsgType_name[7514:7533], |
887 | 637: _MsgType_name[7496:7525], | 894 | 631: _MsgType_name[7533:7552], |
888 | 638: _MsgType_name[7525:7546], | 895 | 632: _MsgType_name[7552:7571], |
889 | 639: _MsgType_name[7546:7576], | 896 | 633: _MsgType_name[7571:7598], |
890 | 640: _MsgType_name[7576:7609], | 897 | 636: _MsgType_name[7598:7618], |
891 | 641: _MsgType_name[7609:7640], | 898 | 637: _MsgType_name[7618:7647], |
892 | 642: _MsgType_name[7640:7680], | 899 | 638: _MsgType_name[7647:7668], |
893 | 643: _MsgType_name[7680:7718], | 900 | 639: _MsgType_name[7668:7698], |
894 | 644: _MsgType_name[7718:7758], | 901 | 640: _MsgType_name[7698:7731], |
895 | 645: _MsgType_name[7758:7792], | 902 | 641: _MsgType_name[7731:7762], |
896 | 647: _MsgType_name[7792:7824], | 903 | 642: _MsgType_name[7762:7802], |
897 | 648: _MsgType_name[7824:7866], | 904 | 643: _MsgType_name[7802:7840], |
898 | 649: _MsgType_name[7866:7890], | 905 | 644: _MsgType_name[7840:7880], |
899 | 650: _MsgType_name[7890:7934], | 906 | 645: _MsgType_name[7880:7914], |
900 | 651: _MsgType_name[7934:7972], | 907 | 647: _MsgType_name[7914:7946], |
901 | 652: _MsgType_name[7972:8008], | 908 | 648: _MsgType_name[7946:7988], |
902 | 660: _MsgType_name[8008:8038], | 909 | 649: _MsgType_name[7988:8012], |
903 | 661: _MsgType_name[8038:8067], | 910 | 650: _MsgType_name[8012:8056], |
904 | 662: _MsgType_name[8067:8095], | 911 | 651: _MsgType_name[8056:8094], |
905 | 663: _MsgType_name[8095:8121], | 912 | 652: _MsgType_name[8094:8130], |
906 | 664: _MsgType_name[8121:8146], | 913 | 660: _MsgType_name[8130:8160], |
907 | 665: _MsgType_name[8146:8180], | 914 | 661: _MsgType_name[8160:8189], |
908 | 666: _MsgType_name[8180:8206], | 915 | 662: _MsgType_name[8189:8217], |
909 | 668: _MsgType_name[8206:8232], | 916 | 663: _MsgType_name[8217:8243], |
910 | 669: _MsgType_name[8232:8256], | 917 | 664: _MsgType_name[8243:8268], |
911 | 670: _MsgType_name[8256:8281], | 918 | 665: _MsgType_name[8268:8302], |
912 | 671: _MsgType_name[8281:8312], | 919 | 666: _MsgType_name[8302:8328], |
913 | 672: _MsgType_name[8312:8335], | 920 | 668: _MsgType_name[8328:8354], |
914 | 673: _MsgType_name[8335:8365], | 921 | 669: _MsgType_name[8354:8378], |
915 | 674: _MsgType_name[8365:8390], | 922 | 670: _MsgType_name[8378:8403], |
916 | 675: _MsgType_name[8390:8419], | 923 | 671: _MsgType_name[8403:8434], |
917 | 676: _MsgType_name[8419:8448], | 924 | 672: _MsgType_name[8434:8457], |
918 | 677: _MsgType_name[8448:8474], | 925 | 673: _MsgType_name[8457:8487], |
919 | 680: _MsgType_name[8474:8494], | 926 | 674: _MsgType_name[8487:8512], |
920 | 681: _MsgType_name[8494:8515], | 927 | 675: _MsgType_name[8512:8541], |
921 | 682: _MsgType_name[8515:8540], | 928 | 676: _MsgType_name[8541:8570], |
922 | 683: _MsgType_name[8540:8559], | 929 | 677: _MsgType_name[8570:8596], |
923 | 684: _MsgType_name[8559:8582], | 930 | 680: _MsgType_name[8596:8616], |
924 | 685: _MsgType_name[8582:8603], | 931 | 681: _MsgType_name[8616:8637], |
925 | 686: _MsgType_name[8603:8620], | 932 | 682: _MsgType_name[8637:8662], |
926 | 687: _MsgType_name[8620:8641], | 933 | 683: _MsgType_name[8662:8681], |
927 | 688: _MsgType_name[8641:8663], | 934 | 684: _MsgType_name[8681:8704], |
928 | 689: _MsgType_name[8663:8696], | 935 | 685: _MsgType_name[8704:8725], |
929 | 691: _MsgType_name[8696:8712], | 936 | 686: _MsgType_name[8725:8742], |
930 | 692: _MsgType_name[8712:8735], | 937 | 687: _MsgType_name[8742:8763], |
931 | 693: _MsgType_name[8735:8758], | 938 | 688: _MsgType_name[8763:8785], |
932 | 694: _MsgType_name[8758:8783], | 939 | 689: _MsgType_name[8785:8818], |
933 | 695: _MsgType_name[8783:8808], | 940 | 691: _MsgType_name[8818:8834], |
934 | 696: _MsgType_name[8808:8829], | 941 | 692: _MsgType_name[8834:8857], |
935 | 697: _MsgType_name[8829:8849], | 942 | 693: _MsgType_name[8857:8880], |
936 | 698: _MsgType_name[8849:8872], | 943 | 694: _MsgType_name[8880:8905], |
937 | 699: _MsgType_name[8872:8892], | 944 | 695: _MsgType_name[8905:8930], |
938 | 701: _MsgType_name[8892:8915], | 945 | 696: _MsgType_name[8930:8951], |
939 | 702: _MsgType_name[8915:8938], | 946 | 697: _MsgType_name[8951:8971], |
940 | 703: _MsgType_name[8938:8956], | 947 | 698: _MsgType_name[8971:8994], |
941 | 704: _MsgType_name[8956:8981], | 948 | 699: _MsgType_name[8994:9014], |
942 | 705: _MsgType_name[8981:9002], | 949 | 701: _MsgType_name[9014:9037], |
943 | 730: _MsgType_name[9002:9024], | 950 | 702: _MsgType_name[9037:9060], |
944 | 731: _MsgType_name[9024:9058], | 951 | 703: _MsgType_name[9060:9078], |
945 | 732: _MsgType_name[9058:9091], | 952 | 704: _MsgType_name[9078:9103], |
946 | 733: _MsgType_name[9091:9124], | 953 | 705: _MsgType_name[9103:9124], |
947 | 734: _MsgType_name[9124:9154], | 954 | 730: _MsgType_name[9124:9146], |
948 | 735: _MsgType_name[9154:9184], | 955 | 731: _MsgType_name[9146:9180], |
949 | 736: _MsgType_name[9184:9217], | 956 | 732: _MsgType_name[9180:9213], |
950 | 737: _MsgType_name[9217:9249], | 957 | 733: _MsgType_name[9213:9246], |
951 | 738: _MsgType_name[9249:9284], | 958 | 734: _MsgType_name[9246:9276], |
952 | 739: _MsgType_name[9284:9309], | 959 | 735: _MsgType_name[9276:9306], |
953 | 740: _MsgType_name[9309:9342], | 960 | 736: _MsgType_name[9306:9339], |
954 | 741: _MsgType_name[9342:9378], | 961 | 737: _MsgType_name[9339:9371], |
955 | 742: _MsgType_name[9378:9414], | 962 | 738: _MsgType_name[9371:9406], |
956 | 743: _MsgType_name[9414:9450], | 963 | 739: _MsgType_name[9406:9431], |
957 | 744: _MsgType_name[9450:9485], | 964 | 740: _MsgType_name[9431:9464], |
958 | 745: _MsgType_name[9485:9513], | 965 | 741: _MsgType_name[9464:9500], |
959 | 750: _MsgType_name[9513:9539], | 966 | 742: _MsgType_name[9500:9536], |
960 | 751: _MsgType_name[9539:9564], | 967 | 743: _MsgType_name[9536:9572], |
961 | 752: _MsgType_name[9564:9590], | 968 | 744: _MsgType_name[9572:9607], |
962 | 753: _MsgType_name[9590:9617], | 969 | 745: _MsgType_name[9607:9635], |
963 | 754: _MsgType_name[9617:9643], | 970 | 750: _MsgType_name[9635:9661], |
964 | 755: _MsgType_name[9643:9665], | 971 | 751: _MsgType_name[9661:9686], |
965 | 756: _MsgType_name[9665:9688], | 972 | 752: _MsgType_name[9686:9712], |
966 | 757: _MsgType_name[9688:9709], | 973 | 753: _MsgType_name[9712:9739], |
967 | 758: _MsgType_name[9709:9730], | 974 | 754: _MsgType_name[9739:9765], |
968 | 759: _MsgType_name[9730:9756], | 975 | 755: _MsgType_name[9765:9787], |
969 | 760: _MsgType_name[9756:9784], | 976 | 756: _MsgType_name[9787:9810], |
970 | 761: _MsgType_name[9784:9813], | 977 | 757: _MsgType_name[9810:9831], |
971 | 762: _MsgType_name[9813:9846], | 978 | 758: _MsgType_name[9831:9852], |
972 | 780: _MsgType_name[9846:9879], | 979 | 759: _MsgType_name[9852:9878], |
973 | 781: _MsgType_name[9879:9911], | 980 | 760: _MsgType_name[9878:9906], |
974 | 782: _MsgType_name[9911:9948], | 981 | 761: _MsgType_name[9906:9935], |
975 | 783: _MsgType_name[9948:9985], | 982 | 762: _MsgType_name[9935:9968], |
976 | 820: _MsgType_name[9985:10004], | 983 | 780: _MsgType_name[9968:10001], |
977 | 821: _MsgType_name[10004:10025], | 984 | 781: _MsgType_name[10001:10033], |
978 | 822: _MsgType_name[10025:10053], | 985 | 782: _MsgType_name[10033:10070], |
979 | 823: _MsgType_name[10053:10078], | 986 | 783: _MsgType_name[10070:10107], |
980 | 824: _MsgType_name[10078:10097], | 987 | 820: _MsgType_name[10107:10126], |
981 | 825: _MsgType_name[10097:10123], | 988 | 821: _MsgType_name[10126:10147], |
982 | 826: _MsgType_name[10123:10149], | 989 | 822: _MsgType_name[10147:10175], |
983 | 840: _MsgType_name[10149:10171], | 990 | 823: _MsgType_name[10175:10200], |
984 | 841: _MsgType_name[10171:10192], | 991 | 824: _MsgType_name[10200:10219], |
985 | 842: _MsgType_name[10192:10217], | 992 | 825: _MsgType_name[10219:10245], |
986 | 843: _MsgType_name[10217:10239], | 993 | 826: _MsgType_name[10245:10271], |
987 | 844: _MsgType_name[10239:10269], | 994 | 840: _MsgType_name[10271:10293], |
988 | 845: _MsgType_name[10269:10295], | 995 | 841: _MsgType_name[10293:10314], |
989 | 846: _MsgType_name[10295:10319], | 996 | 842: _MsgType_name[10314:10339], |
990 | 847: _MsgType_name[10319:10344], | 997 | 843: _MsgType_name[10339:10361], |
991 | 848: _MsgType_name[10344:10366], | 998 | 844: _MsgType_name[10361:10391], |
992 | 849: _MsgType_name[10366:10392], | 999 | 845: _MsgType_name[10391:10417], |
993 | 850: _MsgType_name[10392:10417], | 1000 | 846: _MsgType_name[10417:10441], |
994 | 851: _MsgType_name[10417:10440], | 1001 | 847: _MsgType_name[10441:10466], |
995 | 852: _MsgType_name[10440:10462], | 1002 | 848: _MsgType_name[10466:10488], |
996 | 853: _MsgType_name[10462:10483], | 1003 | 849: _MsgType_name[10488:10514], |
997 | 854: _MsgType_name[10483:10501], | 1004 | 850: _MsgType_name[10514:10539], |
998 | 855: _MsgType_name[10501:10523], | 1005 | 851: _MsgType_name[10539:10562], |
999 | 856: _MsgType_name[10523:10543], | 1006 | 852: _MsgType_name[10562:10584], |
1000 | 857: _MsgType_name[10543:10567], | 1007 | 853: _MsgType_name[10584:10605], |
1001 | 858: _MsgType_name[10567:10590], | 1008 | 854: _MsgType_name[10605:10623], |
1002 | 859: _MsgType_name[10590:10615], | 1009 | 855: _MsgType_name[10623:10645], |
1003 | 880: _MsgType_name[10615:10639], | 1010 | 856: _MsgType_name[10645:10665], |
1004 | 881: _MsgType_name[10639:10670], | 1011 | 857: _MsgType_name[10665:10689], |
1005 | 882: _MsgType_name[10670:10699], | 1012 | 858: _MsgType_name[10689:10712], |
1006 | 883: _MsgType_name[10699:10732], | 1013 | 859: _MsgType_name[10712:10737], |
1007 | 884: _MsgType_name[10732:10768], | 1014 | 880: _MsgType_name[10737:10761], |
1008 | 885: _MsgType_name[10768:10791], | 1015 | 881: _MsgType_name[10761:10792], |
1009 | 886: _MsgType_name[10791:10825], | 1016 | 882: _MsgType_name[10792:10821], |
1010 | 887: _MsgType_name[10825:10852], | 1017 | 883: _MsgType_name[10821:10854], |
1011 | 888: _MsgType_name[10852:10874], | 1018 | 884: _MsgType_name[10854:10890], |
1012 | 890: _MsgType_name[10874:10890], | 1019 | 885: _MsgType_name[10890:10913], |
1013 | 891: _MsgType_name[10890:10906], | 1020 | 886: _MsgType_name[10913:10947], |
1014 | 892: _MsgType_name[10906:10948], | 1021 | 887: _MsgType_name[10947:10974], |
1015 | 893: _MsgType_name[10948:10969], | 1022 | 888: _MsgType_name[10974:10996], |
1016 | 894: _MsgType_name[10969:11000], | 1023 | 890: _MsgType_name[10996:11012], |
1017 | 910: _MsgType_name[11000:11020], | 1024 | 891: _MsgType_name[11012:11028], |
1018 | 911: _MsgType_name[11020:11049], | 1025 | 892: _MsgType_name[11028:11070], |
1019 | 912: _MsgType_name[11049:11071], | 1026 | 893: _MsgType_name[11070:11091], |
1020 | 913: _MsgType_name[11071:11091], | 1027 | 894: _MsgType_name[11091:11122], |
1021 | 914: _MsgType_name[11091:11114], | 1028 | 910: _MsgType_name[11122:11142], |
1022 | 915: _MsgType_name[11114:11126], | 1029 | 911: _MsgType_name[11142:11171], |
1023 | 916: _MsgType_name[11126:11138], | 1030 | 912: _MsgType_name[11171:11193], |
1024 | 917: _MsgType_name[11138:11157], | 1031 | 913: _MsgType_name[11193:11213], |
1025 | 950: _MsgType_name[11157:11178], | 1032 | 914: _MsgType_name[11213:11236], |
1026 | 951: _MsgType_name[11178:11193], | 1033 | 915: _MsgType_name[11236:11248], |
1027 | 952: _MsgType_name[11193:11216], | 1034 | 916: _MsgType_name[11248:11260], |
1028 | 953: _MsgType_name[11216:11237], | 1035 | 917: _MsgType_name[11260:11279], |
1029 | 954: _MsgType_name[11237:11252], | 1036 | 950: _MsgType_name[11279:11300], |
1030 | 955: _MsgType_name[11252:11273], | 1037 | 951: _MsgType_name[11300:11315], |
1031 | 956: _MsgType_name[11273:11293], | 1038 | 952: _MsgType_name[11315:11338], |
1032 | 957: _MsgType_name[11293:11312], | 1039 | 953: _MsgType_name[11338:11359], |
1033 | 961: _MsgType_name[11312:11339], | 1040 | 954: _MsgType_name[11359:11374], |
1034 | 962: _MsgType_name[11339:11367], | 1041 | 955: _MsgType_name[11374:11395], |
1035 | 963: _MsgType_name[11367:11404], | 1042 | 956: _MsgType_name[11395:11415], |
1036 | 964: _MsgType_name[11404:11440], | 1043 | 957: _MsgType_name[11415:11434], |
1037 | 965: _MsgType_name[11440:11476], | 1044 | 961: _MsgType_name[11434:11461], |
1038 | 966: _MsgType_name[11476:11504], | 1045 | 962: _MsgType_name[11461:11489], |
1039 | 967: _MsgType_name[11504:11528], | 1046 | 963: _MsgType_name[11489:11526], |
1040 | 968: _MsgType_name[11528:11553], | 1047 | 964: _MsgType_name[11526:11562], |
1041 | 969: _MsgType_name[11553:11578], | 1048 | 965: _MsgType_name[11562:11598], |
1042 | 970: _MsgType_name[11578:11610], | 1049 | 966: _MsgType_name[11598:11626], |
1043 | 971: _MsgType_name[11610:11636], | 1050 | 967: _MsgType_name[11626:11650], |
1044 | 972: _MsgType_name[11636:11669], | 1051 | 968: _MsgType_name[11650:11675], |
1045 | 973: _MsgType_name[11669:11703], | 1052 | 969: _MsgType_name[11675:11700], |
1046 | 974: _MsgType_name[11703:11736], | 1053 | 970: _MsgType_name[11700:11732], |
1047 | 975: _MsgType_name[11736:11769], | 1054 | 971: _MsgType_name[11732:11758], |
1048 | 976: _MsgType_name[11769:11797], | 1055 | 972: _MsgType_name[11758:11791], |
1049 | 981: _MsgType_name[11797:11818], | 1056 | 973: _MsgType_name[11791:11825], |
1050 | 982: _MsgType_name[11818:11846], | 1057 | 974: _MsgType_name[11825:11858], |
1051 | 983: _MsgType_name[11846:11868], | 1058 | 975: _MsgType_name[11858:11891], |
1052 | 984: _MsgType_name[11868:11897], | 1059 | 976: _MsgType_name[11891:11919], |
1053 | 1000: _MsgType_name[11897:11924], | 1060 | 981: _MsgType_name[11919:11940], |
1054 | 1001: _MsgType_name[11924:11955], | 1061 | 982: _MsgType_name[11940:11968], |
1055 | 1002: _MsgType_name[11955:11982], | 1062 | 983: _MsgType_name[11968:11990], |
1056 | 1003: _MsgType_name[11982:12010], | 1063 | 984: _MsgType_name[11990:12019], |
1057 | 1004: _MsgType_name[12010:12057], | 1064 | 1000: _MsgType_name[12019:12046], |
1058 | 1005: _MsgType_name[12057:12102], | 1065 | 1001: _MsgType_name[12046:12077], |
1059 | 1006: _MsgType_name[12102:12133], | 1066 | 1002: _MsgType_name[12077:12104], |
1060 | 1007: _MsgType_name[12133:12152], | 1067 | 1003: _MsgType_name[12104:12132], |
1061 | 1008: _MsgType_name[12152:12178], | 1068 | 1004: _MsgType_name[12132:12179], |
1062 | 1009: _MsgType_name[12178:12202], | 1069 | 1005: _MsgType_name[12179:12224], |
1063 | 1010: _MsgType_name[12202:12228], | 1070 | 1006: _MsgType_name[12224:12255], |
1064 | 1011: _MsgType_name[12228:12258], | 1071 | 1007: _MsgType_name[12255:12274], |
1065 | 1012: _MsgType_name[12258:12285], | 1072 | 1008: _MsgType_name[12274:12300], |
1066 | 1013: _MsgType_name[12285:12307], | 1073 | 1009: _MsgType_name[12300:12324], |
1067 | 1014: _MsgType_name[12307:12332], | 1074 | 1010: _MsgType_name[12324:12350], |
1068 | 1015: _MsgType_name[12332:12358], | 1075 | 1011: _MsgType_name[12350:12380], |
1069 | 1016: _MsgType_name[12358:12396], | 1076 | 1012: _MsgType_name[12380:12407], |
1070 | 1020: _MsgType_name[12396:12416], | 1077 | 1013: _MsgType_name[12407:12429], |
1071 | 1021: _MsgType_name[12416:12435], | 1078 | 1014: _MsgType_name[12429:12454], |
1072 | 1022: _MsgType_name[12435:12460], | 1079 | 1015: _MsgType_name[12454:12480], |
1073 | 1023: _MsgType_name[12460:12486], | 1080 | 1016: _MsgType_name[12480:12518], |
1074 | 1024: _MsgType_name[12486:12516], | 1081 | 1020: _MsgType_name[12518:12538], |
1075 | 1025: _MsgType_name[12516:12547], | 1082 | 1021: _MsgType_name[12538:12557], |
1076 | 1030: _MsgType_name[12547:12583], | 1083 | 1022: _MsgType_name[12557:12582], |
1077 | 1031: _MsgType_name[12583:12611], | 1084 | 1023: _MsgType_name[12582:12608], |
1078 | 1032: _MsgType_name[12611:12643], | 1085 | 1024: _MsgType_name[12608:12638], |
1079 | 1033: _MsgType_name[12643:12677], | 1086 | 1025: _MsgType_name[12638:12669], |
1080 | 1034: _MsgType_name[12677:12703], | 1087 | 1030: _MsgType_name[12669:12705], |
1081 | 1035: _MsgType_name[12703:12733], | 1088 | 1031: _MsgType_name[12705:12733], |
1082 | 1036: _MsgType_name[12733:12766], | 1089 | 1032: _MsgType_name[12733:12765], |
1083 | 1037: _MsgType_name[12766:12791], | 1090 | 1033: _MsgType_name[12765:12799], |
1084 | 1038: _MsgType_name[12791:12820], | 1091 | 1034: _MsgType_name[12799:12825], |
1085 | 1039: _MsgType_name[12820:12856], | 1092 | 1035: _MsgType_name[12825:12855], |
1086 | 1040: _MsgType_name[12856:12884], | 1093 | 1036: _MsgType_name[12855:12888], |
1087 | 1041: _MsgType_name[12884:12916], | 1094 | 1037: _MsgType_name[12888:12913], |
1088 | 1059: _MsgType_name[12916:12929], | 1095 | 1038: _MsgType_name[12913:12942], |
1089 | 1060: _MsgType_name[12929:12945], | 1096 | 1039: _MsgType_name[12942:12978], |
1090 | 1061: _MsgType_name[12945:12964], | 1097 | 1040: _MsgType_name[12978:13006], |
1091 | 1062: _MsgType_name[12964:12999], | 1098 | 1041: _MsgType_name[13006:13038], |
1092 | 1063: _MsgType_name[12999:13036], | 1099 | 1059: _MsgType_name[13038:13051], |
1093 | 1064: _MsgType_name[13036:13058], | 1100 | 1060: _MsgType_name[13051:13067], |
1094 | 1065: _MsgType_name[13058:13081], | 1101 | 1061: _MsgType_name[13067:13086], |
1095 | 1066: _MsgType_name[13081:13105], | 1102 | 1062: _MsgType_name[13086:13121], |
1096 | 1110: _MsgType_name[13105:13130], | 1103 | 1063: _MsgType_name[13121:13158], |
1097 | 1111: _MsgType_name[13130:13153], | 1104 | 1064: _MsgType_name[13158:13180], |
1098 | 1112: _MsgType_name[13153:13179], | 1105 | 1065: _MsgType_name[13180:13203], |
1099 | 1130: _MsgType_name[13179:13208], | 1106 | 1066: _MsgType_name[13203:13227], |
1100 | 1131: _MsgType_name[13208:13235], | 1107 | 1110: _MsgType_name[13227:13252], |
1101 | 1132: _MsgType_name[13235:13263], | 1108 | 1111: _MsgType_name[13252:13275], |
1102 | 1133: _MsgType_name[13263:13294], | 1109 | 1112: _MsgType_name[13275:13301], |
1103 | 1134: _MsgType_name[13294:13323], | 1110 | 1130: _MsgType_name[13301:13330], |
1104 | 1135: _MsgType_name[13323:13353], | 1111 | 1131: _MsgType_name[13330:13357], |
1105 | 65535: _MsgType_name[13353:13360], | 1112 | 1132: _MsgType_name[13357:13385], |
1113 | 1133: _MsgType_name[13385:13416], | ||
1114 | 1134: _MsgType_name[13416:13445], | ||
1115 | 1135: _MsgType_name[13445:13475], | ||
1116 | 1750: _MsgType_name[13475:13499], | ||
1117 | 1751: _MsgType_name[13499:13530], | ||
1118 | 1752: _MsgType_name[13530:13555], | ||
1119 | 65535: _MsgType_name[13555:13562], | ||
1106 | } | 1120 | } |
1107 | 1121 | ||
1108 | func (i MsgType) String() string { | 1122 | func (i MsgType) String() string { |
diff --git a/src/gnunet/enums/signature.go b/src/gnunet/enums/signature.go deleted file mode 100644 index 0c5cd5c..0000000 --- a/src/gnunet/enums/signature.go +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | // This file is part of gnunet-go, a GNUnet-implementation in Golang. | ||
2 | // Copyright (C) 2019-2022 Bernd Fix >Y< | ||
3 | // | ||
4 | // gnunet-go is free software: you can redistribute it and/or modify it | ||
5 | // under the terms of the GNU Affero General Public License as published | ||
6 | // by the Free Software Foundation, either version 3 of the License, | ||
7 | // or (at your option) any later version. | ||
8 | // | ||
9 | // gnunet-go is distributed in the hope that it will be useful, but | ||
10 | // WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | // Affero General Public License for more details. | ||
13 | // | ||
14 | // You should have received a copy of the GNU Affero General Public License | ||
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | // | ||
17 | // SPDX-License-Identifier: AGPL3.0-or-later | ||
18 | |||
19 | package enums | ||
20 | |||
21 | //go:generate go run generate.go gnunet-signature.rec gnunet-signature.tpl signature_purpose.go | ||
22 | |||
23 | //go:generate stringer -type=SigPurpose signature_purpose.go | ||
diff --git a/src/gnunet/enums/signature_purpose.go b/src/gnunet/enums/signature_purpose.go index 31f6eca..89e9f45 100644 --- a/src/gnunet/enums/signature_purpose.go +++ b/src/gnunet/enums/signature_purpose.go | |||
@@ -39,5 +39,6 @@ SIG_TRANSPORT_CHALLENGE SigPurpose = 35 // Signature by a peer affirming that it | |||
39 | SIG_TRANSPORT_DV_HOP SigPurpose = 36 // Signature by a peer affirming that it is on a DV path. | 39 | SIG_TRANSPORT_DV_HOP SigPurpose = 36 // Signature by a peer affirming that it is on a DV path. |
40 | SIG_TRANSPORT_DV_INITIATOR SigPurpose = 37 // Signature by a peer affirming that it originated the DV path. | 40 | SIG_TRANSPORT_DV_INITIATOR SigPurpose = 37 // Signature by a peer affirming that it originated the DV path. |
41 | SIG_CADET_CONNECTION_INITIATOR SigPurpose = 38 // Signature by a peer that like to create a connection. | 41 | SIG_CADET_CONNECTION_INITIATOR SigPurpose = 38 // Signature by a peer that like to create a connection. |
42 | SIG_COMMUNICATOR_TCP_HANDSHAKE_ACK SigPurpose = 39 // Signature by a peer sending back the nonce received at initial handshake. | ||
42 | 43 | ||
43 | ) | 44 | ) |
diff --git a/src/gnunet/enums/sigpurpose_string.go b/src/gnunet/enums/sigpurpose_string.go index dd392ab..4c6111c 100644 --- a/src/gnunet/enums/sigpurpose_string.go +++ b/src/gnunet/enums/sigpurpose_string.go | |||
@@ -40,20 +40,21 @@ func _() { | |||
40 | _ = x[SIG_TRANSPORT_DV_HOP-36] | 40 | _ = x[SIG_TRANSPORT_DV_HOP-36] |
41 | _ = x[SIG_TRANSPORT_DV_INITIATOR-37] | 41 | _ = x[SIG_TRANSPORT_DV_INITIATOR-37] |
42 | _ = x[SIG_CADET_CONNECTION_INITIATOR-38] | 42 | _ = x[SIG_CADET_CONNECTION_INITIATOR-38] |
43 | _ = x[SIG_COMMUNICATOR_TCP_HANDSHAKE_ACK-39] | ||
43 | } | 44 | } |
44 | 45 | ||
45 | const ( | 46 | const ( |
46 | _SigPurpose_name_0 = "SIG_TESTSIG_TRANSPORT_PONG_OWNSIG_TRANSPORT_DISCONNECTSIG_REVOCATIONSIG_NAMESPACE_ADVERTISEMENTSIG_PEER_PLACEMENTSIG_DHT_HOPSIG_HELLO" | 47 | _SigPurpose_name_0 = "SIG_TESTSIG_TRANSPORT_PONG_OWNSIG_TRANSPORT_DISCONNECTSIG_REVOCATIONSIG_NAMESPACE_ADVERTISEMENTSIG_PEER_PLACEMENTSIG_DHT_HOPSIG_HELLO" |
47 | _SigPurpose_name_1 = "SIG_DNS_RECORDSIG_CHAT_MESSAGESIG_CHAT_RECEIPTSIG_NSE_SENDSIG_GNS_RECORD_SIGNSIG_SET_ECC_KEYSIG_FS_UBLOCKSIG_REGEX_ACCEPT" | 48 | _SigPurpose_name_1 = "SIG_DNS_RECORDSIG_CHAT_MESSAGESIG_CHAT_RECEIPTSIG_NSE_SENDSIG_GNS_RECORD_SIGNSIG_SET_ECC_KEYSIG_FS_UBLOCKSIG_REGEX_ACCEPT" |
48 | _SigPurpose_name_2 = "SIG_CONVERSATION_RINGSIG_SECRETSHARING_DKG1SIG_SECRETSHARING_DKG2SIG_SECRETSHARING_DECRYPTION" | 49 | _SigPurpose_name_2 = "SIG_CONVERSATION_RINGSIG_SECRETSHARING_DKG1SIG_SECRETSHARING_DKG2SIG_SECRETSHARING_DECRYPTION" |
49 | _SigPurpose_name_3 = "SIG_RECLAIM_CODE_SIGNSIG_DELEGATESIG_TRANSPORT_ADDRESSSIG_TRANSPORT_EPHEMERALSIG_COMMUNICATOR_TCP_HANDSHAKESIG_COMMUNICATOR_TCP_REKEYSIG_COMMUNICATOR_UDP_HANDSHAKESIG_COMMUNICATOR_UDP_BROADCASTSIG_TRANSPORT_CHALLENGESIG_TRANSPORT_DV_HOPSIG_TRANSPORT_DV_INITIATORSIG_CADET_CONNECTION_INITIATOR" | 50 | _SigPurpose_name_3 = "SIG_RECLAIM_CODE_SIGNSIG_DELEGATESIG_TRANSPORT_ADDRESSSIG_TRANSPORT_EPHEMERALSIG_COMMUNICATOR_TCP_HANDSHAKESIG_COMMUNICATOR_TCP_REKEYSIG_COMMUNICATOR_UDP_HANDSHAKESIG_COMMUNICATOR_UDP_BROADCASTSIG_TRANSPORT_CHALLENGESIG_TRANSPORT_DV_HOPSIG_TRANSPORT_DV_INITIATORSIG_CADET_CONNECTION_INITIATORSIG_COMMUNICATOR_TCP_HANDSHAKE_ACK" |
50 | ) | 51 | ) |
51 | 52 | ||
52 | var ( | 53 | var ( |
53 | _SigPurpose_index_0 = [...]uint8{0, 8, 30, 54, 68, 95, 113, 124, 133} | 54 | _SigPurpose_index_0 = [...]uint8{0, 8, 30, 54, 68, 95, 113, 124, 133} |
54 | _SigPurpose_index_1 = [...]uint8{0, 14, 30, 46, 58, 77, 92, 105, 121} | 55 | _SigPurpose_index_1 = [...]uint8{0, 14, 30, 46, 58, 77, 92, 105, 121} |
55 | _SigPurpose_index_2 = [...]uint8{0, 21, 43, 65, 93} | 56 | _SigPurpose_index_2 = [...]uint8{0, 21, 43, 65, 93} |
56 | _SigPurpose_index_3 = [...]uint16{0, 21, 33, 54, 77, 107, 133, 163, 193, 216, 236, 262, 292} | 57 | _SigPurpose_index_3 = [...]uint16{0, 21, 33, 54, 77, 107, 133, 163, 193, 216, 236, 262, 292, 326} |
57 | ) | 58 | ) |
58 | 59 | ||
59 | func (i SigPurpose) String() string { | 60 | func (i SigPurpose) String() string { |
@@ -66,7 +67,7 @@ func (i SigPurpose) String() string { | |||
66 | case 20 <= i && i <= 23: | 67 | case 20 <= i && i <= 23: |
67 | i -= 20 | 68 | i -= 20 |
68 | return _SigPurpose_name_2[_SigPurpose_index_2[i]:_SigPurpose_index_2[i+1]] | 69 | return _SigPurpose_name_2[_SigPurpose_index_2[i]:_SigPurpose_index_2[i+1]] |
69 | case 27 <= i && i <= 38: | 70 | case 27 <= i && i <= 39: |
70 | i -= 27 | 71 | i -= 27 |
71 | return _SigPurpose_name_3[_SigPurpose_index_3[i]:_SigPurpose_index_3[i+1]] | 72 | return _SigPurpose_name_3[_SigPurpose_index_3[i]:_SigPurpose_index_3[i+1]] |
72 | default: | 73 | default: |
diff --git a/src/gnunet/go.mod b/src/gnunet/go.mod index 6e0021b..4c12af3 100644 --- a/src/gnunet/go.mod +++ b/src/gnunet/go.mod | |||
@@ -1,6 +1,6 @@ | |||
1 | module gnunet | 1 | module gnunet |
2 | 2 | ||
3 | go 1.18 | 3 | go 1.19 |
4 | 4 | ||
5 | require ( | 5 | require ( |
6 | github.com/bfix/gospel v1.2.21 | 6 | github.com/bfix/gospel v1.2.21 |
diff --git a/src/gnunet/message/factory.go b/src/gnunet/message/factory.go index e3a2943..26d23c4 100644 --- a/src/gnunet/message/factory.go +++ b/src/gnunet/message/factory.go | |||
@@ -128,7 +128,7 @@ func NewEmptyMessage(msgType enums.MsgType) (Message, error) { | |||
128 | case enums.MSG_IDENTITY_START: | 128 | case enums.MSG_IDENTITY_START: |
129 | return NewIdentityStartMsg(), nil | 129 | return NewIdentityStartMsg(), nil |
130 | case enums.MSG_IDENTITY_RESULT_CODE: | 130 | case enums.MSG_IDENTITY_RESULT_CODE: |
131 | return NewIdentityResultCodeMsg(enums.RC_OK, ""), nil | 131 | return NewIdentityResultCodeMsg(0), nil |
132 | case enums.MSG_IDENTITY_UPDATE: | 132 | case enums.MSG_IDENTITY_UPDATE: |
133 | return NewIdentityUpdateMsg("", nil), nil | 133 | return NewIdentityUpdateMsg("", nil), nil |
134 | case enums.MSG_IDENTITY_CREATE: | 134 | case enums.MSG_IDENTITY_CREATE: |
@@ -139,30 +139,38 @@ func NewEmptyMessage(msgType enums.MsgType) (Message, error) { | |||
139 | return NewIdentityDeleteMsg(""), nil | 139 | return NewIdentityDeleteMsg(""), nil |
140 | case enums.MSG_IDENTITY_LOOKUP: | 140 | case enums.MSG_IDENTITY_LOOKUP: |
141 | return NewIdentityLookupMsg(""), nil | 141 | return NewIdentityLookupMsg(""), nil |
142 | case enums.MSG_IDENTITY_GET_DEFAULT: | ||
143 | return NewIdentityGetDefaultMsg(""), nil | ||
144 | case enums.MSG_IDENTITY_SET_DEFAULT: | ||
145 | return NewIdentitySetDefaultMsg(nil, ""), nil | ||
146 | 142 | ||
147 | //------------------------------------------------------------------ | 143 | //------------------------------------------------------------------ |
148 | // Namestore service | 144 | // Namestore service |
149 | //------------------------------------------------------------------ | 145 | //------------------------------------------------------------------ |
150 | 146 | ||
151 | case enums.MSG_NAMESTORE_ZONE_ITERATION_START: | 147 | case enums.MSG_NAMESTORE_ZONE_ITERATION_START: |
152 | return NewNamestoreZoneIterStartMsg(nil), nil | 148 | return NewNamestoreZoneIterStartMsg(0, 0, nil), nil |
153 | case enums.MSG_NAMESTORE_ZONE_ITERATION_NEXT: | 149 | case enums.MSG_NAMESTORE_ZONE_ITERATION_NEXT: |
150 | return NewNamestoreZoneIterNextMsg(0, 0), nil | ||
154 | case enums.MSG_NAMESTORE_ZONE_ITERATION_STOP: | 151 | case enums.MSG_NAMESTORE_ZONE_ITERATION_STOP: |
152 | return NewNamestoreZoneIterStopMsg(0), nil | ||
153 | case enums.MSG_NAMESTORE_ZONE_ITERATION_END: | ||
154 | return NewNamestoreZoneIterEndMsg(0), nil | ||
155 | case enums.MSG_NAMESTORE_RECORD_STORE: | 155 | case enums.MSG_NAMESTORE_RECORD_STORE: |
156 | return NewNamestoreRecordStoreMsg(0, nil), nil | ||
156 | case enums.MSG_NAMESTORE_RECORD_STORE_RESPONSE: | 157 | case enums.MSG_NAMESTORE_RECORD_STORE_RESPONSE: |
158 | return NewNamestoreRecordStoreRespMsg(0, 0), nil | ||
157 | case enums.MSG_NAMESTORE_RECORD_LOOKUP: | 159 | case enums.MSG_NAMESTORE_RECORD_LOOKUP: |
160 | return NewNamestoreRecordLookupMsg(0, nil, "", false), nil | ||
158 | case enums.MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE: | 161 | case enums.MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE: |
162 | return NewNamestoreRecordLookupRespMsg(0, nil, ""), nil | ||
163 | case enums.MSG_NAMESTORE_RECORD_RESULT: | ||
164 | return NewNamestoreRecordResultMsg(0, nil, ""), nil | ||
159 | case enums.MSG_NAMESTORE_ZONE_TO_NAME: | 165 | case enums.MSG_NAMESTORE_ZONE_TO_NAME: |
166 | return NewNamestoreZoneToNameMsg(0, nil, nil), nil | ||
160 | case enums.MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE: | 167 | case enums.MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE: |
168 | return NewNamestoreZoneToNameRespMsg(0, nil, "", 0), nil | ||
161 | case enums.MSG_NAMESTORE_MONITOR_START: | 169 | case enums.MSG_NAMESTORE_MONITOR_START: |
162 | case enums.MSG_NAMESTORE_MONITOR_SYNC: | 170 | return NewNamestoreMonitorStartMsg(0, nil, 0, 0), nil |
163 | case enums.MSG_NAMESTORE_RECORD_RESULT: | ||
164 | return NewNamestoreRecordResultMsg(nil, ""), nil | ||
165 | case enums.MSG_NAMESTORE_MONITOR_NEXT: | 171 | case enums.MSG_NAMESTORE_MONITOR_NEXT: |
172 | return NewNamestoreMonitorNextMsg(0, 0), nil | ||
173 | case enums.MSG_NAMESTORE_MONITOR_SYNC: | ||
166 | } | 174 | } |
167 | return nil, fmt.Errorf("unknown message type %d", msgType) | 175 | return nil, fmt.Errorf("unknown message type %d", msgType) |
168 | } | 176 | } |
diff --git a/src/gnunet/message/msg_identity.go b/src/gnunet/message/msg_identity.go index fb8bba5..f22f328 100644 --- a/src/gnunet/message/msg_identity.go +++ b/src/gnunet/message/msg_identity.go | |||
@@ -62,35 +62,43 @@ func (msg *IdentityStartMsg) String() string { | |||
62 | type IdentityUpdateMsg struct { | 62 | type IdentityUpdateMsg struct { |
63 | MsgHeader | 63 | MsgHeader |
64 | 64 | ||
65 | NameLen uint16 `order:"big"` | 65 | NameLen uint16 `order:"big"` // length of name |
66 | EOL uint16 `order:"big"` | 66 | EOL uint16 `order:"big"` // flag for "end-of-list" |
67 | ZoneKey *crypto.ZonePrivate `init:"Init"` | 67 | KeyLen uint16 `order:"big"` // length of key |
68 | Name_ []byte `size:"NameLen"` | 68 | Reserved uint16 `order:"big"` // reserved |
69 | Name_ []byte `size:"NameLen"` // label name | ||
70 | ZoneKey *crypto.ZonePrivate `init:"Init" opt:"(IsUsed)"` // zone key | ||
69 | 71 | ||
70 | // transient state | 72 | // transient state |
71 | name string | 73 | name string |
72 | } | 74 | } |
73 | 75 | ||
76 | // IsUsed to decide if key is used in message | ||
77 | func (msg *IdentityUpdateMsg) IsUsed(fld string) bool { | ||
78 | return msg.EOL != uint16(enums.RC_YES) | ||
79 | } | ||
80 | |||
74 | // NewIdentityUpdateMsg creates an update message. If the zone key is nil, | 81 | // NewIdentityUpdateMsg creates an update message. If the zone key is nil, |
75 | // a End-Of-List is triggered so the client knows we are done. | 82 | // a End-Of-List is triggered so the client knows we are done. |
76 | func NewIdentityUpdateMsg(name string, zk *crypto.ZonePrivate) *IdentityUpdateMsg { | 83 | func NewIdentityUpdateMsg(name string, zk *crypto.ZonePrivate) *IdentityUpdateMsg { |
84 | var kl uint16 | ||
85 | if zk != nil { | ||
86 | kl = uint16(zk.KeySize() + 4) | ||
87 | } | ||
88 | nl := uint16(len(name) + 1) | ||
89 | size := kl + nl + 12 | ||
77 | msg := &IdentityUpdateMsg{ | 90 | msg := &IdentityUpdateMsg{ |
78 | MsgHeader: MsgHeader{8, enums.MSG_IDENTITY_UPDATE}, | 91 | MsgHeader: MsgHeader{size, enums.MSG_IDENTITY_UPDATE}, |
92 | name: name, | ||
93 | Name_: util.WriteCString(name), | ||
94 | NameLen: nl, | ||
95 | KeyLen: kl, | ||
79 | } | 96 | } |
80 | if zk == nil { | 97 | if zk == nil { |
81 | // tag end-of-list | 98 | // tag end-of-list |
82 | msg.EOL = uint16(enums.RC_YES) | 99 | msg.EOL = uint16(enums.RC_YES) |
83 | var size uint16 | ||
84 | // assemble an empty zonekey | ||
85 | msg.ZoneKey, size = crypto.NullZonePrivate(enums.GNS_TYPE_PKEY) | ||
86 | msg.MsgSize += size | ||
87 | } else { | 100 | } else { |
88 | msg.name = name | ||
89 | msg.Name_ = util.WriteCString(name) | ||
90 | msg.NameLen = uint16(len(msg.Name_)) | ||
91 | msg.MsgSize += msg.NameLen | ||
92 | msg.ZoneKey = zk | 101 | msg.ZoneKey = zk |
93 | msg.MsgSize += uint16(zk.KeySize() + 4) | ||
94 | } | 102 | } |
95 | return msg | 103 | return msg |
96 | } | 104 | } |
@@ -124,37 +132,27 @@ func (msg *IdentityUpdateMsg) Name() string { | |||
124 | type IdentityResultCodeMsg struct { | 132 | type IdentityResultCodeMsg struct { |
125 | MsgHeader | 133 | MsgHeader |
126 | 134 | ||
127 | ResultCode enums.ResultCode `order:"big"` | 135 | ResultCode uint32 `order:"big"` |
128 | Error string `opt:"(OnError)"` | ||
129 | } | ||
130 | |||
131 | // OnError returns true if an error message is attached | ||
132 | func (msg *IdentityResultCodeMsg) OnError() bool { | ||
133 | return msg.ResultCode != enums.RC_OK | ||
134 | } | 136 | } |
135 | 137 | ||
136 | // Init called after unmarshalling a message to setup internal state | 138 | // Init called after unmarshalling a message to setup internal state |
137 | func (msg *IdentityResultCodeMsg) Init() error { return nil } | 139 | func (msg *IdentityResultCodeMsg) Init() error { return nil } |
138 | 140 | ||
139 | // NewIdentityResultCodeMsg creates a new default message. | 141 | // NewIdentityResultCodeMsg creates a new default message. |
140 | func NewIdentityResultCodeMsg(rc enums.ResultCode, err string) *IdentityResultCodeMsg { | 142 | func NewIdentityResultCodeMsg(rc int) *IdentityResultCodeMsg { |
141 | msg := &IdentityResultCodeMsg{ | 143 | msg := &IdentityResultCodeMsg{ |
142 | MsgHeader: MsgHeader{ | 144 | MsgHeader: MsgHeader{ |
143 | MsgSize: 8, | 145 | MsgSize: 8, |
144 | MsgType: enums.MSG_IDENTITY_RESULT_CODE, | 146 | MsgType: enums.MSG_IDENTITY_RESULT_CODE, |
145 | }, | 147 | }, |
146 | ResultCode: rc, | 148 | ResultCode: uint32(rc), |
147 | } | ||
148 | if rc != enums.RC_OK { | ||
149 | msg.Error = err | ||
150 | msg.MsgSize += uint16(len(err) + 1) | ||
151 | } | 149 | } |
152 | return msg | 150 | return msg |
153 | } | 151 | } |
154 | 152 | ||
155 | // String returns a human-readable representation of the message. | 153 | // String returns a human-readable representation of the message. |
156 | func (msg *IdentityResultCodeMsg) String() string { | 154 | func (msg *IdentityResultCodeMsg) String() string { |
157 | return fmt.Sprintf("IdentityResultCodeMsg{rc=%d,err='%s'}", msg.ResultCode, msg.Error) | 155 | return fmt.Sprintf("IdentityResultCodeMsg{rc=%d}", msg.ResultCode) |
158 | } | 156 | } |
159 | 157 | ||
160 | //---------------------------------------------------------------------- | 158 | //---------------------------------------------------------------------- |
@@ -167,10 +165,10 @@ func (msg *IdentityResultCodeMsg) String() string { | |||
167 | type IdentityCreateMsg struct { | 165 | type IdentityCreateMsg struct { |
168 | MsgHeader | 166 | MsgHeader |
169 | 167 | ||
170 | NameLen uint16 `order:"big"` | 168 | NameLen uint16 `order:"big"` // length of label name |
171 | Reserved uint16 `order:"big"` | 169 | KeyLen uint16 `order:"big"` // length of key |
172 | ZoneKey *crypto.ZonePrivate `init:"Init"` | 170 | ZoneKey *crypto.ZonePrivate `init:"Init"` // zone key |
173 | Name_ []byte `size:"NameLen"` | 171 | Name_ []byte `size:"NameLen"` // label name |
174 | 172 | ||
175 | // transient state | 173 | // transient state |
176 | name string | 174 | name string |
@@ -361,113 +359,3 @@ func NewIdentityLookupMsg(name string) *IdentityLookupMsg { | |||
361 | func (msg *IdentityLookupMsg) String() string { | 359 | func (msg *IdentityLookupMsg) String() string { |
362 | return fmt.Sprintf("IdentityLookupMsg{name='%s'}", msg.Name) | 360 | return fmt.Sprintf("IdentityLookupMsg{name='%s'}", msg.Name) |
363 | } | 361 | } |
364 | |||
365 | //---------------------------------------------------------------------- | ||
366 | // MSG_IDENTITY_GET_DEFAULT | ||
367 | // | ||
368 | // Get the default identity for named subsystem | ||
369 | //---------------------------------------------------------------------- | ||
370 | |||
371 | // IdentityGetDefault to retrieve the default identity for a service | ||
372 | type IdentityGetDefaultMsg struct { | ||
373 | MsgHeader | ||
374 | |||
375 | SrvLen uint16 `order:"big"` | ||
376 | Reserved uint16 `order:"big"` | ||
377 | Service_ []byte `size:"SrvLen"` | ||
378 | |||
379 | // transient state | ||
380 | service string | ||
381 | } | ||
382 | |||
383 | // Init called after unmarshalling a message to setup internal state | ||
384 | func (msg *IdentityGetDefaultMsg) Init() error { | ||
385 | msg.service, _ = util.ReadCString(msg.Service_, 0) | ||
386 | return nil | ||
387 | } | ||
388 | |||
389 | // NewIdentityGetDefaultMsg creates a new message | ||
390 | func NewIdentityGetDefaultMsg(svc string) *IdentityGetDefaultMsg { | ||
391 | msg := &IdentityGetDefaultMsg{ | ||
392 | MsgHeader: MsgHeader{ | ||
393 | MsgSize: 8, | ||
394 | MsgType: enums.MSG_IDENTITY_DELETE, | ||
395 | }, | ||
396 | } | ||
397 | if len(svc) > 0 { | ||
398 | msg.Service_ = util.WriteCString(svc) | ||
399 | msg.MsgSize += uint16(len(msg.Service_)) | ||
400 | msg.service = svc | ||
401 | } | ||
402 | return msg | ||
403 | } | ||
404 | |||
405 | // String returns a human-readable representation of the message. | ||
406 | func (msg *IdentityGetDefaultMsg) String() string { | ||
407 | return fmt.Sprintf("IdentityGetDefaultMsg{svc='%s'}", msg.service) | ||
408 | } | ||
409 | |||
410 | // Service name | ||
411 | func (msg *IdentityGetDefaultMsg) Service() string { | ||
412 | return msg.service | ||
413 | } | ||
414 | |||
415 | //---------------------------------------------------------------------- | ||
416 | // MSG_IDENTITY_SET_DEFAULT | ||
417 | // | ||
418 | // Set default identity for named subsystem | ||
419 | //---------------------------------------------------------------------- | ||
420 | |||
421 | // IdentitySetDefaultMsg sets a default identity (key) for a service | ||
422 | type IdentitySetDefaultMsg struct { | ||
423 | MsgHeader | ||
424 | |||
425 | SrvLen uint16 `order:"big"` | ||
426 | Reserved uint16 `order:"big"` | ||
427 | ZoneKey *crypto.ZonePrivate `init:"Init"` | ||
428 | Service_ []byte `size:"SrvLen"` | ||
429 | |||
430 | // transient state | ||
431 | service string | ||
432 | } | ||
433 | |||
434 | // Init called after unmarshalling a message to setup internal state | ||
435 | func (msg *IdentitySetDefaultMsg) Init() error { | ||
436 | msg.service, _ = util.ReadCString(msg.Service_, 0) | ||
437 | return nil | ||
438 | } | ||
439 | |||
440 | // NewIdentitySetDefaultMsg renames an identity | ||
441 | func NewIdentitySetDefaultMsg(zk *crypto.ZonePrivate, svc string) *IdentitySetDefaultMsg { | ||
442 | msg := &IdentitySetDefaultMsg{ | ||
443 | MsgHeader: MsgHeader{ | ||
444 | MsgSize: 8, | ||
445 | MsgType: enums.MSG_IDENTITY_DELETE, | ||
446 | }, | ||
447 | } | ||
448 | if zk == nil { | ||
449 | // assemble an empty zonekey | ||
450 | var size uint16 | ||
451 | msg.ZoneKey, size = crypto.NullZonePrivate(enums.GNS_TYPE_PKEY) | ||
452 | msg.MsgSize += size | ||
453 | } else { | ||
454 | msg.ZoneKey = zk | ||
455 | msg.MsgSize += uint16(zk.KeySize() + 4) | ||
456 | } | ||
457 | if len(svc) > 0 { | ||
458 | msg.Service_ = util.WriteCString(svc) | ||
459 | msg.MsgSize += uint16(len(msg.Service_)) | ||
460 | msg.service = svc | ||
461 | } | ||
462 | return msg | ||
463 | } | ||
464 | |||
465 | // String returns a human-readable representation of the message. | ||
466 | func (msg *IdentitySetDefaultMsg) String() string { | ||
467 | return fmt.Sprintf("IdentitySetDefaultMsg{key=%s,svc='%s'}", msg.ZoneKey.ID(), msg.service) | ||
468 | } | ||
469 | |||
470 | // Service name | ||
471 | func (msg *IdentitySetDefaultMsg) Service() string { | ||
472 | return msg.service | ||
473 | } | ||
diff --git a/src/gnunet/message/msg_namestore.go b/src/gnunet/message/msg_namestore.go index f03ef2c..9241e17 100644 --- a/src/gnunet/message/msg_namestore.go +++ b/src/gnunet/message/msg_namestore.go | |||
@@ -24,6 +24,8 @@ import ( | |||
24 | "gnunet/enums" | 24 | "gnunet/enums" |
25 | "gnunet/service/dht/blocks" | 25 | "gnunet/service/dht/blocks" |
26 | "gnunet/util" | 26 | "gnunet/util" |
27 | |||
28 | "github.com/bfix/gospel/data" | ||
27 | ) | 29 | ) |
28 | 30 | ||
29 | //====================================================================== | 31 | //====================================================================== |
@@ -37,10 +39,10 @@ type GenericNamestoreMsg struct { | |||
37 | } | 39 | } |
38 | 40 | ||
39 | // return initialized common message header | 41 | // return initialized common message header |
40 | func newGenericNamestoreMsg(size uint16, mtype enums.MsgType) GenericNamestoreMsg { | 42 | func newGenericNamestoreMsg(id uint32, size uint16, mtype enums.MsgType) GenericNamestoreMsg { |
41 | return GenericNamestoreMsg{ | 43 | return GenericNamestoreMsg{ |
42 | MsgHeader: MsgHeader{size, mtype}, | 44 | MsgHeader: MsgHeader{size, mtype}, |
43 | ID: uint32(util.NextID()), | 45 | ID: id, |
44 | } | 46 | } |
45 | } | 47 | } |
46 | 48 | ||
@@ -48,18 +50,28 @@ func newGenericNamestoreMsg(size uint16, mtype enums.MsgType) GenericNamestoreMs | |||
48 | // MSG_NAMESTORE_ZONE_ITERATION_START | 50 | // MSG_NAMESTORE_ZONE_ITERATION_START |
49 | //---------------------------------------------------------------------- | 51 | //---------------------------------------------------------------------- |
50 | 52 | ||
51 | // NamestoreZoneIterStartMsg starts a new iteration over all zones | 53 | // NamestoreZoneIterStartMsg starts a new iteration over all labels in a zones |
52 | type NamestoreZoneIterStartMsg struct { | 54 | type NamestoreZoneIterStartMsg struct { |
53 | GenericNamestoreMsg | 55 | GenericNamestoreMsg |
54 | 56 | ||
57 | Filter uint16 `order:"big"` // filter settings | ||
58 | KeyLen uint16 `order:"big"` // length of private key | ||
55 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | 59 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key |
56 | } | 60 | } |
57 | 61 | ||
58 | // NewNamecacheCacheMsg creates a new default message. | 62 | // NewNamecacheCacheMsg creates a new default message. |
59 | func NewNamestoreZoneIterStartMsg(zone *crypto.ZonePrivate) *NamestoreZoneIterStartMsg { | 63 | func NewNamestoreZoneIterStartMsg(id uint32, filter int, zone *crypto.ZonePrivate) *NamestoreZoneIterStartMsg { |
64 | var size uint16 = 16 | ||
65 | var kl uint16 = 0 | ||
66 | if zone != nil { | ||
67 | kl = uint16(zone.KeySize()) + 4 | ||
68 | size += kl | ||
69 | } | ||
60 | return &NamestoreZoneIterStartMsg{ | 70 | return &NamestoreZoneIterStartMsg{ |
61 | GenericNamestoreMsg: newGenericNamestoreMsg(100, enums.MSG_NAMESTORE_ZONE_ITERATION_START), | 71 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_ZONE_ITERATION_START), |
72 | Filter: uint16(filter), | ||
62 | ZoneKey: zone, | 73 | ZoneKey: zone, |
74 | KeyLen: kl, | ||
63 | } | 75 | } |
64 | } | 76 | } |
65 | 77 | ||
@@ -75,14 +87,19 @@ func (m *NamestoreZoneIterStartMsg) String() string { | |||
75 | // MSG_NAMESTORE_ZONE_ITERATION_NEXT | 87 | // MSG_NAMESTORE_ZONE_ITERATION_NEXT |
76 | //---------------------------------------------------------------------- | 88 | //---------------------------------------------------------------------- |
77 | 89 | ||
90 | // NamestoreZoneIterNextMsg returns the next labels | ||
78 | type NamestoreZoneIterNextMsg struct { | 91 | type NamestoreZoneIterNextMsg struct { |
79 | GenericNamestoreMsg | 92 | GenericNamestoreMsg |
80 | 93 | ||
81 | Limit uint64 `order:"big"` // max. number of records in one go | 94 | Limit uint64 `order:"big"` // max. number of records in one go |
82 | } | 95 | } |
83 | 96 | ||
84 | func NewNamestoreZoneIterNextMsg() *NamestoreZoneIterNextMsg { | 97 | // NewNamestoreZoneIterNextMsg creates a message with given limit |
85 | return &NamestoreZoneIterNextMsg{} | 98 | func NewNamestoreZoneIterNextMsg(id uint32, limit int) *NamestoreZoneIterNextMsg { |
99 | return &NamestoreZoneIterNextMsg{ | ||
100 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 16, enums.MSG_NAMESTORE_ZONE_ITERATION_NEXT), | ||
101 | Limit: uint64(limit), | ||
102 | } | ||
86 | } | 103 | } |
87 | 104 | ||
88 | // Init called after unmarshalling a message to setup internal state | 105 | // Init called after unmarshalling a message to setup internal state |
@@ -97,132 +114,593 @@ func (m *NamestoreZoneIterNextMsg) String() string { | |||
97 | // MSG_NAMESTORE_ZONE_ITERATION_STOP | 114 | // MSG_NAMESTORE_ZONE_ITERATION_STOP |
98 | //---------------------------------------------------------------------- | 115 | //---------------------------------------------------------------------- |
99 | 116 | ||
117 | // NamestoreZoneIterStopMsg stops a running iterator | ||
100 | type NamestoreZoneIterStopMsg struct { | 118 | type NamestoreZoneIterStopMsg struct { |
101 | GenericNamestoreMsg | 119 | GenericNamestoreMsg |
102 | } | 120 | } |
103 | 121 | ||
122 | // NewNamestoreZoneIterNextMsg creates a stop message | ||
123 | func NewNamestoreZoneIterStopMsg(id uint32) *NamestoreZoneIterStopMsg { | ||
124 | return &NamestoreZoneIterStopMsg{ | ||
125 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 8, enums.MSG_NAMESTORE_ZONE_ITERATION_STOP), | ||
126 | } | ||
127 | } | ||
128 | |||
129 | // Init called after unmarshalling a message to setup internal state | ||
130 | func (m *NamestoreZoneIterStopMsg) Init() error { return nil } | ||
131 | |||
132 | // String returns a human-readable representation of the message. | ||
133 | func (m *NamestoreZoneIterStopMsg) String() string { | ||
134 | return fmt.Sprintf("NamestoreZoneIterStopMsg{id=%d}", m.ID) | ||
135 | } | ||
136 | |||
137 | //---------------------------------------------------------------------- | ||
138 | // MSG_NAMESTORE_ZONE_ITERATION_END | ||
139 | //---------------------------------------------------------------------- | ||
140 | |||
141 | // NamestoreZoneIterEndMsg stops a running iterator | ||
142 | type NamestoreZoneIterEndMsg struct { | ||
143 | GenericNamestoreMsg | ||
144 | } | ||
145 | |||
146 | // NewNamestoreZoneIterEndMsg creates a stop message | ||
147 | func NewNamestoreZoneIterEndMsg(id uint32) *NamestoreZoneIterEndMsg { | ||
148 | return &NamestoreZoneIterEndMsg{ | ||
149 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 8, enums.MSG_NAMESTORE_ZONE_ITERATION_END), | ||
150 | } | ||
151 | } | ||
152 | |||
153 | // Init called after unmarshalling a message to setup internal state | ||
154 | func (m *NamestoreZoneIterEndMsg) Init() error { return nil } | ||
155 | |||
156 | // String returns a human-readable representation of the message. | ||
157 | func (m *NamestoreZoneIterEndMsg) String() string { | ||
158 | return fmt.Sprintf("NamestoreZoneIterEndMsg{id=%d}", m.ID) | ||
159 | } | ||
160 | |||
104 | //---------------------------------------------------------------------- | 161 | //---------------------------------------------------------------------- |
105 | // MSG_NAMESTORE_RECORD_RESULT | 162 | // MSG_NAMESTORE_RECORD_RESULT |
106 | //---------------------------------------------------------------------- | 163 | //---------------------------------------------------------------------- |
107 | 164 | ||
165 | // NamestoreRecordResultMsg returns the records for a label (name) | ||
108 | type NamestoreRecordResultMsg struct { | 166 | type NamestoreRecordResultMsg struct { |
109 | GenericNamestoreMsg | 167 | GenericNamestoreMsg |
110 | 168 | ||
111 | Expire util.AbsoluteTime `` // expiration date | 169 | Expire util.AbsoluteTime `` // expiration date |
112 | NameLen uint16 `order:"big"` // length of name | 170 | NameLen uint16 `order:"big"` // length of name |
113 | RdLen uint16 `order:"big"` // size of record data | 171 | RdLen uint16 `order:"big"` // size of record data |
114 | RdCount uint16 `order:"big"` // number of records | 172 | RdCount uint16 `order:"big"` // number of records |
115 | Reserved uint16 `order:"big"` // alignment | 173 | KeyLen uint16 `order:"big"` // length of key |
116 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | 174 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key |
117 | Name []byte `size:"NameLen"` // name string | 175 | Name []byte `size:"NameLen"` // name string |
118 | Records []byte `size:"RdLen"` // serialized record data | 176 | Records []byte `size:"RdLen"` // serialized record data |
177 | |||
178 | // transient state | ||
179 | recset *blocks.RecordSet | ||
119 | } | 180 | } |
120 | 181 | ||
121 | func NewNamestoreRecordResultMsg(zk *crypto.ZonePrivate, label string) *NamestoreRecordResultMsg { | 182 | // NewNamestoreRecordResultMsg returns an initialize record message |
183 | func NewNamestoreRecordResultMsg(id uint32, zk *crypto.ZonePrivate, label string) *NamestoreRecordResultMsg { | ||
184 | var kl uint16 | ||
185 | if zk != nil { | ||
186 | kl = uint16(zk.KeySize()) + 4 | ||
187 | } | ||
188 | nl := uint16(len(label) + 1) | ||
189 | size := kl + nl + 24 | ||
122 | return &NamestoreRecordResultMsg{ | 190 | return &NamestoreRecordResultMsg{ |
123 | Expire: util.AbsoluteTimeNever(), | 191 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_RECORD_RESULT), |
124 | ZoneKey: zk, | 192 | Expire: util.AbsoluteTimeNever(), |
125 | NameLen: uint16(len(label)), | 193 | KeyLen: kl, |
126 | Name: []byte(label), | 194 | ZoneKey: zk, |
127 | RdLen: 0, | 195 | NameLen: nl, |
128 | RdCount: 0, | 196 | Name: util.WriteCString(label), |
197 | RdLen: 0, | ||
198 | RdCount: 0, | ||
129 | } | 199 | } |
130 | } | 200 | } |
131 | 201 | ||
132 | // Init called after unmarshalling a message to setup internal state | 202 | // Init called after unmarshalling a message to setup internal state |
133 | func (m *NamestoreRecordResultMsg) Init() error { return nil } | 203 | func (m *NamestoreRecordResultMsg) Init() error { |
204 | if m.recset == nil { | ||
205 | m.recset = new(blocks.RecordSet) | ||
206 | return data.Unmarshal(m.recset, m.Records) | ||
207 | } | ||
208 | return nil | ||
209 | } | ||
210 | |||
211 | // AddRecords adds the record data to the message | ||
212 | func (m *NamestoreRecordResultMsg) AddRecords(rs *blocks.RecordSet) { | ||
213 | // make sure the record set is padded correctly | ||
214 | rs.SetPadding() | ||
215 | // copy recordset to message | ||
216 | m.RdCount = uint16(rs.Count) | ||
217 | m.Records = rs.RDATA() | ||
218 | m.RdLen = uint16(len(m.Records)) | ||
219 | m.MsgSize += m.RdLen | ||
220 | m.recset = rs | ||
221 | } | ||
222 | |||
223 | // GetRecords returns the record set contained in message | ||
224 | func (m *NamestoreRecordResultMsg) GetRecords() blocks.RecordSet { | ||
225 | return *m.recset | ||
226 | } | ||
134 | 227 | ||
135 | // String returns a human-readable representation of the message. | 228 | // String returns a human-readable representation of the message. |
136 | func (m *NamestoreRecordResultMsg) String() string { | 229 | func (m *NamestoreRecordResultMsg) String() string { |
137 | return fmt.Sprintf("NamestoreRecordResultMsg{id=%d,zone=%s,label='%s'}", m.ID, m.ZoneKey.ID(), string(m.Name)) | 230 | zone, label := "", "" |
231 | if !m.ZoneKey.IsNull() { | ||
232 | zone = fmt.Sprintf(",zone=%s", m.ZoneKey.ID()) | ||
233 | } | ||
234 | if m.NameLen > 0 { | ||
235 | lbl, _ := util.ReadCString(m.Name, 0) | ||
236 | label = fmt.Sprintf(",label='%s'", lbl) | ||
237 | } | ||
238 | return fmt.Sprintf("NamestoreRecordResultMsg{id=%d%s%s,%d records}", | ||
239 | m.ID, zone, label, m.RdCount) | ||
138 | } | 240 | } |
139 | 241 | ||
140 | //---------------------------------------------------------------------- | 242 | //---------------------------------------------------------------------- |
243 | // MSG_NAMESTORE_RECORD_STORE | ||
141 | //---------------------------------------------------------------------- | 244 | //---------------------------------------------------------------------- |
142 | 245 | ||
246 | // NamestoreRecordSet for a label | ||
247 | type NamestoreRecordSet struct { | ||
248 | NameLen uint16 `order:"big"` // Length of label | ||
249 | RdLen uint16 `order:"big"` // length of record data | ||
250 | RdCount uint16 `order:"big"` // number of records | ||
251 | Reserved uint16 `order:"big"` // reserved | ||
252 | Name []byte `size:"NameLen"` // label name | ||
253 | RecData []byte `size:"RdLen"` // record data | ||
254 | } | ||
255 | |||
256 | // NewNamestoreRecordSet for label and resource records. | ||
257 | func NewNamestoreRecordSet(label string, rr *blocks.RecordSet) (rs *NamestoreRecordSet, size uint16) { | ||
258 | // make sure the record set is padded correctly | ||
259 | rr.SetPadding() | ||
260 | |||
261 | // copy recordset to message | ||
262 | rs = new(NamestoreRecordSet) | ||
263 | rs.NameLen = uint16(len(label) + 1) | ||
264 | rs.Name = util.WriteCString(label) | ||
265 | rs.RdCount = uint16(rr.Count) | ||
266 | rs.RecData = rr.RDATA() | ||
267 | rs.RdLen = uint16(len(rs.RecData)) | ||
268 | size = rs.RdLen + rs.NameLen + 8 | ||
269 | return | ||
270 | } | ||
271 | |||
272 | //---------------------------------------------------------------------- | ||
273 | |||
274 | // NamestoreRecordStoreMsg for storing records (multiple labels at a | ||
275 | // time possible) | ||
143 | type NamestoreRecordStoreMsg struct { | 276 | type NamestoreRecordStoreMsg struct { |
144 | GenericNamestoreMsg | 277 | GenericNamestoreMsg |
145 | 278 | ||
146 | ZoneKey *crypto.ZonePrivate // private zone key | 279 | Count uint16 `order:"big"` // number of RecordSets |
147 | Records *blocks.RecordSet // list of records | 280 | KeyLen uint16 `order:"big"` // length of zone key |
281 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | ||
282 | RSets []*NamestoreRecordSet `size:"Count"` // list of label record sets | ||
283 | } | ||
284 | |||
285 | // NewNamestoreRecordStoreMsg creates an initialized message (without records) | ||
286 | func NewNamestoreRecordStoreMsg(id uint32, zk *crypto.ZonePrivate) *NamestoreRecordStoreMsg { | ||
287 | var kl uint16 | ||
288 | if zk != nil { | ||
289 | kl = uint16(zk.KeySize() + 4) | ||
290 | } | ||
291 | size := kl + 14 | ||
292 | return &NamestoreRecordStoreMsg{ | ||
293 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_RECORD_STORE), | ||
294 | ZoneKey: zk, | ||
295 | Count: 0, | ||
296 | KeyLen: kl, | ||
297 | } | ||
298 | } | ||
299 | |||
300 | // Init called after unmarshalling a message to setup internal state | ||
301 | func (m *NamestoreRecordStoreMsg) Init() error { | ||
302 | return nil | ||
303 | } | ||
304 | |||
305 | // AddRecords adds the record data to the message | ||
306 | func (m *NamestoreRecordStoreMsg) AddRecordSet(label string, rr *blocks.RecordSet) { | ||
307 | rs, size := NewNamestoreRecordSet(label, rr) | ||
308 | m.RSets = append(m.RSets, rs) | ||
309 | m.MsgSize += size | ||
310 | } | ||
311 | |||
312 | // String returns a human-readable representation of the message. | ||
313 | func (m *NamestoreRecordStoreMsg) String() string { | ||
314 | return fmt.Sprintf("NamestoreRecordStoreMsg{id=%d,zone=%s,%d record sets}", | ||
315 | m.ID, m.ZoneKey.ID(), m.Count) | ||
148 | } | 316 | } |
149 | 317 | ||
318 | //---------------------------------------------------------------------- | ||
319 | // MSG_NAMESTORE_RECORD_STORE_RESP | ||
320 | //---------------------------------------------------------------------- | ||
321 | |||
322 | // NamestoreRecordStoreRespMsg is a response to a record store message | ||
150 | type NamestoreRecordStoreRespMsg struct { | 323 | type NamestoreRecordStoreRespMsg struct { |
151 | GenericNamestoreMsg | 324 | GenericNamestoreMsg |
152 | 325 | ||
153 | Status int32 `order:"big"` // result status | 326 | Status uint32 `order:"big"` // result status |
154 | ErrLen uint16 `order:"big"` // length of error message | 327 | } |
155 | Reserved uint16 `order:"big"` // alignment | 328 | |
156 | Error []byte `size:"ErrLen"` // error message | 329 | // NewNamestoreRecordStoreRespMsg creates a new message |
330 | func NewNamestoreRecordStoreRespMsg(id uint32, rc uint32) *NamestoreRecordStoreRespMsg { | ||
331 | return &NamestoreRecordStoreRespMsg{ | ||
332 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 12, enums.MSG_NAMESTORE_RECORD_STORE_RESPONSE), | ||
333 | Status: rc, | ||
334 | } | ||
157 | } | 335 | } |
158 | 336 | ||
159 | type NamestoreLabelLookupMsg struct { | 337 | // Init called after unmarshalling a message to setup internal state |
338 | func (m *NamestoreRecordStoreRespMsg) Init() error { return nil } | ||
339 | |||
340 | // String returns a human-readable representation of the message. | ||
341 | func (m *NamestoreRecordStoreRespMsg) String() string { | ||
342 | return fmt.Sprintf("NamestoreRecordStoreRespMsg{id=%d,rc=%d}", m.ID, m.Status) | ||
343 | } | ||
344 | |||
345 | //---------------------------------------------------------------------- | ||
346 | // MSG_NAMESTORE_RECORD_LOOKUP | ||
347 | //---------------------------------------------------------------------- | ||
348 | |||
349 | // NamestoreRecordLookupMsg looks up a record in the namestore | ||
350 | type NamestoreRecordLookupMsg struct { | ||
160 | GenericNamestoreMsg | 351 | GenericNamestoreMsg |
161 | 352 | ||
162 | LblLen uint32 `order:"big"` // length of label | 353 | LblLen uint16 `order:"big"` // length of label |
163 | IsEdit uint32 `order:"big"` // lookup corresponds to edit request | 354 | IsEdit uint16 `order:"big"` // lookup corresponds to edit request |
164 | ZoneKey *crypto.ZonePrivate // private zone key | 355 | Filter uint16 `order:"big"` // filter flags |
356 | KeyLen uint16 `order:"big"` // size of key | ||
357 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | ||
165 | Label []byte `size:"LblLen"` // label string | 358 | Label []byte `size:"LblLen"` // label string |
166 | } | 359 | } |
167 | 360 | ||
168 | type NamestoreLabelLookupRespMsg struct { | 361 | // NewNamestoreRecordLookupMsg creates a new message |
362 | func NewNamestoreRecordLookupMsg(id uint32, zk *crypto.ZonePrivate, label string, isEdit bool) *NamestoreRecordLookupMsg { | ||
363 | var flag uint16 | ||
364 | if isEdit { | ||
365 | flag = 1 | ||
366 | } | ||
367 | var kl uint16 | ||
368 | if zk != nil { | ||
369 | kl += uint16(zk.KeySize() + 4) | ||
370 | } | ||
371 | size := kl + uint16(len(label)) + 16 | ||
372 | return &NamestoreRecordLookupMsg{ | ||
373 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_RECORD_LOOKUP), | ||
374 | IsEdit: flag, | ||
375 | KeyLen: kl, | ||
376 | ZoneKey: zk, | ||
377 | LblLen: uint16(len(label)), | ||
378 | Label: []byte(label), | ||
379 | } | ||
380 | } | ||
381 | |||
382 | // Init called after unmarshalling a message to setup internal state | ||
383 | func (m *NamestoreRecordLookupMsg) Init() error { return nil } | ||
384 | |||
385 | // String returns a human-readable representation of the message. | ||
386 | func (m *NamestoreRecordLookupMsg) String() string { | ||
387 | return fmt.Sprintf("NamestoreRecordLookupMsg{id=%d,zk=%s,label=%s,edit=%v}", | ||
388 | m.ID, m.ZoneKey.ID(), string(m.Label), m.IsEdit != 0) | ||
389 | } | ||
390 | |||
391 | //---------------------------------------------------------------------- | ||
392 | // MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE | ||
393 | //---------------------------------------------------------------------- | ||
394 | |||
395 | // NamestoreRecordLookupRespMsg is a lookup response message | ||
396 | type NamestoreRecordLookupRespMsg struct { | ||
169 | GenericNamestoreMsg | 397 | GenericNamestoreMsg |
170 | 398 | ||
171 | LblLen uint16 `order:"big"` // Length of label | 399 | LblLen uint16 `order:"big"` // Length of label |
172 | RdLen uint16 `order:"big"` // size of record data | 400 | RdLen uint16 `order:"big"` // size of record data |
173 | RdCount uint16 `order:"big"` // number of records | 401 | RdCount uint16 `order:"big"` // number of records |
174 | Found int16 `order:"big"` // label found? | 402 | Found int16 `order:"big"` // label found? |
175 | ZoneKey *crypto.ZonePrivate // private zone key | 403 | Reserved uint16 `order:"big"` // reserved |
176 | Label []byte `size:"LblLen"` // label string | 404 | KeyLen uint16 `order:"big"` // length of key |
177 | Records []byte `size:"RdLen"` // serialized record data | 405 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key |
406 | Label []byte `size:"LblLen"` // label string | ||
407 | Records []byte `size:"RdLen"` // serialized record data | ||
408 | |||
409 | // transient state | ||
410 | recset *blocks.RecordSet | ||
178 | } | 411 | } |
179 | 412 | ||
413 | // NewNamestoreRecordLookupRespMsg creates a new message | ||
414 | func NewNamestoreRecordLookupRespMsg(id uint32, zk *crypto.ZonePrivate, label string) *NamestoreRecordLookupRespMsg { | ||
415 | var kl uint16 | ||
416 | if zk != nil { | ||
417 | kl = uint16(zk.KeySize() + 4) | ||
418 | } | ||
419 | size := kl + uint16(len(label)) + 20 | ||
420 | msg := &NamestoreRecordLookupRespMsg{ | ||
421 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_RECORD_LOOKUP_RESPONSE), | ||
422 | KeyLen: kl, | ||
423 | ZoneKey: zk, | ||
424 | LblLen: uint16(len(label)), | ||
425 | Label: []byte(label), | ||
426 | Records: nil, | ||
427 | } | ||
428 | return msg | ||
429 | } | ||
430 | |||
431 | // Init called after unmarshalling a message to setup internal state | ||
432 | func (m *NamestoreRecordLookupRespMsg) Init() error { | ||
433 | if m.recset == nil { | ||
434 | m.recset = new(blocks.RecordSet) | ||
435 | return data.Unmarshal(m.recset, m.Records) | ||
436 | } | ||
437 | return nil | ||
438 | } | ||
439 | |||
440 | // AddRecords adds the record data to the message | ||
441 | func (m *NamestoreRecordLookupRespMsg) AddRecords(rs *blocks.RecordSet) { | ||
442 | // make sure the record set is padded correctly | ||
443 | rs.SetPadding() | ||
444 | // copy recordset to message | ||
445 | m.RdCount = uint16(rs.Count) | ||
446 | m.Records = rs.RDATA() | ||
447 | m.RdLen = uint16(len(m.Records)) | ||
448 | m.MsgSize += m.RdLen | ||
449 | m.recset = rs | ||
450 | } | ||
451 | |||
452 | // GetRecords returns the record set contained in message | ||
453 | func (m *NamestoreRecordLookupRespMsg) GetRecords() blocks.RecordSet { | ||
454 | return *m.recset | ||
455 | } | ||
456 | |||
457 | // String returns a human-readable representation of the message. | ||
458 | func (m *NamestoreRecordLookupRespMsg) String() string { | ||
459 | return fmt.Sprintf("NamestoreRecordlLookupRespMsg{id=%d,found=%v,%d records}", | ||
460 | m.ID, m.Found == int16(enums.RC_YES), m.RdCount) | ||
461 | } | ||
462 | |||
463 | //---------------------------------------------------------------------- | ||
464 | // MSG_NAMESTORE_ZONE_TO_NAME | ||
465 | //---------------------------------------------------------------------- | ||
466 | |||
467 | // NamestoreZoneToNameMsg resolves the name for a given key | ||
180 | type NamestoreZoneToNameMsg struct { | 468 | type NamestoreZoneToNameMsg struct { |
181 | GenericNamestoreMsg | 469 | GenericNamestoreMsg |
182 | 470 | ||
183 | ZoneKey *crypto.ZonePrivate // private zone key | 471 | KeyLen uint16 `order:"big"` // length of private key |
184 | ZonePublic *crypto.ZoneKey // public zone key | 472 | PubLen uint16 `order:"big"` // length of public key |
473 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | ||
474 | ZonePublic *crypto.ZoneKey `init:"Init"` // public derived zone key | ||
185 | } | 475 | } |
186 | 476 | ||
477 | // NewNamestoreZoneIterNextMsg creates a new message | ||
478 | func NewNamestoreZoneToNameMsg(id uint32, zk *crypto.ZonePrivate, pk *crypto.ZoneKey) *NamestoreZoneToNameMsg { | ||
479 | var kl, pl uint16 | ||
480 | if zk != nil { | ||
481 | kl = uint16(zk.KeySize() + 4) | ||
482 | } | ||
483 | if pk != nil { | ||
484 | pl = uint16(pk.KeySize() + 4) | ||
485 | } | ||
486 | size := kl + pl + 12 | ||
487 | msg := &NamestoreZoneToNameMsg{ | ||
488 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_ZONE_TO_NAME), | ||
489 | KeyLen: kl, | ||
490 | PubLen: pl, | ||
491 | ZoneKey: zk, | ||
492 | ZonePublic: pk, | ||
493 | } | ||
494 | return msg | ||
495 | } | ||
496 | |||
497 | // Init called after unmarshalling a message to setup internal state | ||
498 | func (m *NamestoreZoneToNameMsg) Init() error { return nil } | ||
499 | |||
500 | // String returns a human-readable representation of the message. | ||
501 | func (m *NamestoreZoneToNameMsg) String() string { | ||
502 | var key string | ||
503 | if m.ZoneKey == nil { | ||
504 | key = "sec:" + m.ZonePublic.ID() | ||
505 | } else { | ||
506 | key = "pub:" + m.ZoneKey.Public().ID() | ||
507 | } | ||
508 | return fmt.Sprintf("NamestoreZoneToNameMsg{id=%d,zk=%s}", m.ID, key) | ||
509 | } | ||
510 | |||
511 | //---------------------------------------------------------------------- | ||
512 | // MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE | ||
513 | //---------------------------------------------------------------------- | ||
514 | |||
515 | // NamestoreZoneToNameRespMsg is a response to NamestoreZoneToNameMsg | ||
187 | type NamestoreZoneToNameRespMsg struct { | 516 | type NamestoreZoneToNameRespMsg struct { |
188 | GenericNamestoreMsg | 517 | GenericNamestoreMsg |
189 | 518 | ||
190 | NameLen uint16 `order:"big"` // length of name | 519 | Status enums.ErrorCode `order:"big"` // result status (error code) |
191 | RdLen uint16 `order:"big"` // size of record data | 520 | NameLen uint16 `order:"big"` // length of name |
192 | RdCount uint16 `order:"big"` // number of records | 521 | RdLen uint16 `order:"big"` // size of record data |
193 | Status int16 `order:"big"` // result status | 522 | RdCount uint16 `order:"big"` // number of records |
194 | ZoneKey *crypto.ZonePrivate // private zone key | 523 | KeyLen uint16 `order:"big"` // length of key |
524 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key | ||
195 | Name []byte `size:"NameLen"` // name string | 525 | Name []byte `size:"NameLen"` // name string |
196 | Records []byte `size:"RdLen"` // serialized record data | 526 | Records []byte `size:"RdLen"` // serialized record data |
527 | |||
528 | // transient state | ||
529 | recset *blocks.RecordSet | ||
530 | } | ||
531 | |||
532 | // NewNamestoreNamestoreZoneToNameRespMsgMsg creates a new message | ||
533 | func NewNamestoreZoneToNameRespMsg(id uint32, zk *crypto.ZonePrivate, label string, status enums.ErrorCode) *NamestoreZoneToNameRespMsg { | ||
534 | var kl uint16 | ||
535 | if zk != nil { | ||
536 | kl = uint16(zk.KeySize() + 4) | ||
537 | } | ||
538 | nl := uint16(len(label) + 1) | ||
539 | size := kl + nl + 12 | ||
540 | return &NamestoreZoneToNameRespMsg{ | ||
541 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_ZONE_TO_NAME_RESPONSE), | ||
542 | Status: status, | ||
543 | NameLen: nl, | ||
544 | Name: util.WriteCString(label), | ||
545 | KeyLen: kl, | ||
546 | ZoneKey: zk, | ||
547 | } | ||
548 | } | ||
549 | |||
550 | // Init called after unmarshalling a message to setup internal state | ||
551 | func (m *NamestoreZoneToNameRespMsg) Init() error { | ||
552 | if m.recset == nil { | ||
553 | m.recset = new(blocks.RecordSet) | ||
554 | return data.Unmarshal(m.recset, m.Records) | ||
555 | } | ||
556 | return nil | ||
197 | } | 557 | } |
198 | 558 | ||
559 | // AddRecords adds the record data to the message | ||
560 | func (m *NamestoreZoneToNameRespMsg) AddRecords(rs *blocks.RecordSet) { | ||
561 | // make sure the record set is padded correctly | ||
562 | rs.SetPadding() | ||
563 | // copy recordset to message | ||
564 | m.RdCount = uint16(rs.Count) | ||
565 | m.Records = rs.RDATA() | ||
566 | m.RdLen = uint16(len(m.Records)) | ||
567 | m.MsgSize += m.RdLen | ||
568 | m.recset = rs | ||
569 | } | ||
570 | |||
571 | // GetRecords returns the record set contained in message | ||
572 | func (m *NamestoreZoneToNameRespMsg) GetRecords() blocks.RecordSet { | ||
573 | return *m.recset | ||
574 | } | ||
575 | |||
576 | // String returns a human-readable representation of the message. | ||
577 | func (m *NamestoreZoneToNameRespMsg) String() string { | ||
578 | return fmt.Sprintf("NamestoreZoneToNameRespMsg{id=%d,zone=%s,label='%s',%d records}", | ||
579 | m.ID, m.ZoneKey.ID(), string(m.Name), m.RdCount) | ||
580 | } | ||
581 | |||
582 | //---------------------------------------------------------------------- | ||
583 | // MSG_NAMESTORE_TX_CONTROL | ||
584 | //---------------------------------------------------------------------- | ||
585 | |||
586 | // NamestoreTxControlMsg to initiate a Tx control | ||
199 | type NamestoreTxControlMsg struct { | 587 | type NamestoreTxControlMsg struct { |
200 | GenericNamestoreMsg | 588 | GenericNamestoreMsg |
201 | 589 | ||
202 | Control uint16 `order:"big"` // type of control message | 590 | Reserved uint16 `order:"big"` // reserved |
203 | Reserved uint16 `order:"big"` // alignment | 591 | Control uint16 `order:"big"` // type of control message to send |
204 | } | 592 | } |
205 | 593 | ||
594 | // NewNamestoreTxControlMsg creates a new message | ||
595 | func NewNamestoreTxControlMsg(id uint32, ctrl uint16) *NamestoreTxControlMsg { | ||
596 | return &NamestoreTxControlMsg{ | ||
597 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 12, enums.MSG_NAMESTORE_TX_CONTROL), | ||
598 | Control: ctrl, | ||
599 | } | ||
600 | } | ||
601 | |||
602 | // Init called after unmarshalling a message to setup internal state | ||
603 | func (m *NamestoreTxControlMsg) Init() error { | ||
604 | return nil | ||
605 | } | ||
606 | |||
607 | // String returns a human-readable representation of the message. | ||
608 | func (m *NamestoreTxControlMsg) String() string { | ||
609 | return fmt.Sprintf("NamestoreTxControlMsg{id=%d,ctrl=%d}", m.ID, m.Control) | ||
610 | } | ||
611 | |||
612 | //---------------------------------------------------------------------- | ||
613 | // MSG_NAMESTORE_TX_CONTROL_RESULT | ||
614 | //---------------------------------------------------------------------- | ||
615 | |||
616 | // NamestoreTxControlResultMsg is a response to a Tx control message | ||
206 | type NamestoreTxControlResultMsg struct { | 617 | type NamestoreTxControlResultMsg struct { |
207 | GenericNamestoreMsg | 618 | GenericNamestoreMsg |
208 | 619 | ||
209 | Control uint16 `order:"big"` // type of control message | 620 | Result enums.ErrorCode `order:"big"` // error code |
210 | Status uint16 `order:"big"` // result status | ||
211 | Error []byte `size:"*"` // error message (on status != OK) | ||
212 | } | 621 | } |
213 | 622 | ||
214 | type NamestoreZoneMonStartMsg struct { | 623 | // NewNamestoreTxControlResultMsg creates a new message |
624 | func NewNamestoreTxControlResultMsg(id uint32, ec enums.ErrorCode) *NamestoreTxControlResultMsg { | ||
625 | return &NamestoreTxControlResultMsg{ | ||
626 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 12, enums.MSG_NAMESTORE_TX_CONTROL_RESULT), | ||
627 | Result: ec, | ||
628 | } | ||
629 | } | ||
630 | |||
631 | // Init called after unmarshalling a message to setup internal state | ||
632 | func (m *NamestoreTxControlResultMsg) Init() error { | ||
633 | return nil | ||
634 | } | ||
635 | |||
636 | // String returns a human-readable representation of the message. | ||
637 | func (m *NamestoreTxControlResultMsg) String() string { | ||
638 | return fmt.Sprintf("NamestoreTxControlResultMsg{id=%d,result=%s}", m.ID, m.Result) | ||
639 | } | ||
640 | |||
641 | //---------------------------------------------------------------------- | ||
642 | // MSG_NAMESTORE_MONITOR_START | ||
643 | //---------------------------------------------------------------------- | ||
644 | |||
645 | // NamestoreMonitorStartMsg starts a monitor session | ||
646 | type NamestoreMonitorStartMsg struct { | ||
215 | GenericNamestoreMsg | 647 | GenericNamestoreMsg |
216 | 648 | ||
217 | Iterate uint32 `order:"big"` // iterate over all records | 649 | Iterate enums.ResultCode `order:"big"` // iterate over all records |
218 | Filter uint16 `order:"big"` // filter flags | 650 | Filter uint16 `order:"big"` // filter flags |
219 | Reserved uint16 `order:"big"` // alignment | 651 | KeyLen uint16 `order:"big"` // length of key |
220 | ZoneKey *crypto.ZonePrivate // private zone key | 652 | ZoneKey *crypto.ZonePrivate `init:"Init"` // private zone key |
653 | } | ||
654 | |||
655 | // NewNamestoreMonitorStartMsg creates a new message | ||
656 | func NewNamestoreMonitorStartMsg(id uint32, zk *crypto.ZonePrivate, iter enums.ResultCode, filter int) *NamestoreMonitorStartMsg { | ||
657 | var kl uint16 | ||
658 | if zk != nil { | ||
659 | kl = uint16(zk.KeySize() + 4) | ||
660 | } | ||
661 | size := kl + 16 | ||
662 | return &NamestoreMonitorStartMsg{ | ||
663 | GenericNamestoreMsg: newGenericNamestoreMsg(id, size, enums.MSG_NAMESTORE_MONITOR_START), | ||
664 | Iterate: iter, | ||
665 | Filter: uint16(filter), | ||
666 | KeyLen: kl, | ||
667 | ZoneKey: zk, | ||
668 | } | ||
669 | } | ||
670 | |||
671 | // Init called after unmarshalling a message to setup internal state | ||
672 | func (m *NamestoreMonitorStartMsg) Init() error { return nil } | ||
673 | |||
674 | // String returns a human-readable representation of the message. | ||
675 | func (m *NamestoreMonitorStartMsg) String() string { | ||
676 | return fmt.Sprintf("NamestoreMonitorStartMsg{id=%d,zone=%s,iter=%v,filter=%d}", | ||
677 | m.ID, m.ZoneKey.ID(), m.Iterate == enums.RC_OK, m.Filter) | ||
221 | } | 678 | } |
222 | 679 | ||
223 | type NamestoreZoneMonNextMsg struct { | 680 | //---------------------------------------------------------------------- |
681 | // MSG_NAMESTORE_MONITOR_NEXT | ||
682 | //---------------------------------------------------------------------- | ||
683 | |||
684 | // NamestoreMonitorNextMsg to retrieve next set of results | ||
685 | type NamestoreMonitorNextMsg struct { | ||
224 | GenericNamestoreMsg | 686 | GenericNamestoreMsg |
225 | 687 | ||
226 | Reserved uint32 `order:"big"` // alignment =0 | 688 | Reserved uint32 `order:"big"` // alignment =0 |
227 | Limit uint64 `order:"big"` // max. number of records in one go | 689 | Limit uint64 `order:"big"` // max. number of records in one go |
228 | } | 690 | } |
691 | |||
692 | // NewNamestoreMonitorNextMsg creates a new message | ||
693 | func NewNamestoreMonitorNextMsg(id uint32, limit uint64) *NamestoreMonitorNextMsg { | ||
694 | return &NamestoreMonitorNextMsg{ | ||
695 | GenericNamestoreMsg: newGenericNamestoreMsg(id, 20, enums.MSG_NAMESTORE_MONITOR_NEXT), | ||
696 | Limit: limit, | ||
697 | } | ||
698 | } | ||
699 | |||
700 | // Init called after unmarshalling a message to setup internal state | ||
701 | func (m *NamestoreMonitorNextMsg) Init() error { return nil } | ||
702 | |||
703 | // String returns a human-readable representation of the message. | ||
704 | func (m *NamestoreMonitorNextMsg) String() string { | ||
705 | return fmt.Sprintf("NamestoreMonitorNextMsg{id=%d,limit=%d}", m.ID, m.Limit) | ||
706 | } | ||
diff --git a/src/gnunet/service/dht/blocks/gns.go b/src/gnunet/service/dht/blocks/gns.go index b504bc5..e419279 100644 --- a/src/gnunet/service/dht/blocks/gns.go +++ b/src/gnunet/service/dht/blocks/gns.go | |||
@@ -19,6 +19,8 @@ | |||
19 | package blocks | 19 | package blocks |
20 | 20 | ||
21 | import ( | 21 | import ( |
22 | "bytes" | ||
23 | "encoding/binary" | ||
22 | "errors" | 24 | "errors" |
23 | "fmt" | 25 | "fmt" |
24 | "gnunet/crypto" | 26 | "gnunet/crypto" |
@@ -221,7 +223,11 @@ func (b *GNSBlock) Verify() (ok bool, err error) { | |||
221 | return b.DerivedKeySig.Verify(buf) | 223 | return b.DerivedKeySig.Verify(buf) |
222 | } | 224 | } |
223 | 225 | ||
224 | // RecordSet ist the GNUnet data structure for a list of resource records | 226 | //---------------------------------------------------------------------- |
227 | // Resource record | ||
228 | //---------------------------------------------------------------------- | ||
229 | |||
230 | // RecordSet is the GNUnet data structure for a list of resource records | ||
225 | // in a GNSBlock. As part of GNUnet messages, the record set is padded so that | 231 | // in a GNSBlock. As part of GNUnet messages, the record set is padded so that |
226 | // the binary size of (records||padding) is the smallest power of two. | 232 | // the binary size of (records||padding) is the smallest power of two. |
227 | type RecordSet struct { | 233 | type RecordSet struct { |
@@ -239,6 +245,36 @@ func NewRecordSet() *RecordSet { | |||
239 | } | 245 | } |
240 | } | 246 | } |
241 | 247 | ||
248 | // NewRecordSetFromRDATA converts RDATA (see GNS spec) to rcord set | ||
249 | func NewRecordSetFromRDATA(count uint32, rdata []byte) (rs *RecordSet, err error) { | ||
250 | rs = new(RecordSet) | ||
251 | |||
252 | // do we know the number of records? | ||
253 | if count == 0 { | ||
254 | // no: try to compute from rdata | ||
255 | var size uint16 | ||
256 | for pos := 8; pos < len(rdata); { | ||
257 | if err = binary.Read(bytes.NewReader(rdata[pos:pos+2]), binary.BigEndian, &size); err != nil { | ||
258 | err = nil | ||
259 | break | ||
260 | } | ||
261 | count++ | ||
262 | pos += int(size) + 16 | ||
263 | } | ||
264 | } | ||
265 | if count == 0 { | ||
266 | return | ||
267 | } | ||
268 | // generate intermediate buffer | ||
269 | wrt := new(bytes.Buffer) | ||
270 | _ = binary.Write(wrt, binary.BigEndian, count) | ||
271 | _, _ = wrt.Write(rdata) | ||
272 | buf := wrt.Bytes() | ||
273 | // unmarshal record set | ||
274 | err = data.Unmarshal(rs, buf) | ||
275 | return | ||
276 | } | ||
277 | |||
242 | // AddRecord to append a resource record to the set. | 278 | // AddRecord to append a resource record to the set. |
243 | func (rs *RecordSet) AddRecord(rec *ResourceRecord) { | 279 | func (rs *RecordSet) AddRecord(rec *ResourceRecord) { |
244 | rs.Count++ | 280 | rs.Count++ |
@@ -249,7 +285,7 @@ func (rs *RecordSet) AddRecord(rec *ResourceRecord) { | |||
249 | func (rs *RecordSet) SetPadding() { | 285 | func (rs *RecordSet) SetPadding() { |
250 | size := 0 | 286 | size := 0 |
251 | for _, rr := range rs.Records { | 287 | for _, rr := range rs.Records { |
252 | size += int(rr.Size) + 20 | 288 | size += int(rr.Size) + 16 |
253 | } | 289 | } |
254 | n := 1 | 290 | n := 1 |
255 | for n < size { | 291 | for n < size { |
@@ -271,8 +307,9 @@ func (rs *RecordSet) Expire() util.AbsoluteTime { | |||
271 | return expires | 307 | return expires |
272 | } | 308 | } |
273 | 309 | ||
274 | // Bytes returns the binary representation | 310 | // RDATA returns the binary representation of the record set as specified |
275 | func (rs *RecordSet) Bytes() []byte { | 311 | // in the GNS draft. |
312 | func (rs *RecordSet) RDATA() []byte { | ||
276 | // make sure padding exists | 313 | // make sure padding exists |
277 | if rs.Padding == nil { | 314 | if rs.Padding == nil { |
278 | rs.SetPadding() | 315 | rs.SetPadding() |
@@ -282,16 +319,20 @@ func (rs *RecordSet) Bytes() []byte { | |||
282 | if err != nil { | 319 | if err != nil { |
283 | return nil | 320 | return nil |
284 | } | 321 | } |
285 | return buf | 322 | return buf[4:] |
286 | } | 323 | } |
287 | 324 | ||
325 | //---------------------------------------------------------------------- | ||
326 | // Resource record | ||
327 | //---------------------------------------------------------------------- | ||
328 | |||
288 | // ResourceRecord is the GNUnet-specific representation of resource | 329 | // ResourceRecord is the GNUnet-specific representation of resource |
289 | // records (not to be confused with DNS resource records). | 330 | // records (not to be confused with DNS resource records). |
290 | type ResourceRecord struct { | 331 | type ResourceRecord struct { |
291 | Expire util.AbsoluteTime // Expiration time for the record | 332 | Expire util.AbsoluteTime `` // Expiration time for the record |
292 | Size uint32 `order:"big"` // Number of bytes in 'Data' | 333 | Size uint16 `order:"big"` // Number of bytes in 'Data' |
334 | Flags enums.GNSFlag `order:"big"` // Flags | ||
293 | RType enums.GNSType `order:"big"` // Type of the GNS/DNS record | 335 | RType enums.GNSType `order:"big"` // Type of the GNS/DNS record |
294 | Flags enums.GNSFlag `order:"big"` // Flags for the record | ||
295 | Data []byte `size:"Size"` // Record data | 336 | Data []byte `size:"Size"` // Record data |
296 | } | 337 | } |
297 | 338 | ||
diff --git a/src/gnunet/service/gns/block_handler.go b/src/gnunet/service/gns/block_handler.go index b00fac2..435b9de 100644 --- a/src/gnunet/service/gns/block_handler.go +++ b/src/gnunet/service/gns/block_handler.go | |||
@@ -151,7 +151,7 @@ func NewBlockHandlerList(records []*blocks.ResourceRecord, labels []string) (*Bl | |||
151 | // Third pass: Traverse active list and build list of handler instances. | 151 | // Third pass: Traverse active list and build list of handler instances. |
152 | for _, rec := range active { | 152 | for _, rec := range active { |
153 | // update counter map for non-supplemental records | 153 | // update counter map for non-supplemental records |
154 | if (rec.Flags & enums.GNS_FLAG_SUPPL) != 0 { | 154 | if (rec.Flags & enums.GNS_FLAG_SUPPLEMENTAL) != 0 { |
155 | logger.Printf(logger.DBG, "[gns] handler_list: skip %v\n", rec) | 155 | logger.Printf(logger.DBG, "[gns] handler_list: skip %v\n", rec) |
156 | continue | 156 | continue |
157 | } | 157 | } |
@@ -434,7 +434,7 @@ func (h *BoxHandler) Records(kind RRTypeList) *blocks.RecordSet { | |||
434 | rr.Expire = box.rec.Expire | 434 | rr.Expire = box.rec.Expire |
435 | rr.Flags = box.rec.Flags | 435 | rr.Flags = box.rec.Flags |
436 | rr.RType = box.Type | 436 | rr.RType = box.Type |
437 | rr.Size = uint32(len(box.RR)) | 437 | rr.Size = uint16(len(box.RR)) |
438 | rr.Data = box.RR | 438 | rr.Data = box.RR |
439 | rs.AddRecord(rr) | 439 | rs.AddRecord(rr) |
440 | } | 440 | } |
diff --git a/src/gnunet/service/gns/dns.go b/src/gnunet/service/gns/dns.go index 32c71e9..c2f62c6 100644 --- a/src/gnunet/service/gns/dns.go +++ b/src/gnunet/service/gns/dns.go | |||
@@ -179,7 +179,7 @@ func QueryDNS(id int, name string, server net.IP, kind RRTypeList) *blocks.Recor | |||
179 | rr.Expire = util.NewAbsoluteTime(expires) | 179 | rr.Expire = util.NewAbsoluteTime(expires) |
180 | rr.Flags = 0 | 180 | rr.Flags = 0 |
181 | rr.RType = enums.GNSType(record.Header().Rrtype) | 181 | rr.RType = enums.GNSType(record.Header().Rrtype) |
182 | rr.Size = uint32(record.Header().Rdlength) | 182 | rr.Size = record.Header().Rdlength |
183 | rr.Data = make([]byte, rr.Size) | 183 | rr.Data = make([]byte, rr.Size) |
184 | 184 | ||
185 | if n < int(rr.Size) { | 185 | if n < int(rr.Size) { |
diff --git a/src/gnunet/service/gns/module.go b/src/gnunet/service/gns/module.go index 37bbfc5..6078674 100644 --- a/src/gnunet/service/gns/module.go +++ b/src/gnunet/service/gns/module.go | |||
@@ -32,7 +32,6 @@ import ( | |||
32 | "gnunet/service/revocation" | 32 | "gnunet/service/revocation" |
33 | "gnunet/util" | 33 | "gnunet/util" |
34 | 34 | ||
35 | "github.com/bfix/gospel/data" | ||
36 | "github.com/bfix/gospel/logger" | 35 | "github.com/bfix/gospel/logger" |
37 | ) | 36 | ) |
38 | 37 | ||
@@ -365,7 +364,7 @@ func (m *Module) ResolveRelative( | |||
365 | // asking for explicitly. | 364 | // asking for explicitly. |
366 | if set.Count > 0 { | 365 | if set.Count > 0 { |
367 | for _, rec := range records { | 366 | for _, rec := range records { |
368 | if !kind.HasType(rec.RType) && (rec.Flags&enums.GNS_FLAG_SUPPL) != 0 { | 367 | if !kind.HasType(rec.RType) && (rec.Flags&enums.GNS_FLAG_SUPPLEMENTAL) != 0 { |
369 | set.AddRecord(rec) | 368 | set.AddRecord(rec) |
370 | } | 369 | } |
371 | } | 370 | } |
@@ -475,9 +474,9 @@ func (m *Module) Lookup( | |||
475 | func (m *Module) newLEHORecord(name string, expires util.AbsoluteTime) *blocks.ResourceRecord { | 474 | func (m *Module) newLEHORecord(name string, expires util.AbsoluteTime) *blocks.ResourceRecord { |
476 | rr := new(blocks.ResourceRecord) | 475 | rr := new(blocks.ResourceRecord) |
477 | rr.Expire = expires | 476 | rr.Expire = expires |
478 | rr.Flags = enums.GNS_FLAG_SUPPL | 477 | rr.Flags = enums.GNS_FLAG_SUPPLEMENTAL |
479 | rr.RType = enums.GNS_TYPE_LEHO | 478 | rr.RType = enums.GNS_TYPE_LEHO |
480 | rr.Size = uint32(len(name) + 1) | 479 | rr.Size = uint16(len(name) + 1) |
481 | rr.Data = make([]byte, rr.Size) | 480 | rr.Data = make([]byte, rr.Size) |
482 | copy(rr.Data, []byte(name)) | 481 | copy(rr.Data, []byte(name)) |
483 | rr.Data[len(name)] = 0 | 482 | rr.Data[len(name)] = 0 |
@@ -486,9 +485,9 @@ func (m *Module) newLEHORecord(name string, expires util.AbsoluteTime) *blocks.R | |||
486 | 485 | ||
487 | // Records returns the list of resource records from binary data. | 486 | // Records returns the list of resource records from binary data. |
488 | func (m *Module) records(buf []byte) ([]*blocks.ResourceRecord, error) { | 487 | func (m *Module) records(buf []byte) ([]*blocks.ResourceRecord, error) { |
489 | // parse data into record set | 488 | // parse data into record set |
490 | rs := blocks.NewRecordSet() | 489 | rs, err := blocks.NewRecordSetFromRDATA(0, buf) |
491 | if err := data.Unmarshal(rs, buf); err != nil { | 490 | if err != nil { |
492 | return nil, err | 491 | return nil, err |
493 | } | 492 | } |
494 | return rs.Records, nil | 493 | return rs.Records, nil |
diff --git a/src/gnunet/service/gns/rr/gns.go b/src/gnunet/service/gns/rr/gns.go index 1926a4a..b21f75c 100644 --- a/src/gnunet/service/gns/rr/gns.go +++ b/src/gnunet/service/gns/rr/gns.go | |||
@@ -111,7 +111,7 @@ func (rr *REDIRECT) Coexist(list []*enums.GNSSpec, label string) (ok bool, force | |||
111 | } | 111 | } |
112 | // make sure all existing records are supplemental EDKEYs too | 112 | // make sure all existing records are supplemental EDKEYs too |
113 | for _, e := range list { | 113 | for _, e := range list { |
114 | if e.Type != enums.GNS_TYPE_REDIRECT && e.Flags&enums.GNS_FLAG_SUPPL == 0 { | 114 | if e.Type != enums.GNS_TYPE_REDIRECT && e.Flags&enums.GNS_FLAG_SUPPLEMENTAL == 0 { |
115 | // check failed on non-supplemental non-REDIRECT record | 115 | // check failed on non-supplemental non-REDIRECT record |
116 | return | 116 | return |
117 | } | 117 | } |
diff --git a/src/gnunet/service/store/store_zonemaster.go b/src/gnunet/service/store/store_zonemaster.go index 1338c01..17c5b81 100644 --- a/src/gnunet/service/store/store_zonemaster.go +++ b/src/gnunet/service/store/store_zonemaster.go | |||
@@ -32,12 +32,8 @@ import ( | |||
32 | ) | 32 | ) |
33 | 33 | ||
34 | //============================================================ | 34 | //============================================================ |
35 | // Local identities and zone records (SQLite3 database) | 35 | // Zones are named ZonePrivate keys that act as a container |
36 | // Identities are named ZonePrivate keys that are associated | 36 | // for labeled resource record sets in GNS. |
37 | // with a GNUnet subsystem (like GNS, CADET and others). | ||
38 | // Identities for the subsystem "gns" are called zones and | ||
39 | // are collections of labeled resource record sets. All other | ||
40 | // identities are usuall called "egos". | ||
41 | //============================================================ | 37 | //============================================================ |
42 | 38 | ||
43 | // Zone is the definition of a local GNS zone | 39 | // Zone is the definition of a local GNS zone |
@@ -63,31 +59,18 @@ func NewZone(name string, sk *crypto.ZonePrivate) *Zone { | |||
63 | 59 | ||
64 | //---------------------------------------------------------------------- | 60 | //---------------------------------------------------------------------- |
65 | 61 | ||
66 | // Identity is a Zone associated with a service | 62 | // Label is a named container for resource records in a GNS zone. |
67 | type Identity struct { | ||
68 | Zone | ||
69 | |||
70 | Svc string // associated service | ||
71 | } | ||
72 | |||
73 | // NewIdentity creates an initialize instance for database access | ||
74 | func NewIdentity(name string, sk *crypto.ZonePrivate, svc string) *Identity { | ||
75 | return &Identity{ | ||
76 | Zone: *NewZone(name, sk), | ||
77 | Svc: svc, | ||
78 | } | ||
79 | } | ||
80 | |||
81 | //---------------------------------------------------------------------- | ||
82 | |||
83 | type Label struct { | 63 | type Label struct { |
84 | ID int64 // database id of label | 64 | ID int64 // database id of label |
85 | Zone int64 // database ID of parent zone | 65 | Zone int64 // database ID of parent zone |
86 | Name string // label name | 66 | Name string // label name |
87 | Created util.AbsoluteTime // date of creation | 67 | Created util.AbsoluteTime // date of creation |
88 | Modified util.AbsoluteTime // date of last modification | 68 | Modified util.AbsoluteTime // date of last modification |
69 | KeyHash *crypto.HashCode // hashcode of the label under zone | ||
89 | } | 70 | } |
90 | 71 | ||
72 | // NewLabel returns a new label with given name. It is not | ||
73 | // associated with a zone yet. | ||
91 | func NewLabel(label string) *Label { | 74 | func NewLabel(label string) *Label { |
92 | lbl := new(Label) | 75 | lbl := new(Label) |
93 | lbl.ID = 0 | 76 | lbl.ID = 0 |
@@ -98,6 +81,17 @@ func NewLabel(label string) *Label { | |||
98 | return lbl | 81 | return lbl |
99 | } | 82 | } |
100 | 83 | ||
84 | // SetZone links a label with a zone | ||
85 | func (l *Label) SetZone(z *Zone) error { | ||
86 | pk, _, err := z.Key.Public().Derive(l.Name, "gns") | ||
87 | if err != nil { | ||
88 | return err | ||
89 | } | ||
90 | l.Zone = z.ID | ||
91 | l.KeyHash = crypto.Hash(pk.KeyData) | ||
92 | return nil | ||
93 | } | ||
94 | |||
101 | //---------------------------------------------------------------------- | 95 | //---------------------------------------------------------------------- |
102 | 96 | ||
103 | // Record for GNS resource in a zone (generic). It is the responsibility | 97 | // Record for GNS resource in a zone (generic). It is the responsibility |
@@ -121,7 +115,7 @@ func NewRecord(expire util.AbsoluteTime, rtype enums.GNSType, flags enums.GNSFla | |||
121 | rec.RType = rtype | 115 | rec.RType = rtype |
122 | rec.Flags = flags | 116 | rec.Flags = flags |
123 | rec.Data = data | 117 | rec.Data = data |
124 | rec.Size = uint32(len(rec.Data)) | 118 | rec.Size = uint16(len(rec.Data)) |
125 | rec.Created = util.AbsoluteTimeNow() | 119 | rec.Created = util.AbsoluteTimeNow() |
126 | rec.Modified = util.AbsoluteTimeNow() | 120 | rec.Modified = util.AbsoluteTimeNow() |
127 | return rec | 121 | return rec |
@@ -157,7 +151,7 @@ func OpenZoneDB(fname string) (db *ZoneDB, err error) { | |||
157 | return | 151 | return |
158 | } | 152 | } |
159 | // check for initialized database | 153 | // check for initialized database |
160 | res := db.conn.QueryRow("select name from sqlite_master where type='table' and name='identities'") | 154 | res := db.conn.QueryRow("select name from sqlite_master where type='table' and name='zones'") |
161 | var s string | 155 | var s string |
162 | if res.Scan(&s) != nil { | 156 | if res.Scan(&s) != nil { |
163 | // initialize database | 157 | // initialize database |
@@ -174,152 +168,6 @@ func (db *ZoneDB) Close() error { | |||
174 | } | 168 | } |
175 | 169 | ||
176 | //---------------------------------------------------------------------- | 170 | //---------------------------------------------------------------------- |
177 | // Identity handling | ||
178 | //---------------------------------------------------------------------- | ||
179 | |||
180 | // SetIdentity inserts, updates or deletes a zone in the database. | ||
181 | // The function does not change timestamps which are in the | ||
182 | // responsibility of the caller. | ||
183 | // - insert: Identity.ID is nil (0) | ||
184 | // - update: Identity.Name is set | ||
185 | // - remove: otherwise | ||
186 | func (db *ZoneDB) SetIdentity(id *Identity) error { | ||
187 | // GNS zones are handled by Zone instances | ||
188 | if id.Svc == "gns" { | ||
189 | return db.SetZone(&id.Zone) | ||
190 | } | ||
191 | // check for identity insert | ||
192 | if id.ID == 0 { | ||
193 | stmt := "insert into identities(svc,name,created,modified,ztype,zdata) values(?,?,?,?,?,?)" | ||
194 | result, err := db.conn.Exec(stmt, | ||
195 | id.Svc, id.Name, id.Created.Val, id.Modified.Val, id.Key.Type, id.Key.KeyData) | ||
196 | if err != nil { | ||
197 | return err | ||
198 | } | ||
199 | id.ID, err = result.LastInsertId() | ||
200 | return err | ||
201 | } | ||
202 | // check for identity update (name and service only only) | ||
203 | if len(id.Name) > 0 { | ||
204 | stmt := "update identities set svc=?,name=?,modified=? where id=?" | ||
205 | result, err := db.conn.Exec(stmt, id.Svc, id.Name, id.Modified.Val, id.ID) | ||
206 | if err != nil { | ||
207 | return err | ||
208 | } | ||
209 | var num int64 | ||
210 | if num, err = result.RowsAffected(); err == nil { | ||
211 | if num != 1 { | ||
212 | err = errors.New("update identity failed") | ||
213 | } | ||
214 | } | ||
215 | return err | ||
216 | } | ||
217 | // remove identity from database | ||
218 | _, err := db.conn.Exec("delete from identities where id=?", id.ID) | ||
219 | return err | ||
220 | } | ||
221 | |||
222 | // GetIdentity gets an identifier with given database id | ||
223 | func (db *ZoneDB) GetIdentity(id int64) (ident *Identity, err error) { | ||
224 | // assemble identity from database row | ||
225 | stmt := "select svc,name,created,modified,ztype,zdata from identities where id=?" | ||
226 | ident = new(Identity) | ||
227 | ident.ID = id | ||
228 | row := db.conn.QueryRow(stmt, id) | ||
229 | var ztype enums.GNSType | ||
230 | var zdata []byte | ||
231 | if err = row.Scan(&ident.Svc, &ident.Name, &ident.Created.Val, &ident.Modified.Val, &ztype, &zdata); err == nil { | ||
232 | // reconstruct private zone key | ||
233 | ident.Key, err = crypto.NewZonePrivate(ztype, zdata) | ||
234 | } | ||
235 | return | ||
236 | } | ||
237 | |||
238 | // GetIdentity gets an identifier with given (name,svc) | ||
239 | func (db *ZoneDB) GetIdentityByName(name, svc string) (ident *Identity, err error) { | ||
240 | // assemble identity from database row | ||
241 | var row *sql.Row | ||
242 | stmt := "select id,created,modified,ztype,zdata from identities where name=?" | ||
243 | if len(svc) > 0 { | ||
244 | stmt += " and svc=?" | ||
245 | row = db.conn.QueryRow(stmt, name, svc) | ||
246 | } else { | ||
247 | row = db.conn.QueryRow(stmt, name) | ||
248 | } | ||
249 | ident = new(Identity) | ||
250 | ident.Name = name | ||
251 | ident.Svc = svc | ||
252 | var ztype enums.GNSType | ||
253 | var zdata []byte | ||
254 | if err = row.Scan(&ident.ID, &ident.Created.Val, &ident.Modified.Val, &ztype, &zdata); err == nil { | ||
255 | // reconstruct private zone key | ||
256 | ident.Key, err = crypto.NewZonePrivate(ztype, zdata) | ||
257 | } | ||
258 | return | ||
259 | } | ||
260 | |||
261 | func (db *ZoneDB) GetIdentities(filter string, args ...any) (list []*Identity, err error) { | ||
262 | // assemble query | ||
263 | stmt := "select id,name,svc,created,modified,ztype,zdata from identities" | ||
264 | if len(filter) > 0 { | ||
265 | stmt += " where " + fmt.Sprintf(filter, args...) | ||
266 | } | ||
267 | // select zones | ||
268 | var rows *sql.Rows | ||
269 | if rows, err = db.conn.Query(stmt); err != nil { | ||
270 | return | ||
271 | } | ||
272 | // process zones | ||
273 | defer rows.Close() | ||
274 | for rows.Next() { | ||
275 | // assemble identity from database row | ||
276 | i := new(Identity) | ||
277 | var ztype enums.GNSType | ||
278 | var zdata []byte | ||
279 | if err = rows.Scan(&i.ID, &i.Name, &i.Svc, &i.Created.Val, &i.Modified.Val, &ztype, &zdata); err != nil { | ||
280 | // terminate on error; return list so far | ||
281 | return | ||
282 | } | ||
283 | // reconstruct private key | ||
284 | if i.Key, err = crypto.NewZonePrivate(ztype, zdata); err != nil { | ||
285 | return | ||
286 | } | ||
287 | // append to result list | ||
288 | list = append(list, i) | ||
289 | } | ||
290 | return | ||
291 | } | ||
292 | |||
293 | func (db *ZoneDB) GetDefaultIdentity(svc string) (ident *Identity, err error) { | ||
294 | // assemble identity from database row | ||
295 | stmt := "select id,name,created,modified,ztype,zdata from v_defaults where svc=?" | ||
296 | row := db.conn.QueryRow(stmt, svc) | ||
297 | ident = new(Identity) | ||
298 | ident.Svc = svc | ||
299 | var ztype enums.GNSType | ||
300 | var zdata []byte | ||
301 | if err = row.Scan(&ident.ID, &ident.Name, &ident.Created.Val, &ident.Modified.Val, &ztype, &zdata); err == nil { | ||
302 | // reconstruct private zone key | ||
303 | ident.Key, err = crypto.NewZonePrivate(ztype, zdata) | ||
304 | } | ||
305 | return | ||
306 | } | ||
307 | |||
308 | func (db *ZoneDB) SetDefaultIdentity(zk *crypto.ZonePrivate, svc string) (err error) { | ||
309 | // get database id of identity | ||
310 | stmt := "select id from identities where zdata=?" | ||
311 | row := db.conn.QueryRow(stmt, zk.KeyData) | ||
312 | var id int64 | ||
313 | if err = row.Scan(&id); err != nil { | ||
314 | return | ||
315 | } | ||
316 | // set default | ||
317 | stmt = "insert into defaults(svc,ident) values(?,?) on conflict(svc) do update set ident=?" | ||
318 | _, err = db.conn.Exec(stmt, svc, id, id) | ||
319 | return | ||
320 | } | ||
321 | |||
322 | //---------------------------------------------------------------------- | ||
323 | // Zone handling | 171 | // Zone handling |
324 | //---------------------------------------------------------------------- | 172 | //---------------------------------------------------------------------- |
325 | 173 | ||
@@ -332,8 +180,8 @@ func (db *ZoneDB) SetDefaultIdentity(zk *crypto.ZonePrivate, svc string) (err er | |||
332 | func (db *ZoneDB) SetZone(z *Zone) error { | 180 | func (db *ZoneDB) SetZone(z *Zone) error { |
333 | // check for zone insert | 181 | // check for zone insert |
334 | if z.ID == 0 { | 182 | if z.ID == 0 { |
335 | stmt := "insert into identities(svc,name,created,modified,ztype,zdata) values('gns',?,?,?,?,?)" | 183 | stmt := "insert into zones(name,created,modified,ztype,zdata,pdata) values(?,?,?,?,?,?)" |
336 | result, err := db.conn.Exec(stmt, z.Name, z.Created.Val, z.Modified.Val, z.Key.Type, z.Key.KeyData) | 184 | result, err := db.conn.Exec(stmt, z.Name, z.Created.Val, z.Modified.Val, z.Key.Type, z.Key.KeyData, z.Key.Public().KeyData) |
337 | if err != nil { | 185 | if err != nil { |
338 | return err | 186 | return err |
339 | } | 187 | } |
@@ -342,7 +190,7 @@ func (db *ZoneDB) SetZone(z *Zone) error { | |||
342 | } | 190 | } |
343 | // check for zone update (name only) | 191 | // check for zone update (name only) |
344 | if len(z.Name) > 0 { | 192 | if len(z.Name) > 0 { |
345 | stmt := "update identities set name=?,modified=? where id=? and svc='gns'" | 193 | stmt := "update zones set name=?,modified=? where id=?" |
346 | result, err := db.conn.Exec(stmt, z.Name, z.Modified.Val, z.ID) | 194 | result, err := db.conn.Exec(stmt, z.Name, z.Modified.Val, z.ID) |
347 | if err != nil { | 195 | if err != nil { |
348 | return err | 196 | return err |
@@ -414,6 +262,47 @@ func (db *ZoneDB) GetZones(filter string, args ...any) (list []*Zone, err error) | |||
414 | return | 262 | return |
415 | } | 263 | } |
416 | 264 | ||
265 | // GetZoneByName gets an identifier with given name | ||
266 | func (db *ZoneDB) GetZoneByName(name string) (ident *Zone, err error) { | ||
267 | // assemble zone from database row | ||
268 | stmt := "select id,created,modified,ztype,zdata from zones where name=?" | ||
269 | row := db.conn.QueryRow(stmt, name) | ||
270 | ident = new(Zone) | ||
271 | ident.Name = name | ||
272 | var ztype enums.GNSType | ||
273 | var zdata []byte | ||
274 | if err = row.Scan(&ident.ID, &ident.Created.Val, &ident.Modified.Val, &ztype, &zdata); err == nil { | ||
275 | // reconstruct private zone key | ||
276 | ident.Key, err = crypto.NewZonePrivate(ztype, zdata) | ||
277 | } | ||
278 | return | ||
279 | } | ||
280 | |||
281 | // GetZoneByKey returns an identifier with given key | ||
282 | func (db *ZoneDB) GetZoneByKey(zk *crypto.ZonePrivate) (ident *Zone, err error) { | ||
283 | // assemble zone from database row | ||
284 | stmt := "select id,name,created,modified from zones where zdata=?" | ||
285 | row := db.conn.QueryRow(stmt, zk.KeyData) | ||
286 | ident = new(Zone) | ||
287 | ident.Key = zk | ||
288 | err = row.Scan(&ident.ID, &ident.Name, &ident.Created.Val, &ident.Modified.Val) | ||
289 | return | ||
290 | } | ||
291 | |||
292 | // GetZoneByPublicKey returns an identifier with given key | ||
293 | func (db *ZoneDB) GetZoneByPublicKey(zk *crypto.ZoneKey) (ident *Zone, err error) { | ||
294 | // assemble zone from database row | ||
295 | stmt := "select id,name,created,modified,ztype,zdata from zones where pdata=?" | ||
296 | row := db.conn.QueryRow(stmt, zk.KeyData) | ||
297 | ident = new(Zone) | ||
298 | var ztype enums.GNSType | ||
299 | var zdata []byte | ||
300 | if err = row.Scan(&ident.ID, &ident.Name, &ident.Created.Val, &ident.Modified.Val, &ztype, &zdata); err == nil { | ||
301 | ident.Key, err = crypto.NewZonePrivate(ztype, zdata) | ||
302 | } | ||
303 | return | ||
304 | } | ||
305 | |||
417 | //---------------------------------------------------------------------- | 306 | //---------------------------------------------------------------------- |
418 | // Label handling | 307 | // Label handling |
419 | //---------------------------------------------------------------------- | 308 | //---------------------------------------------------------------------- |
@@ -427,8 +316,8 @@ func (db *ZoneDB) GetZones(filter string, args ...any) (list []*Zone, err error) | |||
427 | func (db *ZoneDB) SetLabel(l *Label) error { | 316 | func (db *ZoneDB) SetLabel(l *Label) error { |
428 | // check for label insert | 317 | // check for label insert |
429 | if l.ID == 0 { | 318 | if l.ID == 0 { |
430 | stmt := "insert into labels(zid,name,created,modified) values(?,?,?,?)" | 319 | stmt := "insert into labels(zid,name,created,modified,keyhash) values(?,?,?,?,?)" |
431 | result, err := db.conn.Exec(stmt, l.Zone, l.Name, l.Created.Val, l.Modified.Val) | 320 | result, err := db.conn.Exec(stmt, l.Zone, l.Name, l.Created.Val, l.Modified.Val, l.KeyHash.Data) |
432 | if err != nil { | 321 | if err != nil { |
433 | return err | 322 | return err |
434 | } | 323 | } |
@@ -462,10 +351,54 @@ func (db *ZoneDB) SetLabel(l *Label) error { | |||
462 | // GetLabel gets a label with given identifier | 351 | // GetLabel gets a label with given identifier |
463 | func (db *ZoneDB) GetLabel(id int64) (label *Label, err error) { | 352 | func (db *ZoneDB) GetLabel(id int64) (label *Label, err error) { |
464 | // assemble label from database row | 353 | // assemble label from database row |
465 | stmt := "select zid,name,created,modified from labels where id=?" | 354 | stmt := "select zid,name,created,modified,keyhash from labels where id=?" |
466 | label = new(Label) | 355 | label = new(Label) |
467 | row := db.conn.QueryRow(stmt, id) | 356 | row := db.conn.QueryRow(stmt, id) |
468 | err = row.Scan(&label.Zone, &label.Name, &label.Created.Val, &label.Modified.Val) | 357 | var query []byte |
358 | if err = row.Scan(&label.Zone, &label.Name, &label.Created.Val, &label.Modified.Val, &query); err == nil { | ||
359 | label.KeyHash = crypto.NewHashCode(query) | ||
360 | } | ||
361 | return | ||
362 | } | ||
363 | |||
364 | // GetLabelByKeyHash returns a label with given query hash | ||
365 | func (db *ZoneDB) GetLabelByKeyHash(hsh *crypto.HashCode) (label *Label, err error) { | ||
366 | // assemble label from database row | ||
367 | stmt := "select id,zid,name,created,modified from labels where keyhash=?" | ||
368 | label = new(Label) | ||
369 | label.KeyHash = hsh | ||
370 | row := db.conn.QueryRow(stmt, hsh) | ||
371 | err = row.Scan(&label.ID, &label.Zone, &label.Name, &label.Created.Val, &label.Modified.Val) | ||
372 | return | ||
373 | } | ||
374 | |||
375 | // GetLabelByName gets a label with given name and zone. Create label on | ||
376 | // demand ('create' flag) if 'zid' is not 0. | ||
377 | func (db *ZoneDB) GetLabelByName(name string, zid int64, create bool) (label *Label, err error) { | ||
378 | // assemble label from database row | ||
379 | stmt := "select id,created,modified from labels where name=? and zid=?" | ||
380 | label = new(Label) | ||
381 | label.Name = name | ||
382 | label.Zone = zid | ||
383 | row := db.conn.QueryRow(stmt, name, zid) | ||
384 | if err = row.Scan(&label.ID, &label.Created.Val, &label.Modified.Val); err != nil { | ||
385 | // check for "does not exist" | ||
386 | if err == sql.ErrNoRows && create { | ||
387 | err = nil | ||
388 | label.Created = util.AbsoluteTimeNow() | ||
389 | label.Modified = util.AbsoluteTimeNow() | ||
390 | if zid != 0 { | ||
391 | // yes: create label | ||
392 | label.Zone = zid | ||
393 | stmt = "insert into labels(zid,name,created,modified) values(?,?,?,?)" | ||
394 | var res sql.Result | ||
395 | if res, err = db.conn.Exec(stmt, zid, name, label.Created.Val, label.Modified.Val); err != nil { | ||
396 | return | ||
397 | } | ||
398 | label.ID, err = res.LastInsertId() | ||
399 | } | ||
400 | } | ||
401 | } | ||
469 | return | 402 | return |
470 | } | 403 | } |
471 | 404 | ||
@@ -497,10 +430,9 @@ func (db *ZoneDB) GetLabels(filter string, args ...any) (list []*Label, err erro | |||
497 | return | 430 | return |
498 | } | 431 | } |
499 | 432 | ||
500 | func (db *ZoneDB) GetLabelIDs(zk *crypto.ZonePrivate) (list []int64, err error) { | 433 | func (db *ZoneDB) GetLabelIDs(zk *crypto.ZonePrivate) (list []int64, zid int64, err error) { |
501 | // get zone database id | 434 | // get zone database id |
502 | row := db.conn.QueryRow("select id from zones where ztype=? and zdata=?", zk.Type, zk.KeyData) | 435 | row := db.conn.QueryRow("select id from zones where ztype=? and zdata=?", zk.Type, zk.KeyData) |
503 | var zid int64 | ||
504 | if err = row.Scan(&zid); err != nil { | 436 | if err = row.Scan(&zid); err != nil { |
505 | return | 437 | return |
506 | } | 438 | } |
@@ -579,7 +511,7 @@ func (db *ZoneDB) GetRecord(id int64) (rec *Record, err error) { | |||
579 | return | 511 | return |
580 | } | 512 | } |
581 | // setup missing fields | 513 | // setup missing fields |
582 | rec.Size = uint32(len(rec.Data)) | 514 | rec.Size = uint16(len(rec.Data)) |
583 | if exp != nil { | 515 | if exp != nil { |
584 | rec.Expire.Val = *exp | 516 | rec.Expire.Val = *exp |
585 | } else { | 517 | } else { |
@@ -611,7 +543,7 @@ func (db *ZoneDB) GetRecords(filter string, args ...any) (list []*Record, err er | |||
611 | // terminate on error; return list so far | 543 | // terminate on error; return list so far |
612 | return | 544 | return |
613 | } | 545 | } |
614 | rec.Size = uint32(len(rec.Data)) | 546 | rec.Size = uint16(len(rec.Data)) |
615 | if exp != nil { | 547 | if exp != nil { |
616 | rec.Expire.Val = *exp | 548 | rec.Expire.Val = *exp |
617 | } else { | 549 | } else { |
diff --git a/src/gnunet/service/store/store_zonemaster.sql b/src/gnunet/service/store/store_zonemaster.sql index 69b8ab5..3945f71 100644 --- a/src/gnunet/service/store/store_zonemaster.sql +++ b/src/gnunet/service/store/store_zonemaster.sql | |||
@@ -16,44 +16,23 @@ | |||
16 | -- | 16 | -- |
17 | -- SPDX-License-Identifier: AGPL3.0-or-later | 17 | -- SPDX-License-Identifier: AGPL3.0-or-later |
18 | 18 | ||
19 | create table identities ( | 19 | create table zones ( |
20 | id integer primary key autoincrement, | 20 | id integer primary key autoincrement, |
21 | svc text, | 21 | name text unique, |
22 | name text, | ||
23 | created integer, | 22 | created integer, |
24 | modified integer, | 23 | modified integer, |
25 | ztype integer, | 24 | ztype integer, |
26 | zdata blob, | 25 | zdata blob, |
27 | unique (svc,name) | 26 | pdata blob |
28 | ); | 27 | ); |
29 | 28 | ||
30 | create table defaults ( | ||
31 | svc text unique, | ||
32 | ident integer references identities(id) | ||
33 | ); | ||
34 | |||
35 | create view v_defaults as select | ||
36 | i.id as id, | ||
37 | d.svc as svc, | ||
38 | i.name as name, | ||
39 | i.created as created, | ||
40 | i.modified as modified, | ||
41 | i.ztype as ztype, | ||
42 | i.zdata as zdata | ||
43 | from identities i, defaults d | ||
44 | where i.id = d.ident; | ||
45 | |||
46 | create view zones as select | ||
47 | id, name, created, modified, ztype, zdata | ||
48 | from identities | ||
49 | where svc = 'gns'; | ||
50 | |||
51 | create table labels ( | 29 | create table labels ( |
52 | id integer primary key autoincrement, | 30 | id integer primary key autoincrement, |
53 | zid integer references zones(id), | 31 | zid integer references zones(id), |
54 | name text, | 32 | name text, |
55 | created integer, | 33 | created integer, |
56 | modified integer, | 34 | modified integer, |
35 | keyhash blob, | ||
57 | unique (zid,name) | 36 | unique (zid,name) |
58 | ); | 37 | ); |
59 | 38 | ||
diff --git a/src/gnunet/service/store/store_zonemaster_test.go b/src/gnunet/service/store/store_zonemaster_test.go index 6f416b1..3e5e346 100644 --- a/src/gnunet/service/store/store_zonemaster_test.go +++ b/src/gnunet/service/store/store_zonemaster_test.go | |||
@@ -56,7 +56,9 @@ func TestZoneMaster(t *testing.T) { | |||
56 | //------------------------------------------------------------------ | 56 | //------------------------------------------------------------------ |
57 | // create label and add to zone and database | 57 | // create label and add to zone and database |
58 | label := NewLabel("bar") | 58 | label := NewLabel("bar") |
59 | label.Zone = zone.ID | 59 | if err = label.SetZone(zone); err != nil { |
60 | t.Fatal(err) | ||
61 | } | ||
60 | if err = zdb.SetLabel(label); err != nil { | 62 | if err = zdb.SetLabel(label); err != nil { |
61 | t.Fatal(err) | 63 | t.Fatal(err) |
62 | } | 64 | } |
diff --git a/src/gnunet/service/zonemaster/gui.go b/src/gnunet/service/zonemaster/gui.go index 5a2f17d..0442fbf 100644 --- a/src/gnunet/service/zonemaster/gui.go +++ b/src/gnunet/service/zonemaster/gui.go | |||
@@ -73,6 +73,12 @@ func (zm *ZoneMaster) startGUI(ctx context.Context) { | |||
73 | "date": func(ts util.AbsoluteTime) string { | 73 | "date": func(ts util.AbsoluteTime) string { |
74 | return guiTime(ts) | 74 | return guiTime(ts) |
75 | }, | 75 | }, |
76 | "dateExp": func(ts util.AbsoluteTime, flags enums.GNSFlag) string { | ||
77 | if flags&enums.GNS_FLAG_RELATIVE_EXPIRATION != 0 { | ||
78 | return guiDuration(ts) | ||
79 | } | ||
80 | return guiTime(ts) | ||
81 | }, | ||
76 | "keytype": func(t enums.GNSType) string { | 82 | "keytype": func(t enums.GNSType) string { |
77 | return guiKeyType(t) | 83 | return guiKeyType(t) |
78 | }, | 84 | }, |
@@ -81,12 +87,22 @@ func (zm *ZoneMaster) startGUI(ctx context.Context) { | |||
81 | data["prefix"] = pf | 87 | data["prefix"] = pf |
82 | if spec.Flags&enums.GNS_FLAG_PRIVATE != 0 { | 88 | if spec.Flags&enums.GNS_FLAG_PRIVATE != 0 { |
83 | data[pf+"private"] = "on" | 89 | data[pf+"private"] = "on" |
90 | data[pf+"private_enforced"] = "on" | ||
84 | } | 91 | } |
85 | if spec.Flags&enums.GNS_FLAG_SHADOW != 0 { | 92 | if spec.Flags&enums.GNS_FLAG_SHADOW != 0 { |
86 | data[pf+"shadow"] = "on" | 93 | data[pf+"shadow"] = "on" |
94 | data[pf+"shadow_enforced"] = "on" | ||
87 | } | 95 | } |
88 | if spec.Flags&enums.GNS_FLAG_SUPPL != 0 { | 96 | if spec.Flags&enums.GNS_FLAG_SUPPLEMENTAL != 0 { |
89 | data[pf+"suppl"] = "on" | 97 | data[pf+"suppl"] = "on" |
98 | data[pf+"suppl_enforced"] = "on" | ||
99 | } | ||
100 | if spec.Flags&enums.GNS_FLAG_CRITICAL != 0 { | ||
101 | data[pf+"critical"] = "on" | ||
102 | data[pf+"critical_enforced"] = "on" | ||
103 | } | ||
104 | if spec.Flags&enums.GNS_FLAG_RELATIVE_EXPIRATION != 0 { | ||
105 | data[pf+"ttl"] = "on" | ||
90 | } | 106 | } |
91 | return pf | 107 | return pf |
92 | }, | 108 | }, |
@@ -104,22 +120,21 @@ func (zm *ZoneMaster) startGUI(ctx context.Context) { | |||
104 | return strings.Replace(t.String(), "GNS_TYPE_", "", -1) | 120 | return strings.Replace(t.String(), "GNS_TYPE_", "", -1) |
105 | }, | 121 | }, |
106 | "rrflags": func(f enums.GNSFlag) string { | 122 | "rrflags": func(f enums.GNSFlag) string { |
107 | flags := make([]string, 0) | 123 | flags := f.List() |
108 | if f&enums.GNS_FLAG_PRIVATE != 0 { | ||
109 | flags = append(flags, "Private") | ||
110 | } | ||
111 | if f&enums.GNS_FLAG_SHADOW != 0 { | ||
112 | flags = append(flags, "Shadow") | ||
113 | } | ||
114 | if f&enums.GNS_FLAG_SUPPL != 0 { | ||
115 | flags = append(flags, "Suppl") | ||
116 | } | ||
117 | if len(flags) == 0 { | 124 | if len(flags) == 0 { |
118 | return "None" | 125 | return "None" |
119 | } | 126 | } |
120 | return strings.Join(flags, ",<br>") | 127 | return strings.Join(flags, ",<br>") |
121 | }, | 128 | }, |
122 | "rrdata": func(t enums.GNSType, buf []byte) string { | 129 | "rrdata": func(t enums.GNSType, buf []byte) string { |
130 | // check if type is handled by plugin | ||
131 | if plugin, ok := zm.hdlrs[t]; ok { | ||
132 | val, err := plugin.Value(uint32(t), buf) | ||
133 | if err != nil { | ||
134 | return "Failed: " + err.Error() | ||
135 | } | ||
136 | return val | ||
137 | } | ||
123 | return guiRRdata(t, buf) | 138 | return guiRRdata(t, buf) |
124 | }, | 139 | }, |
125 | "tabSetList": func(num int) (list map[int]int) { | 140 | "tabSetList": func(num int) (list map[int]int) { |
@@ -130,11 +145,20 @@ func (zm *ZoneMaster) startGUI(ctx context.Context) { | |||
130 | return | 145 | return |
131 | }, | 146 | }, |
132 | }) | 147 | }) |
148 | // parse templates from embedded filesystem | ||
133 | if _, err := tpl.ParseFS(fsys, "*.htpl"); err != nil { | 149 | if _, err := tpl.ParseFS(fsys, "*.htpl"); err != nil { |
134 | logger.Println(logger.ERROR, "[zonemaster] GUI templates failed: "+err.Error()) | 150 | logger.Println(logger.ERROR, "[zonemaster] GUI templates failed: "+err.Error()) |
135 | return | 151 | return |
136 | } | 152 | } |
137 | 153 | ||
154 | // add plugin templates | ||
155 | for _, inst := range zm.plugins { | ||
156 | if _, err := tpl.Parse(inst.Template()); err != nil { | ||
157 | logger.Printf(logger.ERROR, "[zonemaster] can't process plugin templates: %v", err) | ||
158 | continue | ||
159 | } | ||
160 | } | ||
161 | |||
138 | // start HTTP server | 162 | // start HTTP server |
139 | router := mux.NewRouter() | 163 | router := mux.NewRouter() |
140 | router.HandleFunc("/new/{mode}/{id}", zm.new) | 164 | router.HandleFunc("/new/{mode}/{id}", zm.new) |
@@ -160,16 +184,28 @@ func (zm *ZoneMaster) startGUI(ctx context.Context) { | |||
160 | 184 | ||
161 | //---------------------------------------------------------------------- | 185 | //---------------------------------------------------------------------- |
162 | 186 | ||
187 | type DashboardData struct { | ||
188 | Plugins []string | ||
189 | Zones []*store.ZoneGroup | ||
190 | } | ||
191 | |||
163 | // dashboard is the main entry point for the GUI | 192 | // dashboard is the main entry point for the GUI |
164 | func (zm *ZoneMaster) dashboard(w http.ResponseWriter, r *http.Request) { | 193 | func (zm *ZoneMaster) dashboard(w http.ResponseWriter, r *http.Request) { |
194 | data := new(DashboardData) | ||
195 | |||
165 | // collect information for the GUI | 196 | // collect information for the GUI |
166 | zg, err := zm.zdb.GetContent() | 197 | var err error |
167 | if err != nil { | 198 | if data.Zones, err = zm.zdb.GetContent(); err != nil { |
168 | _, _ = io.WriteString(w, "ERROR: "+err.Error()) | 199 | _, _ = io.WriteString(w, "ERROR: "+err.Error()) |
169 | return | 200 | return |
170 | } | 201 | } |
202 | // add plugin names to handle new resource records | ||
203 | data.Plugins = make([]string, 0) | ||
204 | for _, plugin := range zm.plugins { | ||
205 | data.Plugins = append(data.Plugins, plugin.Name()) | ||
206 | } | ||
171 | // show dashboard | 207 | // show dashboard |
172 | renderPage(w, zg, "dashboard") | 208 | renderPage(w, data, "dashboard") |
173 | } | 209 | } |
174 | 210 | ||
175 | //====================================================================== | 211 | //====================================================================== |
@@ -236,9 +272,16 @@ func (zm *ZoneMaster) actionNew(w http.ResponseWriter, r *http.Request, mode str | |||
236 | // new label | 272 | // new label |
237 | case "label": | 273 | case "label": |
238 | name := r.FormValue("name") | 274 | name := r.FormValue("name") |
275 | // get zone | ||
276 | var zone *store.Zone | ||
277 | if zone, err = zm.zdb.GetZone(id); err != nil { | ||
278 | return | ||
279 | } | ||
239 | // add label to database | 280 | // add label to database |
240 | label := store.NewLabel(name) | 281 | label := store.NewLabel(name) |
241 | label.Zone = id | 282 | if err = label.SetZone(zone); err != nil { |
283 | return | ||
284 | } | ||
242 | err = zm.zdb.SetLabel(label) | 285 | err = zm.zdb.SetLabel(label) |
243 | 286 | ||
244 | // notify listeners | 287 | // notify listeners |
@@ -431,13 +474,53 @@ func (zm *ZoneMaster) new(w http.ResponseWriter, r *http.Request) { | |||
431 | // get all rrtypes used under given label | 474 | // get all rrtypes used under given label |
432 | var rrs []*enums.GNSSpec | 475 | var rrs []*enums.GNSSpec |
433 | var label string | 476 | var label string |
477 | var templ string | ||
434 | if rrs, label, err = zm.zdb.GetRRTypes(id); err == nil { | 478 | if rrs, label, err = zm.zdb.GetRRTypes(id); err == nil { |
435 | // compile a list of acceptable types for new records | 479 | // check record mode for custom handling |
436 | data.RRspecs = compatibleRR(rrs, label) | 480 | var mode string |
481 | if modes, found := r.URL.Query()["mode"]; found { | ||
482 | mode = modes[0] | ||
483 | } else { | ||
484 | mode = "GNS" | ||
485 | } | ||
486 | // try plugin modes first | ||
487 | if mode != "GNS" { | ||
488 | var pid int | ||
489 | if pid, ok = util.CastFromString[int](mode); ok { | ||
490 | inst := zm.plugins[pid] | ||
491 | // convert rrs to plugin-compatible type | ||
492 | rrsPlugin := make([][2]uint32, 0) | ||
493 | for _, spec := range rrs { | ||
494 | rrsPlugin = append(rrsPlugin, [2]uint32{ | ||
495 | uint32(spec.Type), | ||
496 | uint32(spec.Flags), | ||
497 | }) | ||
498 | } | ||
499 | data.RRspecs = make([]*enums.GNSSpec, 0) | ||
500 | // let the plugin decide what is compatible | ||
501 | for _, spec := range inst.Compatible(label, rrsPlugin) { | ||
502 | s := &enums.GNSSpec{ | ||
503 | Type: enums.GNSType(spec[0]), | ||
504 | Flags: enums.GNSFlag(spec[1]), | ||
505 | } | ||
506 | data.RRspecs = append(data.RRspecs, s) | ||
507 | } | ||
508 | templ, _ = inst.TemplateNames() | ||
509 | } else { | ||
510 | mode = "GNS" | ||
511 | } | ||
512 | } | ||
513 | // use built-in GNS (fall-back) | ||
514 | if mode == "GNS" { | ||
515 | // enforce GNS behaviour: | ||
516 | // compile a list of acceptable types for new records | ||
517 | data.RRspecs = compatibleRR(rrs, label) | ||
518 | templ = "new_record" | ||
519 | } | ||
437 | data.Ref = id | 520 | data.Ref = id |
438 | data.Params["label"] = label | 521 | data.Params["label"] = label |
439 | data.Params["lid"] = util.CastToString(id) | 522 | data.Params["lid"] = util.CastToString(id) |
440 | renderPage(w, data, "new_record") | 523 | renderPage(w, data, templ) |
441 | return | 524 | return |
442 | } | 525 | } |
443 | } | 526 | } |
@@ -507,11 +590,12 @@ func (zm *ZoneMaster) edit(w http.ResponseWriter, r *http.Request) { | |||
507 | return | 590 | return |
508 | } | 591 | } |
509 | // set edit parameters | 592 | // set edit parameters |
510 | data.Params["zone"], _ = zm.zdb.GetName("zones", id) | 593 | data.Params["zone"], _ = zm.zdb.GetName("zones", label.Zone) |
511 | data.Params["zid"] = util.CastToString(label.Zone) | 594 | data.Params["zid"] = util.CastToString(label.Zone) |
512 | data.Params["name"] = label.Name | 595 | data.Params["name"] = label.Name |
513 | data.Params["created"] = guiTime(label.Created) | 596 | data.Params["created"] = guiTime(label.Created) |
514 | data.Params["modified"] = guiTime(label.Modified) | 597 | data.Params["modified"] = guiTime(label.Modified) |
598 | data.Params["query"] = label.KeyHash.String() | ||
515 | 599 | ||
516 | // show dialog | 600 | // show dialog |
517 | renderPage(w, data, "edit_label") | 601 | renderPage(w, data, "edit_label") |
@@ -541,8 +625,16 @@ func (zm *ZoneMaster) editRec(w http.ResponseWriter, r *http.Request, data *NewE | |||
541 | if rec, err = zm.zdb.GetRecord(data.Ref); err != nil { | 625 | if rec, err = zm.zdb.GetRecord(data.Ref); err != nil { |
542 | return | 626 | return |
543 | } | 627 | } |
544 | // build map of attribute values | 628 | // get prefix used for attributes and fields |
545 | pf := dlgPrefix[rec.RType] | 629 | pf, ok := dlgPrefix[rec.RType] |
630 | if !ok { | ||
631 | // no prefix defined; ask plugin | ||
632 | inst, ok := zm.hdlrs[rec.RType] | ||
633 | if !ok { | ||
634 | return errors.New("no prefix defined for record type") | ||
635 | } | ||
636 | pf = inst.Prefix(uint32(rec.RType)) + "_" | ||
637 | } | ||
546 | 638 | ||
547 | // save shared attributes | 639 | // save shared attributes |
548 | data.Params["prefix"] = pf | 640 | data.Params["prefix"] = pf |
@@ -551,10 +643,15 @@ func (zm *ZoneMaster) editRec(w http.ResponseWriter, r *http.Request, data *NewE | |||
551 | data.Params["modified"] = guiTime(rec.Modified) | 643 | data.Params["modified"] = guiTime(rec.Modified) |
552 | data.Params["label"], _ = zm.zdb.GetName("labels", rec.Label) | 644 | data.Params["label"], _ = zm.zdb.GetName("labels", rec.Label) |
553 | data.Params["lid"] = util.CastToString(rec.Label) | 645 | data.Params["lid"] = util.CastToString(rec.Label) |
554 | if rec.Expire.IsNever() { | 646 | if rec.Flags&enums.GNS_FLAG_RELATIVE_EXPIRATION != 0 { |
555 | data.Params[pf+"never"] = "on" | 647 | data.Params[pf+"ttl"] = "on" |
648 | data.Params[pf+"ttl_value"] = guiDuration(rec.Expire) | ||
556 | } else { | 649 | } else { |
557 | data.Params[pf+"expires"] = htmlTime(rec.Expire) | 650 | if rec.Expire.IsNever() { |
651 | data.Params[pf+"never"] = "on" | ||
652 | } else { | ||
653 | data.Params[pf+"expires"] = htmlTime(rec.Expire) | ||
654 | } | ||
558 | } | 655 | } |
559 | if rec.Flags&enums.GNS_FLAG_PRIVATE != 0 { | 656 | if rec.Flags&enums.GNS_FLAG_PRIVATE != 0 { |
560 | data.Params[pf+"private"] = "on" | 657 | data.Params[pf+"private"] = "on" |
@@ -562,9 +659,12 @@ func (zm *ZoneMaster) editRec(w http.ResponseWriter, r *http.Request, data *NewE | |||
562 | if rec.Flags&enums.GNS_FLAG_SHADOW != 0 { | 659 | if rec.Flags&enums.GNS_FLAG_SHADOW != 0 { |
563 | data.Params[pf+"shadow"] = "on" | 660 | data.Params[pf+"shadow"] = "on" |
564 | } | 661 | } |
565 | if rec.Flags&enums.GNS_FLAG_SUPPL != 0 { | 662 | if rec.Flags&enums.GNS_FLAG_SUPPLEMENTAL != 0 { |
566 | data.Params[pf+"suppl"] = "on" | 663 | data.Params[pf+"suppl"] = "on" |
567 | } | 664 | } |
665 | if rec.Flags&enums.GNS_FLAG_CRITICAL != 0 { | ||
666 | data.Params[pf+"critical"] = "on" | ||
667 | } | ||
568 | // get record instance | 668 | // get record instance |
569 | var inst rr.RR | 669 | var inst rr.RR |
570 | if inst, err = rr.ParseRR(rec.RType, rec.Data); err == nil { | 670 | if inst, err = rr.ParseRR(rec.RType, rec.Data); err == nil { |
diff --git a/src/gnunet/service/zonemaster/gui.htpl b/src/gnunet/service/zonemaster/gui.htpl index de51ee3..36e08f3 100644 --- a/src/gnunet/service/zonemaster/gui.htpl +++ b/src/gnunet/service/zonemaster/gui.htpl | |||
@@ -32,8 +32,9 @@ | |||
32 | {{define "dashboard"}} | 32 | {{define "dashboard"}} |
33 | <div> | 33 | <div> |
34 | <ul id="dashboard"> | 34 | <ul id="dashboard"> |
35 | {{if .}} | 35 | {{if .Zones}} |
36 | {{range $zi, $zone := .}} | 36 | {{$plugins := .Plugins}} |
37 | {{range $zi, $zone := .Zones}} | ||
37 | <li> | 38 | <li> |
38 | {{$z := $zone.Zone}} | 39 | {{$z := $zone.Zone}} |
39 | <span class="caret"><b>{{$z.Name}}</b></span> [{{keytype $z.Key.Type}}: {{$zone.PubID}}] | 40 | <span class="caret"><b>{{$z.Name}}</b></span> [{{keytype $z.Key.Type}}: {{$zone.PubID}}] |
@@ -67,7 +68,7 @@ | |||
67 | <td>{{rrtype $rec.RType}}</td> | 68 | <td>{{rrtype $rec.RType}}</td> |
68 | <td>{{rrdata $rec.RType $rec.Data}}</td> | 69 | <td>{{rrdata $rec.RType $rec.Data}}</td> |
69 | <td>{{rrflags $rec.Flags}}</td> | 70 | <td>{{rrflags $rec.Flags}}</td> |
70 | <td>{{date $rec.Expire}}</td> | 71 | <td>{{dateExp $rec.Expire $rec.Flags}}</td> |
71 | <td>{{date $rec.Created}}</td> | 72 | <td>{{date $rec.Created}}</td> |
72 | <td>{{date $rec.Modified}}</td> | 73 | <td>{{date $rec.Modified}}</td> |
73 | <td> | 74 | <td> |
@@ -82,7 +83,15 @@ | |||
82 | <li><h3>No resource records for label defined yet.</h3></li> | 83 | <li><h3>No resource records for label defined yet.</h3></li> |
83 | {{end}} | 84 | {{end}} |
84 | <li> | 85 | <li> |
85 | <a href="/new/rr/{{$l.ID}}" title="Add new record..."><button class="icon blue">✚</button></a> | 86 | <form action="/new/rr/{{$l.ID}}" method="get"> |
87 | <select name="mode"> | ||
88 | <option value="GNS" selected>GNS</option> | ||
89 | {{range $i,$v := $plugins}} | ||
90 | <option value="{{$i}}">{{$v}}</option> | ||
91 | {{end}} | ||
92 | </select> | ||
93 | <button id="submit" class="icon blue">✚</button> | ||
94 | </form> | ||
86 | </li> | 95 | </li> |
87 | </ul> | 96 | </ul> |
88 | </li> | 97 | </li> |
diff --git a/src/gnunet/service/zonemaster/gui_css.htpl b/src/gnunet/service/zonemaster/gui_css.htpl index 8a26b30..8dfac9b 100644 --- a/src/gnunet/service/zonemaster/gui_css.htpl +++ b/src/gnunet/service/zonemaster/gui_css.htpl | |||
@@ -230,5 +230,17 @@ | |||
230 | input.alternate:checked ~ div.alternate { | 230 | input.alternate:checked ~ div.alternate { |
231 | display: none; | 231 | display: none; |
232 | } | 232 | } |
233 | div.toggle-on { | ||
234 | display: none; | ||
235 | } | ||
236 | div.toggle-off { | ||
237 | display: block; | ||
238 | } | ||
239 | input.toggle:checked ~ div.toggle-on { | ||
240 | display: block; | ||
241 | } | ||
242 | input.toggle:checked ~ div.toggle-off { | ||
243 | display: none; | ||
244 | } | ||
233 | </style> | 245 | </style> |
234 | {{end}} | 246 | {{end}} |
diff --git a/src/gnunet/service/zonemaster/gui_edit.htpl b/src/gnunet/service/zonemaster/gui_edit.htpl index a4673b0..d1f30de 100644 --- a/src/gnunet/service/zonemaster/gui_edit.htpl +++ b/src/gnunet/service/zonemaster/gui_edit.htpl | |||
@@ -66,6 +66,7 @@ | |||
66 | <div> | 66 | <div> |
67 | <h3>Edit a GNS label for zone "{{$zone}}":</h3> | 67 | <h3>Edit a GNS label for zone "{{$zone}}":</h3> |
68 | <p><small>(Created: {{index .Params "created"}}, Last edited: {{index .Params "modified"}})</small></p> | 68 | <p><small>(Created: {{index .Params "created"}}, Last edited: {{index .Params "modified"}})</small></p> |
69 | <p>Query hash({{$name}}): {{index .Params "query"}}</p> | ||
69 | <form action="/action/upd/label/{{.Ref}}" method="post" onsubmit="return(label_validate());"> | 70 | <form action="/action/upd/label/{{.Ref}}" method="post" onsubmit="return(label_validate());"> |
70 | <input type="hidden" name="old_name" value="{{$name}}"> | 71 | <input type="hidden" name="old_name" value="{{$name}}"> |
71 | <input type="hidden" name="zid" value="{{index .Params "zid"}}"> | 72 | <input type="hidden" name="zid" value="{{index .Params "zid"}}"> |
diff --git a/src/gnunet/service/zonemaster/gui_plugin.go b/src/gnunet/service/zonemaster/gui_plugin.go new file mode 100644 index 0000000..97490a4 --- /dev/null +++ b/src/gnunet/service/zonemaster/gui_plugin.go | |||
@@ -0,0 +1,68 @@ | |||
1 | // This file is part of gnunet-go, a GNUnet-implementation in Golang. | ||
2 | // Copyright (C) 2019-2022 Bernd Fix >Y< | ||
3 | // | ||
4 | // gnunet-go is free software: you can redistribute it and/or modify it | ||
5 | // under the terms of the GNU Affero General Public License as published | ||
6 | // by the Free Software Foundation, either version 3 of the License, | ||
7 | // or (at your option) any later version. | ||
8 | // | ||
9 | // gnunet-go is distributed in the hope that it will be useful, but | ||
10 | // WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | // Affero General Public License for more details. | ||
13 | // | ||
14 | // You should have received a copy of the GNU Affero General Public License | ||
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | // | ||
17 | // SPDX-License-Identifier: AGPL3.0-or-later | ||
18 | |||
19 | package zonemaster | ||
20 | |||
21 | import ( | ||
22 | "gnunet/enums" | ||
23 | ) | ||
24 | |||
25 | // ZoneMasterUtility can perform utility functions on behalf of plugins | ||
26 | var ZoneMasterUtility = func(fcn string, args ...any) any { | ||
27 | switch fcn { | ||
28 | case "gns_type_name": | ||
29 | return enums.GNSType(args[0].(uint32)).String() | ||
30 | case "gns_flags": | ||
31 | return enums.GNSFlag(args[0].(uint32)).List() | ||
32 | } | ||
33 | return nil | ||
34 | } | ||
35 | |||
36 | // ZoneMasterPlugin handles resource record type specific functionality | ||
37 | type Plugin interface { | ||
38 | // SetUtility passes a utility function to plugins | ||
39 | // (Callback-like function) | ||
40 | SetUtility(any) | ||
41 | |||
42 | // Name of the plugin | ||
43 | Name() string | ||
44 | |||
45 | // CanHandle returns a list of resource record types | ||
46 | CanHandle() []uint32 | ||
47 | |||
48 | // Compute a set of record specs allowed under a label with existing records | ||
49 | Compatible(label string, rrSpecs [][2]uint32) [][2]uint32 | ||
50 | |||
51 | // Value returns a human-readable description of RR data | ||
52 | Value(t uint32, rr []byte) (string, error) | ||
53 | |||
54 | // Template returns the new / edit template for custom types | ||
55 | Template() string | ||
56 | |||
57 | // TemplateNames returns the names for the "new" and "edit" dialogs | ||
58 | TemplateNames() (string, string) | ||
59 | |||
60 | // Prefix returns the prefix for record attributes in map | ||
61 | Prefix(t uint32) string | ||
62 | |||
63 | // ToMap converts resource record data into GUI template variables | ||
64 | ToMap(t uint32, rr []byte) (map[string]string, error) | ||
65 | |||
66 | // FromMap converts a GUI template variables into resource record data | ||
67 | FromMap(t uint32, vars map[string]string) ([]byte, error) | ||
68 | } | ||
diff --git a/src/gnunet/service/zonemaster/gui_rr.htpl b/src/gnunet/service/zonemaster/gui_rr.htpl index 00b9148..06b926a 100644 --- a/src/gnunet/service/zonemaster/gui_rr.htpl +++ b/src/gnunet/service/zonemaster/gui_rr.htpl | |||
@@ -7,13 +7,24 @@ | |||
7 | <tr> | 7 | <tr> |
8 | <td align="right" valign="top"><b>Expires:</b></td> | 8 | <td align="right" valign="top"><b>Expires:</b></td> |
9 | <td> | 9 | <td> |
10 | Never <input type="checkbox" class="alternate" name="{{$pf}}never" | 10 | TTL <input type="checkbox" class="toggle" name="{{$pf}}ttl" |
11 | {{if eq "on" (index .Params (print $pf "never"))}}checked="checked"{{end}} | 11 | {{if eq "on" (index .Params (print $pf "ttl"))}}checked="checked"{{end}} |
12 | > | 12 | > |
13 | <div class="alternate"> | 13 | <div class="toggle-off"> |
14 | At given date and time: | 14 | Never <input type="checkbox" class="alternate" name="{{$pf}}never" |
15 | <input type="datetime-local" id="{{$pf}}expires" name="{{$pf}}expires" required | 15 | {{if eq "on" (index .Params (print $pf "never"))}}checked="checked"{{end}} |
16 | value="{{index .Params (print $pf "expires")}}" | 16 | > |
17 | <div class="alternate"> | ||
18 | At given date and time: | ||
19 | <input type="datetime-local" id="{{$pf}}expires" name="{{$pf}}expires" required | ||
20 | value="{{index .Params (print $pf "expires")}}" | ||
21 | > | ||
22 | </div> | ||
23 | </div> | ||
24 | <div class="toggle-on"> | ||
25 | Duration: <input type="text" name="{{$pf}}ttl_value" | ||
26 | pattern="([0-9]*h)?([0-9]*m)?([0-9]*s)?" | ||
27 | value="{{index .Params (print $pf "ttl_value")}}" | ||
17 | > | 28 | > |
18 | </div> | 29 | </div> |
19 | </td> | 30 | </td> |
@@ -22,14 +33,21 @@ | |||
22 | <td align="right" valign="top"><b>Flags:</b></td> | 33 | <td align="right" valign="top"><b>Flags:</b></td> |
23 | <td> | 34 | <td> |
24 | <input type="checkbox" name="{{$pf}}private" | 35 | <input type="checkbox" name="{{$pf}}private" |
25 | {{if eq "on" (index .Params (print $pf "private"))}}checked="checked" class="disabled"{{end}} | 36 | {{if eq "on" (index .Params (print $pf "private"))}}checked="checked"{{end}} |
37 | {{if eq "on" (index .Params (print $pf "private_enforced"))}}class="disabled"{{end}} | ||
26 | > Private<br> | 38 | > Private<br> |
27 | <input type="checkbox" name="{{$pf}}shadow" | 39 | <input type="checkbox" name="{{$pf}}shadow" |
28 | {{if eq "on" (index .Params (print $pf "shadow"))}}checked="checked" class="disabled"{{end}} | 40 | {{if eq "on" (index .Params (print $pf "shadow"))}}checked="checked"{{end}} |
41 | {{if eq "on" (index .Params (print $pf "shadow_enforced"))}}class="disabled"{{end}} | ||
29 | > Shadow<br> | 42 | > Shadow<br> |
30 | <input type="checkbox" name="{{$pf}}suppl" | 43 | <input type="checkbox" name="{{$pf}}suppl" |
31 | {{if eq "on" (index .Params (print $pf "suppl"))}}checked="checked" class="disabled"{{end}} | 44 | {{if eq "on" (index .Params (print $pf "suppl"))}}checked="checked"{{end}} |
45 | {{if eq "on" (index .Params (print $pf "suppl_enforced"))}}class="disabled"{{end}} | ||
32 | > Supplemental<br> | 46 | > Supplemental<br> |
47 | <input type="checkbox" name="{{$pf}}critical" | ||
48 | {{if eq "on" (index .Params (print $pf "critical"))}}checked="checked"{{end}} | ||
49 | {{if eq "on" (index .Params (print $pf "critical_enforced"))}}class="disabled"{{end}} | ||
50 | > Critical<br> | ||
33 | </td> | 51 | </td> |
34 | </tr> | 52 | </tr> |
35 | {{if eq .Action "new"}} | 53 | {{if eq .Action "new"}} |
diff --git a/src/gnunet/service/zonemaster/records.go b/src/gnunet/service/zonemaster/records.go index a10ee05..a24988c 100644 --- a/src/gnunet/service/zonemaster/records.go +++ b/src/gnunet/service/zonemaster/records.go | |||
@@ -22,7 +22,6 @@ import ( | |||
22 | "encoding/hex" | 22 | "encoding/hex" |
23 | "errors" | 23 | "errors" |
24 | "fmt" | 24 | "fmt" |
25 | "gnunet/crypto" | ||
26 | "gnunet/enums" | 25 | "gnunet/enums" |
27 | "gnunet/service/dht/blocks" | 26 | "gnunet/service/dht/blocks" |
28 | "gnunet/service/gns/rr" | 27 | "gnunet/service/gns/rr" |
@@ -87,6 +86,19 @@ func htmlTime(ts util.AbsoluteTime) string { | |||
87 | return time.UnixMicro(int64(ts.Val)).Format(timeHTML) | 86 | return time.UnixMicro(int64(ts.Val)).Format(timeHTML) |
88 | } | 87 | } |
89 | 88 | ||
89 | func parseDuration(s string) uint64 { | ||
90 | d, err := time.ParseDuration(s) | ||
91 | if err != nil { | ||
92 | return 3600000000 // 1 hour default | ||
93 | } | ||
94 | return uint64(d.Microseconds()) | ||
95 | } | ||
96 | |||
97 | func guiDuration(ts util.AbsoluteTime) string { | ||
98 | d := time.Duration(ts.Val) * time.Microsecond | ||
99 | return d.String() | ||
100 | } | ||
101 | |||
90 | func guiTime(ts util.AbsoluteTime) string { | 102 | func guiTime(ts util.AbsoluteTime) string { |
91 | if ts.IsNever() { | 103 | if ts.IsNever() { |
92 | return "Never" | 104 | return "Never" |
@@ -109,7 +121,7 @@ func guiRRdata(t enums.GNSType, buf []byte) string { | |||
109 | // get record instance | 121 | // get record instance |
110 | inst, err := rr.ParseRR(t, buf) | 122 | inst, err := rr.ParseRR(t, buf) |
111 | if err != nil { | 123 | if err != nil { |
112 | return "<unknown>" | 124 | return "(invalid)" |
113 | } | 125 | } |
114 | // type-dependent rendering | 126 | // type-dependent rendering |
115 | switch rec := inst.(type) { | 127 | switch rec := inst.(type) { |
@@ -177,10 +189,15 @@ func guiPrefix(t enums.GNSType) string { | |||
177 | // parse expiration time and flags from GUI parameters | 189 | // parse expiration time and flags from GUI parameters |
178 | func guiParse(params map[string]string, pf string) (exp util.AbsoluteTime, flags enums.GNSFlag) { | 190 | func guiParse(params map[string]string, pf string) (exp util.AbsoluteTime, flags enums.GNSFlag) { |
179 | // parse expiration time | 191 | // parse expiration time |
180 | exp = util.AbsoluteTimeNever() | 192 | if _, ok := params[pf+"ttl"]; ok { |
181 | if _, ok := params[pf+"never"]; !ok { | 193 | flags |= enums.GNS_FLAG_RELATIVE_EXPIRATION |
182 | ts, _ := time.Parse(timeHTML, params[pf+"expires"]) | 194 | exp.Val = parseDuration(params[pf+"ttl_value"]) |
183 | exp.Val = uint64(ts.UnixMicro()) | 195 | } else { |
196 | exp = util.AbsoluteTimeNever() | ||
197 | if _, ok := params[pf+"never"]; !ok { | ||
198 | ts, _ := time.Parse(timeHTML, params[pf+"expires"]) | ||
199 | exp.Val = uint64(ts.UnixMicro()) | ||
200 | } | ||
184 | } | 201 | } |
185 | // parse flags | 202 | // parse flags |
186 | flags = 0 | 203 | flags = 0 |
@@ -191,7 +208,10 @@ func guiParse(params map[string]string, pf string) (exp util.AbsoluteTime, flags | |||
191 | flags |= enums.GNS_FLAG_SHADOW | 208 | flags |= enums.GNS_FLAG_SHADOW |
192 | } | 209 | } |
193 | if _, ok := params[pf+"suppl"]; ok { | 210 | if _, ok := params[pf+"suppl"]; ok { |
194 | flags |= enums.GNS_FLAG_SUPPL | 211 | flags |= enums.GNS_FLAG_SUPPLEMENTAL |
212 | } | ||
213 | if _, ok := params[pf+"critical"]; ok { | ||
214 | flags |= enums.GNS_FLAG_CRITICAL | ||
195 | } | 215 | } |
196 | return | 216 | return |
197 | } | 217 | } |
@@ -351,7 +371,7 @@ func compatibleRR(in []*enums.GNSSpec, label string) (out []*enums.GNSSpec) { | |||
351 | } | 371 | } |
352 | 372 | ||
353 | // get a list of resource records for a given label in a zone. | 373 | // get a list of resource records for a given label in a zone. |
354 | func (zm *ZoneMaster) getRecords(zk *crypto.ZoneKey, label int64) (rs *blocks.RecordSet, expire util.AbsoluteTime, err error) { | 374 | func (zm *ZoneMaster) GetRecordSet(label int64, filter enums.GNSFilter) (rs *blocks.RecordSet, expire util.AbsoluteTime, err error) { |
355 | // collect records for zone label | 375 | // collect records for zone label |
356 | var recs []*store.Record | 376 | var recs []*store.Record |
357 | if recs, err = zm.zdb.GetRecords("lid=%d", label); err != nil { | 377 | if recs, err = zm.zdb.GetRecords("lid=%d", label); err != nil { |
@@ -361,7 +381,12 @@ func (zm *ZoneMaster) getRecords(zk *crypto.ZoneKey, label int64) (rs *blocks.Re | |||
361 | expire = util.AbsoluteTimeNever() | 381 | expire = util.AbsoluteTimeNever() |
362 | rs = blocks.NewRecordSet() | 382 | rs = blocks.NewRecordSet() |
363 | for _, r := range recs { | 383 | for _, r := range recs { |
364 | if r.Expire.Compare(expire) < 0 { | 384 | // filter out records |
385 | if filter&enums.GNS_FILTER_OMIT_PRIVATE != 0 && r.Flags&enums.GNS_FLAG_PRIVATE != 0 { | ||
386 | continue | ||
387 | } | ||
388 | // skip TTL expiry when determining earliest expiry | ||
389 | if r.Flags&enums.GNS_FLAG_RELATIVE_EXPIRATION == 0 && r.Expire.Compare(expire) < 0 { | ||
365 | expire = r.Expire | 390 | expire = r.Expire |
366 | } | 391 | } |
367 | rs.AddRecord(&r.ResourceRecord) | 392 | rs.AddRecord(&r.ResourceRecord) |
diff --git a/src/gnunet/service/zonemaster/service.go b/src/gnunet/service/zonemaster/service.go index 5725ec8..399b5d8 100644 --- a/src/gnunet/service/zonemaster/service.go +++ b/src/gnunet/service/zonemaster/service.go | |||
@@ -25,7 +25,6 @@ import ( | |||
25 | 25 | ||
26 | "gnunet/config" | 26 | "gnunet/config" |
27 | "gnunet/core" | 27 | "gnunet/core" |
28 | "gnunet/enums" | ||
29 | "gnunet/message" | 28 | "gnunet/message" |
30 | "gnunet/service" | 29 | "gnunet/service" |
31 | "gnunet/service/dht/blocks" | 30 | "gnunet/service/dht/blocks" |
@@ -89,135 +88,39 @@ func (zm *ZoneMaster) ServeClient(ctx context.Context, id int, mc *service.Conne | |||
89 | // Handle a single incoming message | 88 | // Handle a single incoming message |
90 | func (zm *ZoneMaster) HandleMessage(ctx context.Context, sender *util.PeerID, msg message.Message, back transport.Responder) bool { | 89 | func (zm *ZoneMaster) HandleMessage(ctx context.Context, sender *util.PeerID, msg message.Message, back transport.Responder) bool { |
91 | // assemble log label | 90 | // assemble log label |
92 | var id int | ||
93 | var label string | 91 | var label string |
94 | if v := ctx.Value(core.CtxKey("params")); v != nil { | 92 | if v := ctx.Value(core.CtxKey("params")); v != nil { |
95 | if ps, ok := v.(util.ParameterSet); ok { | 93 | if ps, ok := v.(util.ParameterSet); ok { |
96 | label, _ = util.GetParam[string](ps, "label") | 94 | label, _ = util.GetParam[string](ps, "label") |
97 | id, _ = util.GetParam[int](ps, "id") | ||
98 | } | 95 | } |
99 | } | 96 | } |
100 | // perform lookup | 97 | // perform lookup |
101 | switch m := msg.(type) { | 98 | switch msg.(type) { |
102 | 99 | ||
103 | //------------------------------------------------------------------ | 100 | //------------------------------------------------------------------ |
104 | // Identity service | 101 | // Identity service |
105 | //------------------------------------------------------------------ | 102 | //------------------------------------------------------------------ |
106 | 103 | ||
107 | // start identity update listener | 104 | case *message.IdentityStartMsg, |
108 | case *message.IdentityStartMsg: | 105 | *message.IdentityCreateMsg, |
109 | if err := zm.identity.Start(ctx, id); err != nil { | 106 | *message.IdentityRenameMsg, |
110 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity session for %d failed: %v\n", label, id, err) | 107 | *message.IdentityDeleteMsg, |
111 | return false | 108 | *message.IdentityLookupMsg: |
112 | } | 109 | zm.identity.HandleMessage(ctx, sender, msg, back) |
113 | |||
114 | // create a new identity with given private key | ||
115 | case *message.IdentityCreateMsg: | ||
116 | if err := zm.identity.Create(ctx, id, m.ZoneKey, m.Name()); err != nil { | ||
117 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity create failed: %v\n", label, err) | ||
118 | return false | ||
119 | } | ||
120 | |||
121 | // rename identity | ||
122 | case *message.IdentityRenameMsg: | ||
123 | id, err := zm.zdb.GetIdentityByName(m.OldName(), IDENT_DEFAULT_SERVICE) | ||
124 | if err != nil { | ||
125 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity lookup failed: %v\n", label, err) | ||
126 | return false | ||
127 | } | ||
128 | // change name | ||
129 | id.Name = m.NewName() | ||
130 | err = zm.zdb.SetIdentity(id) | ||
131 | |||
132 | // send response | ||
133 | rc := enums.RC_OK | ||
134 | msg := "" | ||
135 | if err != nil { | ||
136 | rc = enums.RC_NO | ||
137 | msg = err.Error() | ||
138 | } | ||
139 | resp := message.NewIdentityResultCodeMsg(rc, msg) | ||
140 | if err = back.Send(ctx, resp); err != nil { | ||
141 | logger.Printf(logger.ERROR, "[identity:%s] Can't send response (%v): %v\n", label, resp, err) | ||
142 | } | ||
143 | |||
144 | // delete identity | ||
145 | case *message.IdentityDeleteMsg: | ||
146 | id, err := zm.zdb.GetIdentityByName(m.Name(), IDENT_DEFAULT_SERVICE) | ||
147 | if err != nil { | ||
148 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity lookup failed: %v\n", label, err) | ||
149 | return false | ||
150 | } | ||
151 | // delete in database | ||
152 | id.Name = "" | ||
153 | err = zm.zdb.SetIdentity(id) | ||
154 | |||
155 | // send response | ||
156 | rc := enums.RC_OK | ||
157 | msg := "" | ||
158 | if err != nil { | ||
159 | rc = enums.RC_NO | ||
160 | msg = err.Error() | ||
161 | } | ||
162 | resp := message.NewIdentityResultCodeMsg(rc, msg) | ||
163 | if err = back.Send(ctx, resp); err != nil { | ||
164 | logger.Printf(logger.ERROR, "[identity:%s] Can't send response (%v): %v\n", label, resp, err) | ||
165 | } | ||
166 | |||
167 | // lookup identity | ||
168 | case *message.IdentityLookupMsg: | ||
169 | id, err := zm.zdb.GetIdentityByName(m.Name, IDENT_DEFAULT_SERVICE) | ||
170 | if err != nil { | ||
171 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity lookup failed: %v\n", label, err) | ||
172 | return false | ||
173 | } | ||
174 | resp := message.NewIdentityUpdateMsg(id.Name, id.Key) | ||
175 | logger.Printf(logger.DBG, "[identity:%s] Sending %v", label, resp) | ||
176 | if err = back.Send(ctx, resp); err != nil { | ||
177 | logger.Printf(logger.ERROR, "[identity:%s] Can't send response (%v): %v\n", label, resp, err) | ||
178 | } | ||
179 | |||
180 | // get default identity for service | ||
181 | case *message.IdentityGetDefaultMsg: | ||
182 | id, err := zm.zdb.GetDefaultIdentity(m.Service()) | ||
183 | if err != nil { | ||
184 | logger.Printf(logger.ERROR, "[zonemaster%s] Identity lookup failed: %v\n", label, err) | ||
185 | return false | ||
186 | } | ||
187 | resp := message.NewIdentityUpdateMsg(id.Name, id.Key) | ||
188 | logger.Printf(logger.DBG, "[identity:%s] Sending %v", label, resp) | ||
189 | if err = back.Send(ctx, resp); err != nil { | ||
190 | logger.Printf(logger.ERROR, "[identity:%s] Can't send response (%v): %v\n", label, resp, err) | ||
191 | } | ||
192 | |||
193 | // set default identity for service | ||
194 | case *message.IdentitySetDefaultMsg: | ||
195 | err := zm.zdb.SetDefaultIdentity(m.ZoneKey, m.Service()) | ||
196 | |||
197 | // send response | ||
198 | rc := enums.RC_OK | ||
199 | msg := "" | ||
200 | if err != nil { | ||
201 | rc = enums.RC_NO | ||
202 | msg = err.Error() | ||
203 | } | ||
204 | resp := message.NewIdentityResultCodeMsg(rc, msg) | ||
205 | if err = back.Send(ctx, resp); err != nil { | ||
206 | logger.Printf(logger.ERROR, "[identity:%s] Can't send response (%v): %v\n", label, resp, err) | ||
207 | } | ||
208 | 110 | ||
209 | //------------------------------------------------------------------ | 111 | //------------------------------------------------------------------ |
210 | // Namestore service | 112 | // Namestore service |
211 | //------------------------------------------------------------------ | 113 | //------------------------------------------------------------------ |
212 | 114 | ||
213 | // start new zone iteration | 115 | case *message.NamestoreZoneIterStartMsg, |
214 | case *message.NamestoreZoneIterStartMsg: | 116 | *message.NamestoreZoneIterNextMsg, |
215 | iter := zm.namestore.NewIterator(m.ID, m.ZoneKey) | 117 | *message.NamestoreRecordStoreMsg, |
216 | resp := iter.Next() | 118 | *message.NamestoreRecordLookupMsg, |
217 | if err := back.Send(ctx, resp); err != nil { | 119 | *message.NamestoreZoneToNameMsg, |
218 | logger.Printf(logger.ERROR, "[zonemaster%s] Can't send response (%v)\n", label, resp) | 120 | *message.NamestoreZoneToNameRespMsg, |
219 | return false | 121 | *message.NamestoreMonitorStartMsg, |
220 | } | 122 | *message.NamestoreMonitorNextMsg: |
123 | zm.namestore.HandleMessage(ctx, sender, msg, back) | ||
221 | 124 | ||
222 | default: | 125 | default: |
223 | //---------------------------------------------------------- | 126 | //---------------------------------------------------------- |
@@ -250,3 +153,12 @@ func (zm *ZoneMaster) StoreNamecache(ctx context.Context, query *blocks.GNSQuery | |||
250 | _, err = service.RequestResponse(ctx, "zonemaster", "namecache", config.Cfg.Namecache.Service.Socket, req, false) | 153 | _, err = service.RequestResponse(ctx, "zonemaster", "namecache", config.Cfg.Namecache.Service.Socket, req, false) |
251 | return | 154 | return |
252 | } | 155 | } |
156 | |||
157 | func sendResponse(ctx context.Context, label string, resp message.Message, back transport.Responder) bool { | ||
158 | logger.Printf(logger.DBG, "[%s] Sending %v", label, resp) | ||
159 | if err := back.Send(ctx, resp); err != nil { | ||
160 | logger.Printf(logger.ERROR, "[%s] Can't send response (%v)\n", label, resp) | ||
161 | return false | ||
162 | } | ||
163 | return true | ||
164 | } | ||
diff --git a/src/gnunet/service/zonemaster/service_identity.go b/src/gnunet/service/zonemaster/service_identity.go index b7777be..3d37cee 100644 --- a/src/gnunet/service/zonemaster/service_identity.go +++ b/src/gnunet/service/zonemaster/service_identity.go | |||
@@ -21,8 +21,8 @@ package zonemaster | |||
21 | import ( | 21 | import ( |
22 | "context" | 22 | "context" |
23 | "fmt" | 23 | "fmt" |
24 | "gnunet/core" | ||
24 | "gnunet/crypto" | 25 | "gnunet/crypto" |
25 | "gnunet/enums" | ||
26 | "gnunet/message" | 26 | "gnunet/message" |
27 | "gnunet/service/store" | 27 | "gnunet/service/store" |
28 | "gnunet/transport" | 28 | "gnunet/transport" |
@@ -31,11 +31,6 @@ import ( | |||
31 | "github.com/bfix/gospel/logger" | 31 | "github.com/bfix/gospel/logger" |
32 | ) | 32 | ) |
33 | 33 | ||
34 | //nolint:stylecheck // my style is my style... | ||
35 | const ( | ||
36 | IDENT_DEFAULT_SERVICE = "ego" | ||
37 | ) | ||
38 | |||
39 | //---------------------------------------------------------------------- | 34 | //---------------------------------------------------------------------- |
40 | // "GNUnet Identity" service implementation: | 35 | // "GNUnet Identity" service implementation: |
41 | //---------------------------------------------------------------------- | 36 | //---------------------------------------------------------------------- |
@@ -89,8 +84,8 @@ func (ident *IdentityService) Start(ctx context.Context, id int) (err error) { | |||
89 | return | 84 | return |
90 | } | 85 | } |
91 | // initial update is to send all existing identites | 86 | // initial update is to send all existing identites |
92 | var list []*store.Identity | 87 | var list []*store.Zone |
93 | if list, err = ident.zm.zdb.GetIdentities(""); err != nil { | 88 | if list, err = ident.zm.zdb.GetZones(""); err != nil { |
94 | return | 89 | return |
95 | } | 90 | } |
96 | for _, ident := range list { | 91 | for _, ident := range list { |
@@ -118,18 +113,101 @@ func (ident *IdentityService) Create(ctx context.Context, cid int, zk *crypto.Zo | |||
118 | return | 113 | return |
119 | } | 114 | } |
120 | // add identity | 115 | // add identity |
121 | id := store.NewIdentity(name, zk, IDENT_DEFAULT_SERVICE) | 116 | id := store.NewZone(name, zk) |
122 | err = ident.zm.zdb.SetIdentity(id) | 117 | err = ident.zm.zdb.SetZone(id) |
123 | rc := enums.RC_OK | 118 | rc := 0 |
124 | msg := "" | ||
125 | if err != nil { | 119 | if err != nil { |
126 | rc = enums.RC_NO | 120 | rc = 1 |
127 | msg = err.Error() | ||
128 | } | 121 | } |
129 | resp := message.NewIdentityResultCodeMsg(rc, msg) | 122 | resp := message.NewIdentityResultCodeMsg(rc) |
130 | if err = sess.back.Send(ctx, resp); err != nil { | 123 | if err = sess.back.Send(ctx, resp); err != nil { |
131 | logger.Printf(logger.ERROR, "[identity:%d] Can't send response (%v): %v\n", cid, resp, err) | 124 | logger.Printf(logger.ERROR, "[identity:%d] Can't send response (%v): %v\n", cid, resp, err) |
132 | return | 125 | return |
133 | } | 126 | } |
134 | return | 127 | return |
135 | } | 128 | } |
129 | |||
130 | // HandleMessage processes a single incoming message | ||
131 | func (ident *IdentityService) HandleMessage(ctx context.Context, sender *util.PeerID, msg message.Message, back transport.Responder) bool { | ||
132 | // assemble log label | ||
133 | var id int | ||
134 | var label string | ||
135 | if v := ctx.Value(core.CtxKey("params")); v != nil { | ||
136 | if ps, ok := v.(util.ParameterSet); ok { | ||
137 | label, _ = util.GetParam[string](ps, "label") | ||
138 | id, _ = util.GetParam[int](ps, "id") | ||
139 | } | ||
140 | } | ||
141 | // perform lookup | ||
142 | switch m := msg.(type) { | ||
143 | |||
144 | // start identity update listener | ||
145 | case *message.IdentityStartMsg: | ||
146 | if err := ident.Start(ctx, id); err != nil { | ||
147 | logger.Printf(logger.ERROR, "[identity%s] Identity session for %d failed: %v\n", label, id, err) | ||
148 | return false | ||
149 | } | ||
150 | |||
151 | // create a new identity with given private key | ||
152 | case *message.IdentityCreateMsg: | ||
153 | if err := ident.Create(ctx, id, m.ZoneKey, m.Name()); err != nil { | ||
154 | logger.Printf(logger.ERROR, "[identity%s] Identity create failed: %v\n", label, err) | ||
155 | return false | ||
156 | } | ||
157 | |||
158 | // rename identity | ||
159 | case *message.IdentityRenameMsg: | ||
160 | id, err := ident.zm.zdb.GetZoneByName(m.OldName()) | ||
161 | if err != nil { | ||
162 | logger.Printf(logger.ERROR, "[identity%s] Identity lookup failed: %v\n", label, err) | ||
163 | return false | ||
164 | } | ||
165 | // change name | ||
166 | id.Name = m.NewName() | ||
167 | err = ident.zm.zdb.SetZone(id) | ||
168 | |||
169 | // send response | ||
170 | rc := 0 | ||
171 | if err != nil { | ||
172 | rc = 1 | ||
173 | } | ||
174 | resp := message.NewIdentityResultCodeMsg(rc) | ||
175 | if !sendResponse(ctx, "identity"+label, resp, back) { | ||
176 | return false | ||
177 | } | ||
178 | |||
179 | // delete identity | ||
180 | case *message.IdentityDeleteMsg: | ||
181 | id, err := ident.zm.zdb.GetZoneByName(m.Name()) | ||
182 | if err != nil { | ||
183 | logger.Printf(logger.ERROR, "[identity%s] Identity lookup failed: %v\n", label, err) | ||
184 | return false | ||
185 | } | ||
186 | // delete in database | ||
187 | id.Name = "" | ||
188 | err = ident.zm.zdb.SetZone(id) | ||
189 | |||
190 | // send response | ||
191 | rc := 0 | ||
192 | if err != nil { | ||
193 | rc = 1 | ||
194 | } | ||
195 | resp := message.NewIdentityResultCodeMsg(rc) | ||
196 | if !sendResponse(ctx, "identity"+label, resp, back) { | ||
197 | return false | ||
198 | } | ||
199 | |||
200 | // lookup identity | ||
201 | case *message.IdentityLookupMsg: | ||
202 | id, err := ident.zm.zdb.GetZoneByName(m.Name) | ||
203 | if err != nil { | ||
204 | logger.Printf(logger.ERROR, "[identity%s] Identity lookup failed: %v\n", label, err) | ||
205 | return false | ||
206 | } | ||
207 | resp := message.NewIdentityUpdateMsg(id.Name, id.Key) | ||
208 | if !sendResponse(ctx, "identity"+label, resp, back) { | ||
209 | return false | ||
210 | } | ||
211 | } | ||
212 | return true | ||
213 | } | ||
diff --git a/src/gnunet/service/zonemaster/service_namestore.go b/src/gnunet/service/zonemaster/service_namestore.go index 2c6d7d1..be24142 100644 --- a/src/gnunet/service/zonemaster/service_namestore.go +++ b/src/gnunet/service/zonemaster/service_namestore.go | |||
@@ -19,59 +19,99 @@ | |||
19 | package zonemaster | 19 | package zonemaster |
20 | 20 | ||
21 | import ( | 21 | import ( |
22 | "context" | ||
23 | "gnunet/core" | ||
22 | "gnunet/crypto" | 24 | "gnunet/crypto" |
25 | "gnunet/enums" | ||
23 | "gnunet/message" | 26 | "gnunet/message" |
27 | "gnunet/service/dht/blocks" | ||
24 | "gnunet/service/store" | 28 | "gnunet/service/store" |
29 | "gnunet/transport" | ||
25 | "gnunet/util" | 30 | "gnunet/util" |
31 | |||
32 | "github.com/bfix/gospel/logger" | ||
26 | ) | 33 | ) |
27 | 34 | ||
28 | //---------------------------------------------------------------------- | 35 | //====================================================================== |
29 | // "GNUnet Namestore" service implementation: | 36 | // "GNUnet Namestore" service implementation: |
37 | //====================================================================== | ||
38 | |||
39 | //---------------------------------------------------------------------- | ||
40 | // Zone iterator | ||
30 | //---------------------------------------------------------------------- | 41 | //---------------------------------------------------------------------- |
31 | 42 | ||
43 | // ZoneIterator is used to traverse all labels in a zone | ||
32 | type ZoneIterator struct { | 44 | type ZoneIterator struct { |
33 | id uint32 | 45 | id uint32 // request ID |
34 | zk *crypto.ZonePrivate | 46 | zid int64 // database ID of zone |
35 | lastUsed util.AbsoluteTime | 47 | zk *crypto.ZonePrivate // private zone key |
36 | db *store.ZoneDB | 48 | lastUsed util.AbsoluteTime // last time iterator was used |
37 | 49 | zm *ZoneMaster // reference to zone master | |
38 | labels []int64 | 50 | labels []int64 // list of label ids in database for zone |
39 | pos int | 51 | pos int // iteration step |
40 | } | 52 | } |
41 | 53 | ||
42 | func NewZoneIterator(id uint32, zk *crypto.ZonePrivate, db *store.ZoneDB) (zi *ZoneIterator, err error) { | 54 | // NewZoneIterator initialize an iterator to traverse the zone labels |
55 | func NewZoneIterator(id uint32, zk *crypto.ZonePrivate, zm *ZoneMaster) (zi *ZoneIterator, err error) { | ||
43 | // get list of labels to handle | 56 | // get list of labels to handle |
44 | var labels []int64 | 57 | var labels []int64 |
45 | if labels, err = db.GetLabelIDs(zk); err != nil { | 58 | var zid int64 |
59 | if labels, zid, err = zm.zdb.GetLabelIDs(zk); err != nil { | ||
46 | return | 60 | return |
47 | } | 61 | } |
48 | // assemble zone iterator | 62 | // assemble zone iterator |
49 | zi = &ZoneIterator{ | 63 | zi = &ZoneIterator{ |
50 | id: id, | 64 | id: id, |
65 | zid: zid, | ||
51 | zk: zk, | 66 | zk: zk, |
52 | lastUsed: util.AbsoluteTimeNow(), | 67 | lastUsed: util.AbsoluteTimeNow(), |
53 | db: db, | 68 | zm: zm, |
54 | pos: 0, | 69 | pos: 0, |
55 | labels: labels, | 70 | labels: labels, |
56 | } | 71 | } |
57 | return | 72 | return |
58 | } | 73 | } |
59 | 74 | ||
60 | func (zi *ZoneIterator) Next() *message.NamestoreRecordResultMsg { | 75 | // Next returns the next record |
61 | if zi.pos == len(zi.labels)-1 { | 76 | func (zi *ZoneIterator) Next() (msg message.Message, done bool) { |
62 | // end of list reached | 77 | if zi.pos == len(zi.labels) { |
63 | return nil | 78 | // end of list reached: |
79 | msg = message.NewNamestoreZoneIterEndMsg(zi.id) | ||
80 | done = true | ||
81 | return | ||
64 | } | 82 | } |
65 | 83 | // get resource records | |
66 | return nil | 84 | lid := zi.labels[zi.pos] |
85 | zi.pos++ | ||
86 | lbl, err := zi.zm.zdb.GetLabel(lid) | ||
87 | if err != nil { | ||
88 | logger.Printf(logger.ERROR, "[zone_iter] label name: %s", err.Error()) | ||
89 | return | ||
90 | } | ||
91 | rrSet, expire, err := zi.zm.GetRecordSet(lid, enums.GNS_FILTER_NONE) | ||
92 | if err != nil { | ||
93 | logger.Printf(logger.ERROR, "[zone_iter] records: %s", err.Error()) | ||
94 | return | ||
95 | } | ||
96 | // assemble response | ||
97 | rmsg := message.NewNamestoreRecordResultMsg(zi.id, zi.zk, lbl.Name) | ||
98 | rmsg.Expire = expire | ||
99 | rmsg.AddRecords(rrSet) | ||
100 | msg = rmsg | ||
101 | return | ||
67 | } | 102 | } |
68 | 103 | ||
104 | //---------------------------------------------------------------------- | ||
105 | // Namestore service | ||
106 | //---------------------------------------------------------------------- | ||
107 | |||
69 | // NamestoreService to handle namestore requests | 108 | // NamestoreService to handle namestore requests |
70 | type NamestoreService struct { | 109 | type NamestoreService struct { |
71 | zm *ZoneMaster | 110 | zm *ZoneMaster |
72 | iters *util.Map[uint32, *ZoneIterator] | 111 | iters *util.Map[uint32, *ZoneIterator] |
73 | } | 112 | } |
74 | 113 | ||
114 | // NewNamestoreService creates a new namestore service handler | ||
75 | func NewNamestoreService(zm *ZoneMaster) *NamestoreService { | 115 | func NewNamestoreService(zm *ZoneMaster) *NamestoreService { |
76 | return &NamestoreService{ | 116 | return &NamestoreService{ |
77 | zm: zm, | 117 | zm: zm, |
@@ -79,12 +119,194 @@ func NewNamestoreService(zm *ZoneMaster) *NamestoreService { | |||
79 | } | 119 | } |
80 | } | 120 | } |
81 | 121 | ||
122 | // NewIterator creates a new iterator for zone traversal | ||
82 | func (s *NamestoreService) NewIterator(id uint32, zk *crypto.ZonePrivate) *ZoneIterator { | 123 | func (s *NamestoreService) NewIterator(id uint32, zk *crypto.ZonePrivate) *ZoneIterator { |
83 | zi := &ZoneIterator{ | 124 | zi, err := NewZoneIterator(id, zk, s.zm) |
84 | id: id, | 125 | if err != nil { |
85 | zk: zk, | 126 | logger.Printf(logger.ERROR, "[namestore] new zone iterator: %s", err.Error()) |
86 | lastUsed: util.AbsoluteTimeNow(), | 127 | return nil |
87 | } | 128 | } |
88 | s.iters.Put(id, zi, 0) | 129 | s.iters.Put(id, zi, 0) |
89 | return zi | 130 | return zi |
90 | } | 131 | } |
132 | |||
133 | // GetIterator returns the iterator for request ID | ||
134 | func (s *NamestoreService) GetIterator(id uint32) (*ZoneIterator, bool) { | ||
135 | return s.iters.Get(id, 0) | ||
136 | } | ||
137 | |||
138 | // DropIterator removes the iterator for request ID | ||
139 | func (s *NamestoreService) DropIterator(id uint32) { | ||
140 | s.iters.Delete(id, 0) | ||
141 | } | ||
142 | |||
143 | // Store labeled recordsets to zone | ||
144 | func (s *NamestoreService) Store(zk *crypto.ZonePrivate, list []*message.NamestoreRecordSet) bool { | ||
145 | // get the zone with given key | ||
146 | zone, err := s.zm.zdb.GetZoneByKey(zk) | ||
147 | if err != nil { | ||
148 | logger.Printf(logger.ERROR, "[namestore] zone from key: %s", err.Error()) | ||
149 | return false | ||
150 | } | ||
151 | // add all record sets | ||
152 | for _, entry := range list { | ||
153 | // get labeled resource records | ||
154 | label, _ := util.ReadCString(entry.Name, 0) | ||
155 | // get label object from database | ||
156 | var lbl *store.Label | ||
157 | if lbl, err = s.zm.zdb.GetLabelByName(label, zone.ID, true); err != nil { | ||
158 | logger.Printf(logger.ERROR, "[namestore] label from name: %s", err.Error()) | ||
159 | return false | ||
160 | } | ||
161 | // disassemble record set data | ||
162 | rr, err := blocks.NewRecordSetFromRDATA(uint32(entry.RdCount), entry.RecData) | ||
163 | if err != nil { | ||
164 | logger.Printf(logger.ERROR, "[namestore] record from data: %s", err.Error()) | ||
165 | return false | ||
166 | } | ||
167 | for _, rr := range rr.Records { | ||
168 | // assemble record and store in database | ||
169 | rec := store.NewRecord(rr.Expire, rr.RType, rr.Flags, rr.Data) | ||
170 | rec.Label = lbl.ID | ||
171 | if err = s.zm.zdb.SetRecord(rec); err != nil { | ||
172 | logger.Printf(logger.ERROR, "[namestore] add record: %s", err.Error()) | ||
173 | return false | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | return true | ||
178 | } | ||
179 | |||
180 | // HandleMessage processes a single incoming message | ||
181 | func (s *NamestoreService) HandleMessage(ctx context.Context, sender *util.PeerID, msg message.Message, back transport.Responder) bool { | ||
182 | // assemble log label | ||
183 | var label string | ||
184 | if v := ctx.Value(core.CtxKey("params")); v != nil { | ||
185 | if ps, ok := v.(util.ParameterSet); ok { | ||
186 | label, _ = util.GetParam[string](ps, "label") | ||
187 | } | ||
188 | } | ||
189 | // perform lookup | ||
190 | switch m := msg.(type) { | ||
191 | |||
192 | // start new zone iteration | ||
193 | case *message.NamestoreZoneIterStartMsg: | ||
194 | // setup iterator | ||
195 | iter := s.NewIterator(m.ID, m.ZoneKey) | ||
196 | // return first result | ||
197 | resp, done := iter.Next() | ||
198 | if done { | ||
199 | s.DropIterator(m.ID) | ||
200 | } | ||
201 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
202 | return false | ||
203 | } | ||
204 | |||
205 | // next label(s) from zone iteration | ||
206 | case *message.NamestoreZoneIterNextMsg: | ||
207 | var resp message.Message | ||
208 | // lookup zone iterator | ||
209 | iter, ok := s.GetIterator(m.ID) | ||
210 | if !ok { | ||
211 | zk, _ := crypto.NullZonePrivate(enums.GNS_TYPE_PKEY) | ||
212 | resp = message.NewNamestoreRecordResultMsg(m.ID, zk, "") | ||
213 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
214 | return false | ||
215 | } | ||
216 | } else { | ||
217 | for n := 0; n < int(m.Limit); n++ { | ||
218 | // return next result | ||
219 | var done bool | ||
220 | resp, done = iter.Next() | ||
221 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
222 | return false | ||
223 | } | ||
224 | if done { | ||
225 | s.DropIterator(m.ID) | ||
226 | break | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | |||
231 | // store record in zone database | ||
232 | case *message.NamestoreRecordStoreMsg: | ||
233 | var rc uint32 | ||
234 | if !s.Store(m.ZoneKey, m.RSets) { | ||
235 | rc = 1 | ||
236 | } | ||
237 | resp := message.NewNamestoreRecordStoreRespMsg(m.ID, rc) | ||
238 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
239 | return false | ||
240 | } | ||
241 | |||
242 | // lookup records in zone under given label | ||
243 | case *message.NamestoreRecordLookupMsg: | ||
244 | // get resource records | ||
245 | getRecs := func() *blocks.RecordSet { | ||
246 | zone, err := s.zm.zdb.GetZoneByKey(m.ZoneKey) | ||
247 | if err != nil { | ||
248 | logger.Printf(logger.ERROR, "[namestore%s] zone lookup: %s", label, err.Error()) | ||
249 | return nil | ||
250 | } | ||
251 | lbl, err := s.zm.zdb.GetLabelByName(string(m.Label), zone.ID, false) | ||
252 | if err != nil { | ||
253 | logger.Printf(logger.ERROR, "[namestore%s] label lookup: %s", label, err.Error()) | ||
254 | return nil | ||
255 | } | ||
256 | rrSet, _, err := s.zm.GetRecordSet(lbl.ID, enums.GNSFilter(m.Filter)) | ||
257 | if err != nil { | ||
258 | logger.Printf(logger.ERROR, "[namestore%s] records: %s", label, err.Error()) | ||
259 | return nil | ||
260 | } | ||
261 | return rrSet | ||
262 | } | ||
263 | recs := getRecs() | ||
264 | // assemble response | ||
265 | resp := message.NewNamestoreRecordLookupRespMsg(m.ID, m.ZoneKey, string(m.Label)) | ||
266 | if recs != nil { | ||
267 | resp.AddRecords(recs) | ||
268 | resp.Found = int16(enums.RC_YES) | ||
269 | } else { | ||
270 | resp.Found = int16(enums.RC_NO) | ||
271 | } | ||
272 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
273 | return false | ||
274 | } | ||
275 | |||
276 | // lookup records based on query hash | ||
277 | case *message.NamestoreZoneToNameMsg: | ||
278 | ec := enums.EC_NONE | ||
279 | var label string | ||
280 | |||
281 | // get resource records | ||
282 | getRecs := func(hsh *crypto.HashCode) *blocks.RecordSet { | ||
283 | lbl, err := s.zm.zdb.GetLabelByKeyHash(hsh) | ||
284 | if err != nil { | ||
285 | logger.Printf(logger.ERROR, "[namestore%s] label hash lookup: %s", label, err.Error()) | ||
286 | ec = enums.EC_NAMESTORE_LOOKUP_ERROR | ||
287 | return nil | ||
288 | } | ||
289 | label = lbl.Name | ||
290 | rrSet, _, err := s.zm.GetRecordSet(lbl.ID, enums.GNS_FILTER_NONE) | ||
291 | if err != nil { | ||
292 | logger.Printf(logger.ERROR, "[namestore%s] records: %s", label, err.Error()) | ||
293 | ec = enums.EC_NAMESTORE_LOOKUP_ERROR | ||
294 | return nil | ||
295 | } | ||
296 | if rrSet.Count == 0 { | ||
297 | ec = enums.EC_NAMESTORE_NO_RESULTS | ||
298 | } | ||
299 | return rrSet | ||
300 | } | ||
301 | recs := getRecs(crypto.Hash(m.ZonePublic.KeyData)) | ||
302 | |||
303 | resp := message.NewNamestoreZoneToNameRespMsg(m.ID, m.ZoneKey, label, ec) | ||
304 | if recs != nil { | ||
305 | resp.AddRecords(recs) | ||
306 | } | ||
307 | if !sendResponse(ctx, "namestore"+label, resp, back) { | ||
308 | return false | ||
309 | } | ||
310 | } | ||
311 | return true | ||
312 | } | ||
diff --git a/src/gnunet/service/zonemaster/zonemaster.go b/src/gnunet/service/zonemaster/zonemaster.go index 4703d2c..01204d4 100644 --- a/src/gnunet/service/zonemaster/zonemaster.go +++ b/src/gnunet/service/zonemaster/zonemaster.go | |||
@@ -26,6 +26,7 @@ import ( | |||
26 | "gnunet/service/dht/blocks" | 26 | "gnunet/service/dht/blocks" |
27 | "gnunet/service/store" | 27 | "gnunet/service/store" |
28 | "gnunet/util" | 28 | "gnunet/util" |
29 | "plugin" | ||
29 | "time" | 30 | "time" |
30 | 31 | ||
31 | "github.com/bfix/gospel/logger" | 32 | "github.com/bfix/gospel/logger" |
@@ -41,16 +42,20 @@ import ( | |||
41 | type ZoneMaster struct { | 42 | type ZoneMaster struct { |
42 | Module | 43 | Module |
43 | 44 | ||
44 | zdb *store.ZoneDB // ZoneDB connection | 45 | zdb *store.ZoneDB // ZoneDB connection |
45 | namestore *NamestoreService // namestore subservice | 46 | plugins []Plugin // list of loaded plugins |
46 | identity *IdentityService // identity subservice | 47 | hdlrs map[enums.GNSType]Plugin // maps record types to handling plugin |
48 | namestore *NamestoreService // namestore subservice | ||
49 | identity *IdentityService // identity subservice | ||
47 | } | 50 | } |
48 | 51 | ||
49 | // NewService initializes a new zone master service. | 52 | // NewService initializes a new zone master service. |
50 | func NewService(ctx context.Context, c *core.Core) *ZoneMaster { | 53 | func NewService(ctx context.Context, c *core.Core, plugins []string) *ZoneMaster { |
51 | mod := NewModule(ctx, c) | 54 | mod := NewModule(ctx, c) |
52 | srv := &ZoneMaster{ | 55 | srv := &ZoneMaster{ |
53 | Module: *mod, | 56 | Module: *mod, |
57 | plugins: make([]Plugin, 0), | ||
58 | hdlrs: make(map[enums.GNSType]Plugin), | ||
54 | } | 59 | } |
55 | 60 | ||
56 | // set external function references (external services) | 61 | // set external function references (external services) |
@@ -61,6 +66,38 @@ func NewService(ctx context.Context, c *core.Core) *ZoneMaster { | |||
61 | srv.namestore = NewNamestoreService(srv) | 66 | srv.namestore = NewNamestoreService(srv) |
62 | srv.identity = NewIdentityService(srv) | 67 | srv.identity = NewIdentityService(srv) |
63 | 68 | ||
69 | // load all plugins | ||
70 | for _, pn := range plugins { | ||
71 | // get handle to plugin | ||
72 | plugin, err := plugin.Open(pn) | ||
73 | if err != nil { | ||
74 | logger.Printf(logger.ERROR, "[zonemaster] %v", err) | ||
75 | continue | ||
76 | } | ||
77 | // get plugin instance | ||
78 | sym, err := plugin.Lookup("Plugin") | ||
79 | if err != nil { | ||
80 | logger.Printf(logger.ERROR, "[zonemaster] can't lookup plugin instance: %v", err) | ||
81 | continue | ||
82 | } | ||
83 | inst, ok := sym.(Plugin) | ||
84 | if !ok { | ||
85 | logger.Println(logger.ERROR, "[zonemaster] can't cast plugin instance") | ||
86 | continue | ||
87 | } | ||
88 | logger.Printf(logger.INFO, "[zonemaster] plugin '%s' loaded.", inst.Name()) | ||
89 | |||
90 | // register Utility function with plugin | ||
91 | inst.SetUtility(ZoneMasterUtility) | ||
92 | |||
93 | // add plugin to resource record type handler | ||
94 | srv.plugins = append(srv.plugins, inst) | ||
95 | for _, t := range inst.CanHandle() { | ||
96 | gt := enums.GNSType(t) | ||
97 | srv.hdlrs[gt] = inst | ||
98 | logger.Printf(logger.INFO, "[zonemaster] Plugin handles type %s (%d)", gt, t) | ||
99 | } | ||
100 | } | ||
64 | return srv | 101 | return srv |
65 | } | 102 | } |
66 | 103 | ||
@@ -84,7 +121,6 @@ func (zm *ZoneMaster) Run(ctx context.Context) { | |||
84 | // publish on start-up | 121 | // publish on start-up |
85 | if err = zm.Publish(ctx); err != nil { | 122 | if err = zm.Publish(ctx); err != nil { |
86 | logger.Printf(logger.ERROR, "[zonemaster] initial publish failed: %s", err.Error()) | 123 | logger.Printf(logger.ERROR, "[zonemaster] initial publish failed: %s", err.Error()) |
87 | return | ||
88 | } | 124 | } |
89 | 125 | ||
90 | // periodically publish GNS blocks to the DHT | 126 | // periodically publish GNS blocks to the DHT |
@@ -106,6 +142,79 @@ loop: | |||
106 | 142 | ||
107 | // OnChange is called if a zone or record has changed or was inserted | 143 | // OnChange is called if a zone or record has changed or was inserted |
108 | func (zm *ZoneMaster) OnChange(table string, id int64, mode int) { | 144 | func (zm *ZoneMaster) OnChange(table string, id int64, mode int) { |
145 | // no action on delete | ||
146 | if mode == ChangeDelete { | ||
147 | return | ||
148 | } | ||
149 | // handle new and changed entries | ||
150 | var ( | ||
151 | zone *store.Zone | ||
152 | label *store.Label | ||
153 | rec *store.Record | ||
154 | err error | ||
155 | ) | ||
156 | ctx := context.Background() | ||
157 | switch table { | ||
158 | |||
159 | // zone changed | ||
160 | case "zones": | ||
161 | // a new zone can't have labels... | ||
162 | if mode == ChangeNew { | ||
163 | return | ||
164 | } | ||
165 | // get zone | ||
166 | if zone, err = zm.zdb.GetZone(id); err != nil { | ||
167 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (zone) failed: %s", err.Error()) | ||
168 | return | ||
169 | } | ||
170 | // collect labels for zone | ||
171 | var labels []*store.Label | ||
172 | if labels, err = zm.zdb.GetLabels("zid=%d", id); err != nil { | ||
173 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (zone) failed: %s", err.Error()) | ||
174 | return | ||
175 | } | ||
176 | for _, l := range labels { | ||
177 | // publish label | ||
178 | if err = zm.PublishZoneLabel(ctx, zone, l); err != nil { | ||
179 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (zone) failed: %s", err.Error()) | ||
180 | return | ||
181 | } | ||
182 | } | ||
183 | |||
184 | // record changed | ||
185 | case "records": | ||
186 | // get record | ||
187 | if rec, err = zm.zdb.GetRecord(id); err != nil { | ||
188 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (record) failed: %s", err.Error()) | ||
189 | return | ||
190 | } | ||
191 | // intended fall through... | ||
192 | id = rec.Label | ||
193 | mode = ChangeUpdate | ||
194 | fallthrough | ||
195 | |||
196 | // label changed | ||
197 | case "labels": | ||
198 | // a new label can't have records... | ||
199 | if mode == ChangeNew { | ||
200 | return | ||
201 | } | ||
202 | // get label | ||
203 | if label, err = zm.zdb.GetLabel(id); err != nil { | ||
204 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (label) failed: %s", err.Error()) | ||
205 | return | ||
206 | } | ||
207 | // get zone | ||
208 | if zone, err = zm.zdb.GetZone(id); err != nil { | ||
209 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (label) failed: %s", err.Error()) | ||
210 | return | ||
211 | } | ||
212 | // publish label | ||
213 | if err = zm.PublishZoneLabel(ctx, zone, label); err != nil { | ||
214 | logger.Printf(logger.ERROR, "[zonemaster] OnChange (label) failed: %s", err.Error()) | ||
215 | return | ||
216 | } | ||
217 | } | ||
109 | } | 218 | } |
110 | 219 | ||
111 | // Publish all zone labels to the DHT | 220 | // Publish all zone labels to the DHT |
@@ -137,7 +246,7 @@ func (zm *ZoneMaster) PublishZoneLabel(ctx context.Context, zone *store.Zone, la | |||
137 | logger.Printf(logger.INFO, "[zonemaster] Publishing label '%s' of zone %s", label.Name, zk.ID()) | 246 | logger.Printf(logger.INFO, "[zonemaster] Publishing label '%s' of zone %s", label.Name, zk.ID()) |
138 | 247 | ||
139 | // collect all records for label | 248 | // collect all records for label |
140 | rrSet, expire, err := zm.getRecords(zk, label.ID) | 249 | rrSet, expire, err := zm.GetRecordSet(label.ID, enums.GNS_FILTER_NONE) |
141 | if err != nil { | 250 | if err != nil { |
142 | return err | 251 | return err |
143 | } | 252 | } |
@@ -145,6 +254,15 @@ func (zm *ZoneMaster) PublishZoneLabel(ctx context.Context, zone *store.Zone, la | |||
145 | logger.Println(logger.INFO, "[zonemaster] No resource records -- skipped") | 254 | logger.Println(logger.INFO, "[zonemaster] No resource records -- skipped") |
146 | return nil | 255 | return nil |
147 | } | 256 | } |
257 | // post-process records for publication | ||
258 | for _, rec := range rrSet.Records { | ||
259 | // handle relative expiration | ||
260 | if rec.Flags&enums.GNS_FLAG_RELATIVE_EXPIRATION != 0 { | ||
261 | rec.Flags &^= enums.GNS_FLAG_RELATIVE_EXPIRATION | ||
262 | ttl := time.Duration(rec.Expire.Val) * time.Microsecond | ||
263 | rec.Expire = util.AbsoluteTimeNow().Add(ttl) | ||
264 | } | ||
265 | } | ||
148 | 266 | ||
149 | // assemble GNS query (common for DHT and Namecache) | 267 | // assemble GNS query (common for DHT and Namecache) |
150 | query := blocks.NewGNSQuery(zk, label.Name) | 268 | query := blocks.NewGNSQuery(zk, label.Name) |
@@ -173,7 +291,7 @@ func (zm *ZoneMaster) PublishZoneLabel(ctx context.Context, zone *store.Zone, la | |||
173 | // build block for DHT | 291 | // build block for DHT |
174 | blkDHT, _ := blocks.NewGNSBlock().(*blocks.GNSBlock) | 292 | blkDHT, _ := blocks.NewGNSBlock().(*blocks.GNSBlock) |
175 | blkDHT.Body.Expire = expire | 293 | blkDHT.Body.Expire = expire |
176 | blkDHT.Body.Data, err = zk.Encrypt(rrSet.Bytes(), label.Name, expire) | 294 | blkDHT.Body.Data, err = zk.Encrypt(rrSet.RDATA(), label.Name, expire) |
177 | if err != nil { | 295 | if err != nil { |
178 | return err | 296 | return err |
179 | } | 297 | } |
@@ -203,7 +321,7 @@ func (zm *ZoneMaster) PublishZoneLabel(ctx context.Context, zone *store.Zone, la | |||
203 | // build block for Namecache | 321 | // build block for Namecache |
204 | blkNC, _ := blocks.NewGNSBlock().(*blocks.GNSBlock) | 322 | blkNC, _ := blocks.NewGNSBlock().(*blocks.GNSBlock) |
205 | blkNC.Body.Expire = expire | 323 | blkNC.Body.Expire = expire |
206 | blkNC.Body.Data = rrSet.Bytes() | 324 | blkNC.Body.Data = rrSet.RDATA() |
207 | // sign block | 325 | // sign block |
208 | if dzk, _, err = zone.Key.Derive(label.Name, "gns"); err != nil { | 326 | if dzk, _, err = zone.Key.Derive(label.Name, "gns"); err != nil { |
209 | return err | 327 | return err |
diff --git a/src/gnunet/sync_with_gana.sh b/src/gnunet/sync_with_gana.sh new file mode 100755 index 0000000..2242dc7 --- /dev/null +++ b/src/gnunet/sync_with_gana.sh | |||
@@ -0,0 +1,33 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | |||
4 | changed=0 | ||
5 | |||
6 | function update() { | ||
7 | rc=$(diff "$1" "$2") | ||
8 | if [ -n "$rc" ]; then | ||
9 | cp "$2" "$1" | ||
10 | echo "Updated registry file '$1' from '$2'" | ||
11 | changed=1 | ||
12 | else | ||
13 | echo "Up-to-date registry file '$1'" | ||
14 | fi | ||
15 | } | ||
16 | |||
17 | # Synchronize GANA definitions | ||
18 | |||
19 | REPO=../../../gana | ||
20 | |||
21 | pushd $REPO | ||
22 | git pull | ||
23 | popd | ||
24 | |||
25 | update enums/gnunet-signature.rec $REPO/gnunet-signatures/registry.rec | ||
26 | update enums/gnunet-dht.rec $REPO/gnunet-dht-block-types/registry.rec | ||
27 | update enums/gnunet-gns.rec $REPO/gnu-name-system-record-types/registry.rec | ||
28 | update enums/gnunet-error-codes.rec $REPO/gnunet-error-codes/registry.rec | ||
29 | update enums/gnunet-gns-flags.rec $REPO/gnu-name-system-record-flags/registry.rec | ||
30 | |||
31 | if [ $changed -eq 1 ]; then | ||
32 | go generate ./... | ||
33 | fi | ||