Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ jobs:
build-libs-android:

name: Build libs (Android)
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: 🐼 Setup go1.22+
uses: actions/setup-go@v5
Expand All @@ -24,6 +27,12 @@ jobs:
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
./contrib/mobile/build -a

- name: Get version
id: get_version
run: |
PKGVERSION=$(sh -c './contrib/semver/version.sh --bare')
echo "PKGVERSION=$PKGVERSION" >> $GITHUB_ENV

- name: Upload .aar files
uses: actions/upload-artifact@v4
Expand All @@ -35,4 +44,15 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: jar-files
path: '**/*.jar'
path: '**/*.jar'

- name: Publish aar library to Maven repo
uses: RiV-chain/copy-local-file-maven-action@main
with:
artifact_repo: RiV-chain/artifact
artifact_path: mesh.aar
artifact_source_path: mesh-sources.jar
gh_pat: ${{ secrets.MAVEN_PAT }}
artifact_id: mesh
group_id: org.rivchain
version: ${{ env.PKGVERSION }}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# RiV-mesh first self arranging mesh network with link aggregation.

## Why fork?
RiV-mesh is fork of Yggdrasil which is great project. Yggdrasil uses a custom admin TCP protocol istead of REST. Second reason: Yggdrasil uses deprecated 200::/7 IPv6 address pool which can be assigned for some network in future, unlike this fc00::/7 is safe and has been taken for RiV-mesh. So far RiV-mesh can be easy switched to Yggdrasil network address space with NetworkDomain.Prefix 2 in mesh.conf configuration file.

## Introduction

RiV-mesh is an implementation of a fully end-to-end encrypted IPv6
Expand Down
7 changes: 3 additions & 4 deletions contrib/mobile/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ type Mesh struct {
}

