Initial commit with basic documentation
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,3 +13,7 @@
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
/.idea/vcs.xml
|
||||
/.idea/modules.xml
|
||||
/.idea/indranet.iml
|
||||
/.idea/.gitignore
|
||||
|
||||
74
README.md
74
README.md
@@ -1,2 +1,72 @@
|
||||
# indranet
|
||||
Lightning powered distributed virtual private network with Bitcoin and Lightning integration.
|
||||
# Indranet
|
||||
|
||||
Lightning powered distributed virtual private network with Bitcoin and Lightning
|
||||
integration.
|
||||
|
||||
## About
|
||||
|
||||
The ubiquitous use of encryption on the internet took some time to happen,
|
||||
there was a time when the US government defined them as munitions and
|
||||
claimed export restrictions, and famously the PGP project broke this via the
|
||||
First Amendment, by literally printing the source code on paper and then
|
||||
posting it, it became recognised that code, and encryption, are protected
|
||||
speech.
|
||||
|
||||
With ubiquitous 128 bit AES encryption now in use by default, the content of
|
||||
messages is secure. However, the volume and endpoints of signals are still
|
||||
useful intelligence data, enabling state level actors to attack internet
|
||||
users and violate their privacy and threaten their safety.
|
||||
|
||||
Protecting against this high level attack the main network currently doing
|
||||
this work is the [Tor network](https://torproject.org). However, this system
|
||||
has many flaws, and in recent times its centralised node registry has come
|
||||
under sustained attack by DDoS (distributed denial of service) attacks.
|
||||
|
||||
One of the big problems that I saw with this network is its weak network
|
||||
effect. There is no incentive for anyone to run nodes on the network, and
|
||||
worse, the most common use case is tunneling back out of the network to
|
||||
anonymize location, is largely abused and led to a lot of automated block
|
||||
systems arising on many internet services to prevent this abuse.
|
||||
|
||||
The use case that Indranet is first targeted at is protecting location
|
||||
origin data for Bitcoin transactions and Lightning Network channels. The
|
||||
increasing value of the currency makes it potentially profitable for the
|
||||
harvesting of geolocation data associated with targets in order to
|
||||
physically attack them and take their bitcoins. There has been more than a
|
||||
few such incidents already, and this is likely to trend upwards and make the
|
||||
Tor network an ongoing target to stop these transactions from working and/or
|
||||
unmask their locations and enable further escalation.
|
||||
|
||||
Lightning, in particular, currently half of the network capacity is routed
|
||||
through nodes running on Google Cloud and Amazon Web Services, forming a
|
||||
very large soft point for governments to harm the routing capacity of the
|
||||
network, impeding adoption, and potentially making a way for users to be
|
||||
robbed by state sized actors like the CIA, FSB, MI6 and similar
|
||||
organisations with zero accountability.
|
||||
|
||||
Thus, Indranet's main task is in fact creating a network of hidden services
|
||||
that are used by Bitcoin and Lightning node operators to perform
|
||||
transactions that will not be detectable or locatable by even large scale
|
||||
actors.
|
||||
|
||||
Thus, it is essential that routers on Indranet get paid for their work, in
|
||||
order to maintain their connection costs.
|
||||
|
||||
For this, Indranet uses a modified Lightning Network transaction scheme
|
||||
where users reserve session slots with routers via chaumian minting, which
|
||||
are then sent in onion layered packets to initiate sessions and in this
|
||||
payment, providing the node with the ability to claim the reservation
|
||||
payments that were made to acquire the vouchers.
|
||||
|
||||
In this way, nodes are unable to correlate between payments through LN and
|
||||
the spending of their vouchers, allowing routers to be paid, and thus
|
||||
incentive to increase routing capacity through the ability to then pay for
|
||||
the infrastructure running the network.
|
||||
|
||||
Indranet will use a completely arbitrary, client side onion construction
|
||||
scheme that will be designed to be configurable and programmable such that
|
||||
the uniform three hop pattern can be extended to include parallel multipath and
|
||||
dancing paths and make tradeoffs for latency, reliability and obfuscation
|
||||
for other purposes. In addition, it forms a universal routing layer that
|
||||
enables users to get around the currently complex and sometimes impossible
|
||||
restrictions on inbound traffic caused by IPv4 and Network Address Translation.
|
||||
8
cmd/bumper/log.go
Normal file
8
cmd/bumper/log.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/cybriq/proc"
|
||||
log2 "github.com/cybriq/proc/pkg/log"
|
||||
)
|
||||
|
||||
var log = log2.GetLogger(proc.PathBase)
|
||||
245
cmd/bumper/main.go
Normal file
245
cmd/bumper/main.go
Normal file
@@ -0,0 +1,245 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
log2 "github.com/cybriq/proc/pkg/log"
|
||||
"gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/storer"
|
||||
)
|
||||
|
||||
var (
|
||||
URL string
|
||||
GitRef string
|
||||
ParentGitCommit string
|
||||
BuildTime string
|
||||
SemVer string
|
||||
Major, Minor, Patch int
|
||||
PathBase string
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Fprintln(
|
||||
os.Stderr,
|
||||
"arguments required in order to bump and push this repo",
|
||||
)
|
||||
os.Exit(1)
|
||||
}
|
||||
var minor, major bool
|
||||
if os.Args[1] == "minor" {
|
||||
minor = true
|
||||
os.Args = append(os.Args[0:1], os.Args[2:]...)
|
||||
}
|
||||
if os.Args[1] == "major" {
|
||||
major = true
|
||||
os.Args = append(os.Args[0:1], os.Args[2:]...)
|
||||
}
|
||||
log2.App = "bumper"
|
||||
BuildTime = time.Now().Format(time.RFC3339)
|
||||
var cwd string
|
||||
var e error
|
||||
if cwd, e = os.Getwd(); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
var repo *git.Repository
|
||||
if repo, e = git.PlainOpen(cwd); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
var rr []*git.Remote
|
||||
if rr, e = repo.Remotes(); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
for i := range rr {
|
||||
rs := rr[i].String()
|
||||
if strings.HasPrefix(rs, "origin") {
|
||||
rss := strings.Split(rs, "git@")
|
||||
if len(rss) > 1 {
|
||||
rsss := strings.Split(rss[1], ".git")
|
||||
URL = strings.ReplaceAll(rsss[0], ":", "/")
|
||||
break
|
||||
}
|
||||
rss = strings.Split(rs, "https://")
|
||||
if len(rss) > 1 {
|
||||
rsss := strings.Split(rss[1], ".git")
|
||||
URL = rsss[0]
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
var tr *git.Worktree
|
||||
if tr, e = repo.Worktree(); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
}
|
||||
var rh *plumbing.Reference
|
||||
if rh, e = repo.Head(); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
rhs := rh.Strings()
|
||||
GitRef = rhs[0]
|
||||
ParentGitCommit = rhs[1]
|
||||
var rt storer.ReferenceIter
|
||||
if rt, e = repo.Tags(); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
var maxVersion int
|
||||
if e = rt.ForEach(
|
||||
func(pr *plumbing.Reference) (e error) {
|
||||
s := strings.Split(pr.String(), "/")
|
||||
prs := s[2]
|
||||
if strings.HasPrefix(prs, "v") {
|
||||
var va [3]int
|
||||
_, _ = fmt.Sscanf(
|
||||
prs,
|
||||
"v%d.%d.%d",
|
||||
&va[0],
|
||||
&va[1],
|
||||
&va[2],
|
||||
)
|
||||
vn := va[0]*1000000 + va[1]*1000 + va[2]
|
||||
if maxVersion < vn {
|
||||
maxVersion = vn
|
||||
Major = va[0]
|
||||
Minor = va[1]
|
||||
Patch = va[2]
|
||||
}
|
||||
}
|
||||
return
|
||||
},
|
||||
); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
return
|
||||
}
|
||||
// Bump to next patch version every time
|
||||
Patch++
|
||||
if minor {
|
||||
Minor++
|
||||
Patch = 0
|
||||
}
|
||||
if major {
|
||||
Major++
|
||||
Minor = 0
|
||||
Patch = 0
|
||||
}
|
||||
// Update SemVer
|
||||
SemVer = fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
|
||||
PathBase = tr.Filesystem.Root() + "/"
|
||||
versionFile := `package proc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
// URL is the git URL for the repository.
|
||||
URL = "%s"
|
||||
// GitRef is the gitref, as in refs/heads/branchname.
|
||||
GitRef = "%s"
|
||||
// ParentGitCommit is the commit hash of the parent HEAD.
|
||||
ParentGitCommit = "%s"
|
||||
// BuildTime stores the time when the current binary was built.
|
||||
BuildTime = "%s"
|
||||
// SemVer lists the (latest) git tag on the build.
|
||||
SemVer = "%s"
|
||||
// PathBase is the path base returned from runtime caller.
|
||||
PathBase = "%s"
|
||||
// Major is the major number from the tag.
|
||||
Major = %d
|
||||
// Minor is the minor number from the tag.
|
||||
Minor = %d
|
||||
// Patch is the patch version number from the tag.
|
||||
Patch = %d
|
||||
)
|
||||
|
||||
// Version returns a pretty printed version information string.
|
||||
func Version() string {
|
||||
return fmt.Sprint(
|
||||
"\nRepository Information\n",
|
||||
"\tGit repository: "+URL+"\n",
|
||||
"\tBranch: "+GitRef+"\n",
|
||||
"\tPacethGitCommit: "+ParentGitCommit+"\n",
|
||||
"\tBuilt: "+BuildTime+"\n",
|
||||
"\tSemVer: "+SemVer+"\n",
|
||||
)
|
||||
}
|
||||
`
|
||||
versionFileOut := fmt.Sprintf(
|
||||
versionFile,
|
||||
URL,
|
||||
GitRef,
|
||||
ParentGitCommit,
|
||||
BuildTime,
|
||||
SemVer,
|
||||
PathBase,
|
||||
Major,
|
||||
Minor,
|
||||
Patch,
|
||||
)
|
||||
path := filepath.Join(PathBase, "version.go")
|
||||
if e = ioutil.WriteFile(path, []byte(versionFileOut),
|
||||
0666); log.E.Chk(e) {
|
||||
fmt.Println(e)
|
||||
}
|
||||
log.I.Ln(
|
||||
"\nRepository Information\n",
|
||||
"\tGit repository: "+URL+"\n",
|
||||
"\tBranch: "+GitRef+"\n",
|
||||
"\tParentGitCommit: "+ParentGitCommit+"\n",
|
||||
"\tBuilt: "+BuildTime+"\n",
|
||||
"\tSemVer: "+SemVer+"\n",
|
||||
"\tMajor:", Major, "\n",
|
||||
"\tMinor:", Minor, "\n",
|
||||
"\tPatch:", Patch, "\n",
|
||||
)
|
||||
e = runCmd("git", "add", ".")
|
||||
if log.E.Chk(e) {
|
||||
panic(e)
|
||||
}
|
||||
commitString := strings.Join(os.Args[1:], " ")
|
||||
|
||||
commitString = strings.ReplaceAll(commitString, " -- ", "\n\n")
|
||||
|
||||
e = runCmd("git", "commit", "-m"+commitString)
|
||||
if log.E.Chk(e) {
|
||||
panic(e)
|
||||
}
|
||||
e = runCmd("git", "tag", SemVer)
|
||||
if log.E.Chk(e) {
|
||||
panic(e)
|
||||
}
|
||||
gr := strings.Split(GitRef, "/")
|
||||
branch := gr[2]
|
||||
e = runCmd("git", "push", "origin", branch)
|
||||
if log.E.Chk(e) {
|
||||
panic(e)
|
||||
}
|
||||
e = runCmd("git", "push", "origin", SemVer)
|
||||
if log.E.Chk(e) {
|
||||
panic(e)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func runCmd(cmd ...string) (err error) {
|
||||
|
||||
c := exec.Command(cmd[0], cmd[1:]...)
|
||||
var output []byte
|
||||
output, err = c.CombinedOutput()
|
||||
if err == nil && string(output) != "" {
|
||||
fmt.Print(string(output))
|
||||
}
|
||||
return
|
||||
}
|
||||
0
pkg/.gitkeep
Normal file
0
pkg/.gitkeep
Normal file
38
version.go
Normal file
38
version.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package proc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
// URL is the git URL for the repository.
|
||||
URL = "github.com/Indra-Labs/indranet"
|
||||
// GitRef is the gitref, as in refs/heads/branchname.
|
||||
GitRef = "refs/heads/main"
|
||||
// ParentGitCommit is the commit hash of the parent HEAD.
|
||||
ParentGitCommit = "c23eb206cc0da7db1c275b641011594d8570407e"
|
||||
// BuildTime stores the time when the current binary was built.
|
||||
BuildTime = "2022-09-07T08:33:04+02:00"
|
||||
// SemVer lists the (latest) git tag on the build.
|
||||
SemVer = "v0.0.1"
|
||||
// PathBase is the path base returned from runtime caller.
|
||||
PathBase = "/home/loki/src/github.com/Indra-Labs/indranet/"
|
||||
// Major is the major number from the tag.
|
||||
Major = 0
|
||||
// Minor is the minor number from the tag.
|
||||
Minor = 0
|
||||
// Patch is the patch version number from the tag.
|
||||
Patch = 1
|
||||
)
|
||||
|
||||
// Version returns a pretty printed version information string.
|
||||
func Version() string {
|
||||
return fmt.Sprint(
|
||||
"\nRepository Information\n",
|
||||
"\tGit repository: "+URL+"\n",
|
||||
"\tBranch: "+GitRef+"\n",
|
||||
"\tPacethGitCommit: "+ParentGitCommit+"\n",
|
||||
"\tBuilt: "+BuildTime+"\n",
|
||||
"\tSemVer: "+SemVer+"\n",
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user