Browse Source

Prepare usage of multiple GNUnet modules in a single binary.

Bernd Fix 3 months ago
parent
commit
5f848908ef
1 changed files with 40 additions and 0 deletions
  1. 40
    0
      src/gnunet/modules.go

+ 40
- 0
src/gnunet/modules.go View File

@@ -0,0 +1,40 @@
1
+//======================================================================
2
+// Standalone (all-in-one) implementation of GNUnet:
3
+// -------------------------------------------------
4
+// Instead of running GNUnet services like GNS or DHT in separate
5
+// processes communicating (exchanging messages) with each other over
6
+// Unix Domain Sockets, the standalone implementation combines all
7
+// service modules into a single binary running go-routines to
8
+// concurrently performing their tasks.
9
+//======================================================================
10
+
11
+package gnunet
12
+
13
+import (
14
+	"gnunet/service/gns"
15
+	"gnunet/service/namecache"
16
+)
17
+
18
+// List of all GNUnet service module instances
19
+type Instances struct {
20
+	GNS       *gns.GNSModule
21
+	Namecache *namecache.NamecacheModule
22
+}
23
+
24
+// Local reference to instance list
25
+var (
26
+	Modules Instances
27
+)
28
+
29
+// Initialize instance list and link module functions as required.
30
+func init() {
31
+
32
+	// Namecache (no calls to other modules)
33
+	Modules.Namecache = new(namecache.NamecacheModule)
34
+
35
+	// GNS (calls Namecache, DHT and Identity)
36
+	Modules.GNS = &gns.GNSModule{
37
+		LookupLocal: Modules.Namecache.Get,
38
+		StoreLocal:  Modules.Namecache.Put,
39
+	}
40
+}

Loading…
Cancel
Save