// StartAutoconfigure starts a node with a randomly generated config
func (m *Mesh) StartAutoconfigure(osVersion int) error {
return m.StartJSON([]byte("{}"), osVersion)
func (m *Mesh) StartAutoconfigure() error {
return m.StartJSON([]byte("{}"))
}

// StartJSON starts a node with the given JSON config. You can get JSON config
// (rather than HJSON) by using the GenerateConfigJSON() function
func (m *Mesh) StartJSON(configjson []byte, osVersion int) error {
func (m *Mesh) StartJSON(configjson []byte) error {
logger := log.New(m.log, "", 0)
logger.EnableLevel("error")
logger.EnableLevel("warn")
Expand Down Expand Up @@ -80,7 +80,6 @@ func (m *Mesh) StartJSON(configjson []byte, osVersion int) error {
if err != nil {
panic(err)
}
m.core.OsVersion = uint(osVersion)
}

// Setup the multicast module.
Expand Down
2 changes: 1 addition & 1 deletion contrib/mobile/mobile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "testing"

func TestStartMesh(t *testing.T) {
mesh := &Mesh{}
if err := mesh.StartAutoconfigure(14); err != nil {
if err := mesh.StartAutoconfigure(); err != nil {
t.Fatalf("Failed to start RiV-mesh: %s", err)
}
t.Log("Address:", mesh.GetAddressString())
Expand Down
4 changes: 2 additions & 2 deletions contrib/msi/msversion.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Get the last tag
TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null)
TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null)

# Did getting the tag succeed?
if [ $? != 0 ] || [ -z "$TAG" ]; then
Expand All @@ -17,6 +17,6 @@ if [ $? != 0 ] || [ -z "$BRANCH" ]; then
BRANCH="master"
fi

STAG=$(echo $TAG | sed 's/v//' | sed 's/[^0123456789.].//')
STAG=$(echo $TAG | sed 's/^v//' | sed 's/[^0123456789.].//')

printf '%s' "$STAG"
4 changes: 2 additions & 2 deletions contrib/semver/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
case "$*" in
*--bare*)
# Remove the "v" prefix
git describe --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" --abbrev=7 | cut -c 2-
git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | sed 's/^v//'
;;
*)
git describe --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" --abbrev=7
git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"
;;
esac
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require gerace.dev/zipfs v0.2.0
require (
github.com/slonm/tableprinter v0.0.0-20230107100804-643098716018
github.com/vorot93/golang-signals v0.0.0-20170221070717-d9e83421ce45
github.com/wlynxg/anet v0.0.3
github.com/wlynxg/anet v0.0.4
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvV
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vorot93/golang-signals v0.0.0-20170221070717-d9e83421ce45 h1:hB/hkjwf3BQnZE6Wk3SBwMJz0NqnGdwXoNzHVSYb0N0=
github.com/vorot93/golang-signals v0.0.0-20170221070717-d9e83421ce45/go.mod h1:dfjQkJsG5auteUbnfLIcU72Y/z8tj7DuW9fik8f2Zn0=
github.com/wlynxg/anet v0.0.3 h1:PvR53psxFXstc12jelG6f1Lv4MWqE0tI76/hHGjh9rg=
github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/wlynxg/anet v0.0.4 h1:0de1OFQxnNqAu+x2FAKKCVIrnfGKQbs7FQz++tB0+Uw=
github.com/wlynxg/anet v0.0.4/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
Expand Down
1 change: 0 additions & 1 deletion src/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ type Core struct {
_allowedPublicKeys map[[32]byte]struct{} // configurable after startup
networkdomain NetworkDomain // immutable after startup
}
OsVersion uint
}

func New(secret ed25519.PrivateKey, logger Logger, opts ...SetupOption) (*Core, error) {
Expand Down
18 changes: 10 additions & 8 deletions src/multicast/multicast.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"net"
"net/url"
"strconv"
"time"

"github.com/wlynxg/anet"
Expand Down Expand Up @@ -66,7 +65,6 @@ func New(core *core.Core, log *log.Logger, opts ...SetupOption) (*Multicast, err
_listeners: make(map[int]*listenerInfo),
_interfaces: make(map[int]*interfaceInfo),
}
m.SetOsVersion()
m.config._interfaces = map[MulticastInterface]struct{}{}
m.config._groupAddr = GroupAddress("[ff02::114]:9001")
for _, opt := range opts {
Expand Down Expand Up @@ -180,8 +178,7 @@ func (m *Multicast) _getAllowedInterfaces() map[int]*interfaceInfo {
// Ask the system for network interfaces
allifaces, err := anet.Interfaces()
if err != nil {
// Don't panic, since this may be from e.g. too many open files (from too much connection spam)
// TODO? log something
m.log.Debugf("Failed to get interfaces: %s", err)
return nil
}
// Work out which interfaces to announce on
Expand Down Expand Up @@ -408,11 +405,16 @@ func (m *Multicast) listen() {
phony.Block(m, func() {
interfaces = m._interfaces
})
zone, err := strconv.Atoi(from.Zone)
if err != nil {
continue
var inter interfaceInfo
var ok = false
for _, info := range interfaces {
if info.iface.Name == from.Zone {
inter = *info
ok = true
}
}
if info, ok := interfaces[zone]; ok && info.listen {
info := inter
if ok && info.listen {
addr.Zone = ""
pin := fmt.Sprintf("/?key=%s&priority=%d", hex.EncodeToString(key), info.priority)
u, err := url.Parse("tls://" + addr.String() + pin)
Expand Down
5 changes: 0 additions & 5 deletions src/multicast/multicast_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ import (
"os"
"syscall"

"github.com/wlynxg/anet"
"golang.org/x/sys/unix"
)

func (m *Multicast) SetOsVersion() {
anet.SetAndroidVersion(m.core.OsVersion)
}

func (m *Multicast) _multicastStarted() {

}
Expand Down
4 changes: 0 additions & 4 deletions src/multicast/multicast_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import (
"golang.org/x/sys/unix"
)

func (m *Multicast) SetOsVersion() {

}

func (m *Multicast) _multicastStarted() {

}
Expand Down
4 changes: 0 additions & 4 deletions src/multicast/multicast_darwin_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import (
"golang.org/x/sys/unix"
)

func (m *Multicast) SetOsVersion() {

}

func (m *Multicast) _multicastStarted() {
if !m._isOpen {
return
Expand Down
4 changes: 0 additions & 4 deletions src/multicast/multicast_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ package multicast

import "syscall"

func (m *Multicast) SetOsVersion() {

}

func (m *Multicast) _multicastStarted() {

}
Expand Down
4 changes: 0 additions & 4 deletions src/multicast/multicast_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import (
"golang.org/x/sys/unix"
)

func (m *Multicast) SetOsVersion() {

}

func (m *Multicast) _multicastStarted() {

}
Expand Down
4 changes: 0 additions & 4 deletions src/multicast/multicast_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import (
"golang.org/x/sys/windows"
)

func (m *Multicast) SetOsVersion() {

}

func (m *Multicast) _multicastStarted() {

}
Expand Down
Loading