changed Yggdrasil to RiV-mesh

added webview GUI
This commit is contained in:
vadym 2021-09-13 12:10:02 +03:00
parent 3613614b41
commit b5ee2aa023
75 changed files with 1066 additions and 471 deletions

View file

@ -37,9 +37,9 @@ jobs:
echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV
echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' >> $BASH_ENV
case "$CINAME" in \
"yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \
"yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \
*) (echo 'export CICONFLICTS="yggdrasil yggdrasil-develop"' >> $BASH_ENV) ;; \
"mesh") (echo 'export CICONFLICTS=mesh-develop' >> $BASH_ENV) ;; \
"mesh-develop") (echo 'export CICONFLICTS=mesh' >> $BASH_ENV) ;; \
*) (echo 'export CICONFLICTS="mesh mesh-develop"' >> $BASH_ENV) ;; \
esac
git config --global user.email "$(git log --format='%ae' HEAD -1)";
git config --global user.name "$(git log --format='%an' HEAD -1)";
@ -55,43 +55,43 @@ jobs:
name: Test debug builds
command: |
./build -d
test -f yggdrasil && test -f yggdrasilctl
test -f mesh && test -f meshctl
- run:
name: Build for Linux (including Debian packages)
command: |
rm -f {yggdrasil,yggdrasilctl}
PKGARCH=amd64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-amd64;
PKGARCH=i386 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-i386;
PKGARCH=mipsel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-mipsel && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-mipsel;
PKGARCH=mips sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-mips && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-mips;
PKGARCH=armhf sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-armhf && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-armhf;
PKGARCH=armel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-armel && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-armel;
PKGARCH=arm64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-linux-arm64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-linux-arm64;
rm -f {mesh,meshctl}
PKGARCH=amd64 sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-amd64 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-amd64;
PKGARCH=i386 sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-i386 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-i386;
PKGARCH=mipsel sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-mipsel && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-mipsel;
PKGARCH=mips sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-mips && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-mips;
PKGARCH=armhf sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-armhf && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-armhf;
PKGARCH=armel sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-armel && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-armel;
PKGARCH=arm64 sh contrib/deb/generate.sh && mv mesh /tmp/upload/$CINAME-$CIVERSION-linux-arm64 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-linux-arm64;
mv *.deb /tmp/upload/
- run:
name: Build for Linux (RPM packages)
command: |
git clone https://github.com/yggdrasil-network/yggdrasil-package-rpm ~/rpmbuild/SPECS
cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIBRANCH-$CIVERSIONRPM/" project
sed -i "s/yggdrasil-go/yggdrasil-go-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/yggdrasil.spec
sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/yggdrasil.spec
sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/yggdrasil.spec
cat ~/rpmbuild/SPECS/yggdrasil.spec
GOARCH=amd64 rpmbuild -v --nodeps --target=x86_64 -ba ~/rpmbuild/SPECS/yggdrasil.spec
#GOARCH=386 rpmbuild -v --nodeps --target=i386 -bb ~/rpmbuild/SPECS/yggdrasil.spec
git clone https://github.com/RiV-chain/mesh-package-rpm ~/rpmbuild/SPECS
cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/RiV-mesh-$CIBRANCH-$CIVERSIONRPM/" project
sed -i "s/RiV-mesh/RiV-mesh-$CIBRANCH/" ~/rpmbuild/SPECS/mesh.spec
sed -i "s/^PKGNAME=mesh/PKGNAME=mesh-$CIBRANCH/" ~/rpmbuild/SPECS/mesh.spec
sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/mesh.spec
sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/mesh.spec
sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/mesh.spec
cat ~/rpmbuild/SPECS/mesh.spec
GOARCH=amd64 rpmbuild -v --nodeps --target=x86_64 -ba ~/rpmbuild/SPECS/mesh.spec
#GOARCH=386 rpmbuild -v --nodeps --target=i386 -bb ~/rpmbuild/SPECS/mesh.spec
find ~/rpmbuild/RPMS/ -name '*.rpm' -exec mv {} /tmp/upload \;
find ~/rpmbuild/SRPMS/ -name '*.rpm' -exec mv {} /tmp/upload \;
- run:
name: Build for EdgeRouter and VyOS
command: |
rm -f {yggdrasil,yggdrasilctl}
git clone https://github.com/neilalexander/vyatta-yggdrasil /tmp/vyatta-yggdrasil;
cd /tmp/vyatta-yggdrasil;
rm -f {mesh,meshctl}
git clone https://github.com/neilalexander/vyatta-mesh /tmp/vyatta-mesh;
cd /tmp/vyatta-mesh;
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-edgerouter-x $CIRCLE_BRANCH;
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-edgerouter-lite $CIRCLE_BRANCH;
BUILDDIR_YGG=$CIRCLE_WORKING_DIRECTORY ./build-vyos-i386 $CIRCLE_BRANCH
@ -107,7 +107,7 @@ jobs:
macos:
xcode: "10.0.0"
working_directory: ~/go/src/github.com/yggdrasil-network/yggdrasil-go
working_directory: ~/go/src/github.com/RiV-chain/RiV-mesh
steps:
- checkout
@ -140,8 +140,8 @@ jobs:
name: Build for macOS
command: |
GO111MODULE=on GOOS=darwin GOARCH=amd64 ./build
cp yggdrasil /tmp/upload/$CINAME-$CIVERSION-darwin-amd64
cp yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-darwin-amd64;
cp mesh /tmp/upload/$CINAME-$CIVERSION-darwin-amd64
cp meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-darwin-amd64;
- run:
name: Build for macOS (.pkg format)
@ -152,8 +152,8 @@ jobs:
#- run:
# name: Build framework for iOS (.framework format)
# command: |
# sudo GO111MODULE=off go get -v github.com/yggdrasil-network/yggdrasil-go/cmd/...
# sudo GO111MODULE=off go get -v github.com/yggdrasil-network/yggdrasil-go/src/...
# sudo GO111MODULE=off go get -v github.com/RiV-chain/RiV-mesh/cmd/...
# sudo GO111MODULE=off go get -v github.com/RiV-chain/RiV-mesh/src/...
# GO111MODULE=off ./build -i
# mv *.framework /tmp/upload
@ -181,23 +181,23 @@ jobs:
- run:
name: Build for OpenBSD
command: |
rm -f {yggdrasil,yggdrasilctl}
GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-openbsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-openbsd-amd64;
GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-openbsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-openbsd-i386;
rm -f {mesh,meshctl}
GOOS=openbsd GOARCH=amd64 ./build && mv mesh /tmp/upload/$CINAME-$CIVERSION-openbsd-amd64 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-openbsd-amd64;
GOOS=openbsd GOARCH=386 ./build && mv mesh /tmp/upload/$CINAME-$CIVERSION-openbsd-i386 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-openbsd-i386;
- run:
name: Build for FreeBSD
command: |
rm -f {yggdrasil,yggdrasilctl}
GOOS=freebsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-amd64 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-amd64;
GOOS=freebsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/$CINAME-$CIVERSION-freebsd-i386 && mv yggdrasilctl /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-freebsd-i386;
rm -f {mesh,meshctl}
GOOS=freebsd GOARCH=amd64 ./build && mv mesh /tmp/upload/$CINAME-$CIVERSION-freebsd-amd64 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-freebsd-amd64;
GOOS=freebsd GOARCH=386 ./build && mv mesh /tmp/upload/$CINAME-$CIVERSION-freebsd-i386 && mv meshctl /tmp/upload/$CINAME-$CIVERSION-meshctl-freebsd-i386;
- run:
name: Build for Windows
command: |
rm -f {yggdrasil,yggdrasilctl}
GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-amd64.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-amd64.exe;
GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/$CINAME-$CIVERSION-windows-i386.exe && mv yggdrasilctl.exe /tmp/upload/$CINAME-$CIVERSION-yggdrasilctl-windows-i386.exe;
rm -f {mesh,meshctl}
GOOS=windows GOARCH=amd64 ./build && mv mesh.exe /tmp/upload/$CINAME-$CIVERSION-windows-amd64.exe && mv meshctl.exe /tmp/upload/$CINAME-$CIVERSION-meshctl-windows-amd64.exe;
GOOS=windows GOARCH=386 ./build && mv mesh.exe /tmp/upload/$CINAME-$CIVERSION-windows-i386.exe && mv meshctl.exe /tmp/upload/$CINAME-$CIVERSION-meshctl-windows-i386.exe;
- persist_to_workspace:
root: /tmp

View file

@ -27,9 +27,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.4.0] - 2021-07-04
### Added
- New routing scheme, which is backwards incompatible with previous versions of Yggdrasil
- New routing scheme, which is backwards incompatible with previous versions of Mesh
- The wire protocol version number, exchanged as part of the peer setup handshake, has been increased to 0.4
- Nodes running this new version **will not** be able to peer with earlier versions of Yggdrasil
- Nodes running this new version **will not** be able to peer with earlier versions of Mesh
- Please note that **the network may be temporarily unstable** while infrastructure is being upgraded to the new release
- TLS connections now use public key pinning
- If no public key was already pinned, then the public key received as part of the TLS handshake is pinned to the connection
@ -38,7 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- IP addresses are now derived from ed25519 public (signing) keys
- Previously, addresses were derived from a hash of X25519 (Diffie-Hellman) keys
- Importantly, this means that **all internal IPv6 addresses will change with this release** — this will affect anyone running public services or relying on Yggdrasil for remote access
- Importantly, this means that **all internal IPv6 addresses will change with this release** — this will affect anyone running public services or relying on Mesh for remote access
- It is now recommended to peer over TLS
- Link-local peers from multicast peer discovery will now connect over TLS, with the key from the multicast beacon pinned to the connection
- `socks://` peers now expect the destination endpoint to be a `tls://` listener, instead of a `tcp://` listener
@ -56,7 +56,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The greedy routing scheme, used to forward all traffic in previous releases, is now only used for protocol traffic (i.e. DHT setup and source route discovery)
- The routing logic now lives in a [standalone library](https://github.com/Arceliar/ironwood). You are encouraged **not** to use it, as it's still considered pre-alpha, but it's available for those who want to experiment with the new routing algorithm in other contexts
- Session MTUs may be slightly lower now, in order to accommodate large packet headers if required
- Many of the admin functions available over `yggdrasilctl` have been changed or removed as part of rewrites to the code
- Many of the admin functions available over `meshctl` have been changed or removed as part of rewrites to the code
- Several remote `debug` functions have been added temporarily, to allow for crawling and census gathering during the transition to the new version, but we intend to remove this at some point in the (possibly distant) future
- The list of available functions will likely be expanded in future releases
- The configuration file format has been updated in response to the changed/removed features
@ -64,7 +64,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Removed
- Tunnel routing (a.k.a. crypto-key routing or "CKR") has been removed
- It was far too easy to accidentally break routing altogether by capturing the route to peers with the TUN adapter
- We recommend tunnelling an existing standard over Yggdrasil instead (e.g. `ip6gre`, `ip6gretap` or other similar encapsulations, using Yggdrasil IPv6 addresses as the tunnel endpoints)
- We recommend tunnelling an existing standard over Mesh instead (e.g. `ip6gre`, `ip6gretap` or other similar encapsulations, using Mesh IPv6 addresses as the tunnel endpoints)
- All `TunnelRouting` configuration options will no longer take effect
- Session firewall has been removed
- This was never a true firewall — it didn't behave like a stateful IP firewall, often allowed return traffic unexpectedly and was simply a way to prevent a node from being flooded with unwanted sessions, so the name could be misleading and usually lead to a false sense of security
@ -79,7 +79,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.3.16] - 2021-03-18
### Added
- New simulation code under `cmd/yggdrasilsim` (work-in-progress)
- New simulation code under `cmd/meshsim` (work-in-progress)
### Changed
- Multi-threading in the switch
@ -109,7 +109,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- By encryption public key: `tcp://host:port?curve25519=key`
- By both: `tcp://host:port?ed25519=key&curve25519=key`
- By multiple, in case of DNS round-robin or similar: `tcp://host:port?curve25519=key&curve25519=key&ed25519=key&ed25519=key`
- Some checks to prevent Yggdrasil-over-Yggdrasil peerings have been added
- Some checks to prevent Mesh-over-Mesh peerings have been added
- Added support for SOCKS proxy authentication, e.g. `socks://user@password:host/...`
### Fixed
@ -121,7 +121,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- `DisconnectPeer` and `RemovePeer` have been separated and implemented properly now
- Less nodes are stored in the DHT now, reducing ambient network traffic and possible instability
- Default config file for FreeBSD is now at `/usr/local/etc/yggdrasil.conf` instead of `/etc/yggdrasil.conf`
- Default config file for FreeBSD is now at `/usr/local/etc/mesh.conf` instead of `/etc/mesh.conf`
## [0.3.14] - 2020-03-28
### Fixed
@ -136,14 +136,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Windows `.msi` installer files are now supported (bundling the Wireguard TUN driver)
- NodeInfo code is now actorised, should be more reliable
- The DHT now tries to store the two closest nodes in either direction instead of one, such that if a node goes offline, the replacement is already known
- The Yggdrasil API now supports dialing a remote node using the public key instead of the Node ID
- The Mesh API now supports dialing a remote node using the public key instead of the Node ID
### Changed
- The `-loglevel` command line parameter is now cumulative and automatically includes all levels below the one specified
- DHT search code has been significantly simplified and processes rumoured nodes in parallel, speeding up search time
- DHT search results are now sorted
- The systemd service now handles configuration generation in a different unit
- The Yggdrasil API now returns public keys instead of node IDs when querying for local and remote addresses
- The Mesh API now returns public keys instead of node IDs when querying for local and remote addresses
### Fixed
- The multicast code no longer panics when shutting down the node
@ -159,7 +159,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- New API functions `SetMaximumSessionMTU` and `GetMaximumSessionMTU`
- New command line parameters `-address` and `-subnet` for getting the address/subnet from the config file, for use with `-useconffile` or `-useconf`
- A warning is now produced in the Yggdrasil output at startup when the MTU in the config is invalid or has been adjusted for some reason
- A warning is now produced in the Mesh output at startup when the MTU in the config is invalid or has been adjusted for some reason
### Changed
- On Linux, outgoing `InterfacePeers` connections now use `SO_BINDTODEVICE` to prefer an outgoing interface
@ -175,14 +175,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.3.11] - 2019-10-25
### Added
- Support for TLS listeners and peers has been added, allowing the use of `tls://host:port` in `Peers`, `InterfacePeers` and `Listen` configuration settings - this allows hiding Yggdrasil peerings inside regular TLS connections
- Support for TLS listeners and peers has been added, allowing the use of `tls://host:port` in `Peers`, `InterfacePeers` and `Listen` configuration settings - this allows hiding Mesh peerings inside regular TLS connections
### Changed
- Go 1.13 or later is now required for building Yggdrasil
- Go 1.13 or later is now required for building Mesh
- Some exported API functions have been updated to work with standard Go interfaces:
- `net.Conn` instead of `yggdrasil.Conn`
- `net.Dialer` (the interface it would satisfy if it wasn't a concrete type) instead of `yggdrasil.Dialer`
- `net.Listener` instead of `yggdrasil.Listener`
- `net.Conn` instead of `mesh.Conn`
- `net.Dialer` (the interface it would satisfy if it wasn't a concrete type) instead of `mesh.Dialer`
- `net.Listener` instead of `mesh.Listener`
- Session metadata is now updated correctly when a search completes for a node to which we already have an open session
- Multicast module reloading behaviour has been improved
@ -192,20 +192,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.3.10] - 2019-10-10
### Added
- The core library now includes several unit tests for peering and `yggdrasil.Conn` connections
- The core library now includes several unit tests for peering and `mesh.Conn` connections
### Changed
- On recent Linux kernels, Yggdrasil will now set the `tcp_congestion_control` algorithm used for its own TCP sockets to [BBR](https://github.com/google/bbr), which reduces latency under load
- The systemd service configuration in `contrib` (and, by extension, some of our packages) now attempts to load the `tun` module, in case TUN/TAP support is available but not loaded, and it restricts Yggdrasil to the `CAP_NET_ADMIN` capability for managing the TUN/TAP adapter, rather than letting it do whatever the (typically `root`) user can do
- On recent Linux kernels, Mesh will now set the `tcp_congestion_control` algorithm used for its own TCP sockets to [BBR](https://github.com/google/bbr), which reduces latency under load
- The systemd service configuration in `contrib` (and, by extension, some of our packages) now attempts to load the `tun` module, in case TUN/TAP support is available but not loaded, and it restricts Mesh to the `CAP_NET_ADMIN` capability for managing the TUN/TAP adapter, rather than letting it do whatever the (typically `root`) user can do
### Fixed
- The `yggdrasil.Conn.RemoteAddr()` function no longer blocks, fixing a deadlock when CKR is used while under heavy load
- The `mesh.Conn.RemoteAddr()` function no longer blocks, fixing a deadlock when CKR is used while under heavy load
## [0.3.9] - 2019-09-27
### Added
- Yggdrasil will now complain more verbosely when a peer URI is incorrectly formatted
- Mesh will now complain more verbosely when a peer URI is incorrectly formatted
- Soft-shutdown methods have been added, allowing a node to shut down gracefully when terminated
- New multicast interval logic which sends multicast beacons more often when Yggdrasil is first started to increase the chance of finding nearby nodes quickly after startup
- New multicast interval logic which sends multicast beacons more often when Mesh is first started to increase the chance of finding nearby nodes quickly after startup
### Changed
- The switch now buffers packets more eagerly in an attempt to give the best link a chance to send, which appears to reduce packet reordering when crossing aggregate sets of peerings
@ -223,7 +223,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- A race condition when dialing a remote node by both the node address and routed prefix simultaneously has been fixed
- A race condition between the router and the dial code resulting in a panic has been fixed
- A panic which could occur when the TUN/TAP interface disappears (e.g. during soft-shutdown) has been fixed
- A bug in the semantic versioning script which accompanies Yggdrasil for builds has been fixed
- A bug in the semantic versioning script which accompanies Mesh for builds has been fixed
- A panic which could occur when the TUN/TAP interface reads an undersized/corrupted packet has been fixed
### Removed
@ -231,7 +231,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.3.8] - 2019-08-21
### Changed
- Yggdrasil can now send multiple packets from the switch at once, which results in improved throughput with smaller packets or lower MTUs
- Mesh can now send multiple packets from the switch at once, which results in improved throughput with smaller packets or lower MTUs
- Performance has been slightly improved by not allocating cancellations where not necessary
- Crypto-key routing options have been renamed for clarity
- `IPv4Sources` is now named `IPv4LocalSubnets`
@ -243,10 +243,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- New nonce tracking should help to reduce the number of packets dropped as a result of multiple/aggregate paths or congestion control in the switch
### Fixed
- A deadlock was fixed in the session code which could result in Yggdrasil failing to pass traffic after some time
- A deadlock was fixed in the session code which could result in Mesh failing to pass traffic after some time
### Security
- Address verification was not strict enough, which could result in a malicious session sending traffic with unexpected or spoofed source or destination addresses which Yggdrasil could fail to reject
- Address verification was not strict enough, which could result in a malicious session sending traffic with unexpected or spoofed source or destination addresses which Mesh could fail to reject
- Versions `0.3.6` and `0.3.7` are vulnerable - users of these versions should upgrade as soon as possible
- Versions `0.3.5` and earlier are not affected
@ -259,7 +259,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- A number of significant performance regressions introduced in version 0.3.6 have been fixed, resulting in better performance
- Flow labels are now used to prioritise traffic flows again correctly
- In low-traffic scenarios where there are multiple peerings between a pair of nodes, Yggdrasil now prefers the most active peering instead of the least active, helping to reduce packet reordering
- In low-traffic scenarios where there are multiple peerings between a pair of nodes, Mesh now prefers the most active peering instead of the least active, helping to reduce packet reordering
- The `Listen` statement, when configured as a string rather than an array, will now be parsed correctly
- The admin socket now returns `coords` as a correct array of unsigned 64-bit integers, rather than the internal representation
- The admin socket now returns `box_pub_key` in string format again
@ -271,18 +271,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.3.6] - 2019-08-03
### Added
- Yggdrasil now has a public API with interfaces such as `yggdrasil.ConnDialer`, `yggdrasil.ConnListener` and `yggdrasil.Conn` for using Yggdrasil as a transport directly within applications
- Mesh now has a public API with interfaces such as `mesh.ConnDialer`, `mesh.ConnListener` and `mesh.Conn` for using Mesh as a transport directly within applications
- Session gatekeeper functions, part of the API, which can be used to control whether to allow or reject incoming or outgoing sessions dynamically (compared to the previous fixed whitelist/blacklist approach)
- Support for logging to files or syslog (where supported)
- Platform defaults now include the ability to set sane defaults for multicast interfaces
### Changed
- Following a massive refactoring exercise, Yggdrasil's codebase has now been broken out into modules
- Core node functionality in the `yggdrasil` package with a public API
- This allows Yggdrasil to be integrated directly into other applications and used as a transport
- IP-specific code has now been moved out of the core `yggdrasil` package, making Yggdrasil effectively protocol-agnostic
- Following a massive refactoring exercise, Mesh's codebase has now been broken out into modules
- Core node functionality in the `mesh` package with a public API
- This allows Mesh to be integrated directly into other applications and used as a transport
- IP-specific code has now been moved out of the core `mesh` package, making Mesh effectively protocol-agnostic
- Multicast peer discovery functionality is now in the `multicast` package
- Admin socket functionality is now in the `admin` package and uses the Yggdrasil public API
- Admin socket functionality is now in the `admin` package and uses the Mesh public API
- TUN/TAP, ICMPv6 and all IP-specific functionality is now in the `tuntap` package
- `PPROF` debug output is now sent to `stderr` instead of `stdout`
- Node IPv6 addresses on macOS are now configured as `secured`
@ -290,7 +290,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Multicast discovery is no longer disabled if the nominated interfaces aren't available on the system yet, e.g. during boot
- Multicast interfaces are now re-evaluated more frequently so that Yggdrasil doesn't need to be restarted to use interfaces that have become available since startup
- Multicast interfaces are now re-evaluated more frequently so that Mesh doesn't need to be restarted to use interfaces that have become available since startup
- Admin socket error cases are now handled better
- Various fixes in the TUN/TAP module, particularly surrounding Windows platform support
- Invalid keys will now cause the node to fail to start, rather than starting but silently not working as before
@ -313,9 +313,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- New multicast behaviour where each multicast interface is given its own link-local listener and does not depend on the `Listen` configuration
- Blocking detection in the switch to avoid parenting a blocked peer
- Support for adding and removing listeners and multicast interfaces when reloading configuration during runtime
- Yggdrasil will now attempt to clean up UNIX admin sockets on startup if left behind by a previous crash
- Mesh will now attempt to clean up UNIX admin sockets on startup if left behind by a previous crash
- Admin socket `getTunnelRouting` and `setTunnelRouting` calls for enabling and disabling crypto-key routing during runtime
- On macOS, Yggdrasil will now try to wake up AWDL on start-up when `awdl0` is a configured multicast interface, to keep it awake after system sleep, and to stop waking it when no longer needed
- On macOS, Mesh will now try to wake up AWDL on start-up when `awdl0` is a configured multicast interface, to keep it awake after system sleep, and to stop waking it when no longer needed
- Added `LinkLocalTCPPort` option for controlling the port number that link-local TCP listeners will listen on by default when setting up `MulticastInterfaces` (a node restart is currently required for changes to `LinkLocalTCPPort` to take effect - it cannot be updated by reloading config during runtime)
### Changed
@ -328,17 +328,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Admin socket `getTunTap` call now returns properly instead of claiming no interface is enabled in all cases
- Handling of `getRoutes` etc in `yggdrasilctl` is now working
- Handling of `getRoutes` etc in `meshctl` is now working
- Local interface names are no longer leaked in multicast packets
- Link-local TCP connections, particularly those initiated because of multicast beacons, are now always correctly scoped for the target interface
- Yggdrasil now correctly responds to multicast interfaces going up and down during runtime
- Mesh now correctly responds to multicast interfaces going up and down during runtime
## [0.3.3] - 2019-02-18
### Added
- Dynamic reconfiguration, which allows reloading the configuration file to make changes during runtime by sending a `SIGHUP` signal (note: this only works with `-useconffile` and not `-useconf` and currently reconfiguring TUN/TAP is not supported)
- Support for building Yggdrasil as an iOS or Android framework if the appropriate tools (e.g. `gomobile`/`gobind` + SDKs) are available
- Support for building Mesh as an iOS or Android framework if the appropriate tools (e.g. `gomobile`/`gobind` + SDKs) are available
- Connection contexts used for TCP connections which allow more exotic socket options to be set, e.g.
- Reusing the multicast socket to allow multiple running Yggdrasil instances without having to disable multicast
- Reusing the multicast socket to allow multiple running Mesh instances without having to disable multicast
- Allowing supported Macs to peer with other nearby Macs that aren't even on the same Wi-Fi network using AWDL
- Flexible logging support, which allows for logging at different levels of verbosity
@ -380,37 +380,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Adds flags `-c`, `-l` and `-t` to `build` script for specifying `GCFLAGS`, `LDFLAGS` or whether to keep symbol/DWARF tables
### Changed
- Default `AdminListen` in newly generated config is now `unix:///var/run/yggdrasil.sock`
- Default `AdminListen` in newly generated config is now `unix:///var/run/mesh.sock`
- Formatting of `getRoutes` in the admin socket has been improved
- Debian package now adds `yggdrasil` group to assist with `AF_UNIX` admin socket permissions
- Debian package now adds `mesh` group to assist with `AF_UNIX` admin socket permissions
- Crypto, address and other utility code refactored into separate Go packages
### Fixed
- Switch peer convergence is now much faster again (previously it was taking up to a minute once the peering was established)
- `yggdrasilctl` is now less prone to crashing when parameters are specified incorrectly
- `meshctl` is now less prone to crashing when parameters are specified incorrectly
- Panic fixed when `Peers` or `InterfacePeers` was commented out
## [0.3.0] - 2018-12-12
### Added
- Crypto-key routing support for tunnelling both IPv4 and IPv6 over Yggdrasil
- Crypto-key routing support for tunnelling both IPv4 and IPv6 over Mesh
- Add advanced `SwitchOptions` in configuration file for tuning the switch
- Add `dhtPing` to the admin socket to aid in crawling the network
- New macOS .pkgs built automatically by CircleCI
- Add Dockerfile to repository for Docker support
- Add `-json` command line flag for generating and normalising configuration in plain JSON instead of HJSON
- Build name and version numbers are now imprinted onto the build, accessible through `yggdrasil -version` and `yggdrasilctl getSelf`
- Build name and version numbers are now imprinted onto the build, accessible through `mesh -version` and `meshctl getSelf`
- Add ability to disable admin socket by setting `AdminListen` to `"none"`
- `yggdrasilctl` now tries to look for the default configuration file to find `AdminListen` if `-endpoint` is not specified
- `yggdrasilctl` now returns more useful logging in the event of a fatal error
- `meshctl` now tries to look for the default configuration file to find `AdminListen` if `-endpoint` is not specified
- `meshctl` now returns more useful logging in the event of a fatal error
### Changed
- Switched to Chord DHT (instead of Kademlia, although still compatible at the protocol level)
- The `AdminListen` option and `yggdrasilctl` now default to `unix:///var/run/yggdrasil.sock` on BSDs, macOS and Linux
- The `AdminListen` option and `meshctl` now default to `unix:///var/run/mesh.sock` on BSDs, macOS and Linux
- Cleaned up some of the parameter naming in the admin socket
- Latency-based parent selection for the switch instead of uptime-based (should help to avoid high latency links somewhat)
- Real peering endpoints now shown in the admin socket `getPeers` call to help identify peerings
- Reuse the multicast port on supported platforms so that multiple Yggdrasil processes can run
- `yggdrasilctl` now has more useful help text (with `-help` or when no arguments passed)
- Reuse the multicast port on supported platforms so that multiple Mesh processes can run
- `meshctl` now has more useful help text (with `-help` or when no arguments passed)
### Fixed
- Memory leaks in the DHT fixed
@ -444,7 +444,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.2.5] - 2018-07-19
### Changed
- Make `yggdrasilctl` less case sensitive
- Make `meshctl` less case sensitive
- More verbose TCP disconnect messages
### Fixed
@ -475,7 +475,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.2.2] - 2018-06-21
### Added
- Add `yggdrasilconf` utility for testing with the `vyatta-yggdrasil` package.
- Add `meshconf` utility for testing with the `vyatta-mesh` package.
- Add a randomized retry delay after TCP disconnects, to prevent synchronization livelocks.
### Changed

189
LICENSE.rtf Normal file
View file

@ -0,0 +1,189 @@
{\rtf1\ansi\ansicpg1251\deff0\nouicompat\deflang1049{\fonttbl{\f0\fnil\fcharset0 Roboto;}}
{\colortbl ;\red0\green0\blue255;}
{\*\generator Riched20 10.0.19041}\viewkind4\uc1
\pard\sl240\slmult1\f0\fs16\lang9 This software is licensed under the LGPLv3, included below.\par
\par
As a special exception to the GNU Lesser General Public License version 3\par
("LGPL3"), the copyright holders of this Library give you permission to\par
convey to a third party a Combined Work that links statically or dynamically\par
to this Library without providing any Minimal Corresponding Source or\par
Minimal Application Code as set out in 4d or providing the installation\par
information set out in section 4e, provided that you comply with the other\par
provisions of LGPL3 and provided that you meet, for the Application the\par
terms and conditions of the license(s) which apply to the Application.\par
\par
Except as stated in this special exception, the provisions of LGPL3 will\par
continue to comply in full to this Library. If you modify this Library, you\par
may apply this exception to your version of this Library, but you are not\par
obliged to do so. If you do not wish to do so, delete this exception\par
statement from your version. This exception does not (and cannot) modify any\par
license terms which apply to the Application, with which you must still\par
comply.\par
\par
GNU LESSER GENERAL PUBLIC LICENSE\par
Version 3, 29 June 2007\par
\par
Copyright (C) 2007 Free Software Foundation, Inc. <{{\field{\*\fldinst{HYPERLINK "https://fsf.org/"}}{\fldrslt{https://fsf.org/\ul0\cf0}}}}\f0\fs16 >\par
Everyone is permitted to copy and distribute verbatim copies\par
of this license document, but changing it is not allowed.\par
\par
\par
This version of the GNU Lesser General Public License incorporates\par
the terms and conditions of version 3 of the GNU General Public\par
License, supplemented by the additional permissions listed below.\par
\par
0. Additional Definitions.\par
\par
As used herein, "this License" refers to version 3 of the GNU Lesser\par
General Public License, and the "GNU GPL" refers to version 3 of the GNU\par
General Public License.\par
\par
"The Library" refers to a covered work governed by this License,\par
other than an Application or a Combined Work as defined below.\par
\par
An "Application" is any work that makes use of an interface provided\par
by the Library, but which is not otherwise based on the Library.\par
Defining a subclass of a class defined by the Library is deemed a mode\par
of using an interface provided by the Library.\par
\par
A "Combined Work" is a work produced by combining or linking an\par
Application with the Library. The particular version of the Library\par
with which the Combined Work was made is also called the "Linked\par
Version".\par
\par
The "Minimal Corresponding Source" for a Combined Work means the\par
Corresponding Source for the Combined Work, excluding any source code\par
for portions of the Combined Work that, considered in isolation, are\par
based on the Application, and not on the Linked Version.\par
\par
The "Corresponding Application Code" for a Combined Work means the\par
object code and/or source code for the Application, including any data\par
and utility programs needed for reproducing the Combined Work from the\par
Application, but excluding the System Libraries of the Combined Work.\par
\par
1. Exception to Section 3 of the GNU GPL.\par
\par
You may convey a covered work under sections 3 and 4 of this License\par
without being bound by section 3 of the GNU GPL.\par
\par
2. Conveying Modified Versions.\par
\par
If you modify a copy of the Library, and, in your modifications, a\par
facility refers to a function or data to be supplied by an Application\par
that uses the facility (other than as an argument passed when the\par
facility is invoked), then you may convey a copy of the modified\par
version:\par
\par
a) under this License, provided that you make a good faith effort to\par
ensure that, in the event an Application does not supply the\par
function or data, the facility still operates, and performs\par
whatever part of its purpose remains meaningful, or\par
\par
b) under the GNU GPL, with none of the additional permissions of\par
this License applicable to that copy.\par
\par
3. Object Code Incorporating Material from Library Header Files.\par
\par
The object code form of an Application may incorporate material from\par
a header file that is part of the Library. You may convey such object\par
code under terms of your choice, provided that, if the incorporated\par
material is not limited to numerical parameters, data structure\par
layouts and accessors, or small macros, inline functions and templates\par
(ten or fewer lines in length), you do both of the following:\par
\par
a) Give prominent notice with each copy of the object code that the\par
Library is used in it and that the Library and its use are\par
covered by this License.\par
\par
b) Accompany the object code with a copy of the GNU GPL and this license\par
document.\par
\par
4. Combined Works.\par
\par
You may convey a Combined Work under terms of your choice that,\par
taken together, effectively do not restrict modification of the\par
portions of the Library contained in the Combined Work and reverse\par
engineering for debugging such modifications, if you also do each of\par
the following:\par
\par
a) Give prominent notice with each copy of the Combined Work that\par
the Library is used in it and that the Library and its use are\par
covered by this License.\par
\par
b) Accompany the Combined Work with a copy of the GNU GPL and this license\par
document.\par
\par
c) For a Combined Work that displays copyright notices during\par
execution, include the copyright notice for the Library among\par
these notices, as well as a reference directing the user to the\par
copies of the GNU GPL and this license document.\par
\par
d) Do one of the following:\par
\par
0) Convey the Minimal Corresponding Source under the terms of this\par
License, and the Corresponding Application Code in a form\par
suitable for, and under terms that permit, the user to\par
recombine or relink the Application with a modified version of\par
the Linked Version to produce a modified Combined Work, in the\par
manner specified by section 6 of the GNU GPL for conveying\par
Corresponding Source.\par
\par
1) Use a suitable shared library mechanism for linking with the\par
Library. A suitable mechanism is one that (a) uses at run time\par
a copy of the Library already present on the user's computer\par
system, and (b) will operate properly with a modified version\par
of the Library that is interface-compatible with the Linked\par
Version.\par
\par
e) Provide Installation Information, but only if you would otherwise\par
be required to provide such information under section 6 of the\par
GNU GPL, and only to the extent that such information is\par
necessary to install and execute a modified version of the\par
Combined Work produced by recombining or relinking the\par
Application with a modified version of the Linked Version. (If\par
you use option 4d0, the Installation Information must accompany\par
the Minimal Corresponding Source and Corresponding Application\par
Code. If you use option 4d1, you must provide the Installation\par
Information in the manner specified by section 6 of the GNU GPL\par
for conveying Corresponding Source.)\par
\par
5. Combined Libraries.\par
\par
You may place library facilities that are a work based on the\par
Library side by side in a single library together with other library\par
facilities that are not Applications and are not covered by this\par
License, and convey such a combined library under terms of your\par
choice, if you do both of the following:\par
\par
a) Accompany the combined library with a copy of the same work based\par
on the Library, uncombined with any other library facilities,\par
conveyed under the terms of this License.\par
\par
b) Give prominent notice with the combined library that part of it\par
is a work based on the Library, and explaining where to find the\par
accompanying uncombined form of the same work.\par
\par
6. Revised Versions of the GNU Lesser General Public License.\par
\par
The Free Software Foundation may publish revised and/or new versions\par
of the GNU Lesser General Public License from time to time. Such new\par
versions will be similar in spirit to the present version, but may\par
differ in detail to address new problems or concerns.\par
\par
Each version is given a distinguishing version number. If the\par
Library as you received it specifies that a certain numbered version\par
of the GNU Lesser General Public License "or any later version"\par
applies to it, you have the option of following the terms and\par
conditions either of that published version or of any later version\par
published by the Free Software Foundation. If the Library as you\par
received it does not specify a version number of the GNU Lesser\par
General Public License, you may choose any version of the GNU Lesser\par
General Public License ever published by the Free Software Foundation.\par
\par
If the Library as you received it specifies that a proxy can decide\par
whether future versions of the GNU Lesser General Public License shall\par
apply, that proxy's public statement of acceptance of any version is\par
permanent authorization for you to choose that version for the\par
Library.\par
}

View file

@ -1,22 +1,25 @@
# Yggdrasil
# RiV-mesh
[![CircleCI](https://circleci.com/gh/yggdrasil-network/yggdrasil-go.svg?style=shield&circle-token=:circle-token
)](https://circleci.com/gh/yggdrasil-network/yggdrasil-go)
[![CircleCI](https://circleci.com/gh/RiV-chain/RiV-mesh.svg?style=shield&circle-token=:circle-token
)](https://circleci.com/gh/RiV-chain/RiV-mesh)
## Introduction
Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6
network. It is lightweight, self-arranging, supported on multiple platforms and
allows pretty much any IPv6-capable application to communicate securely with
other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet
connectivity - it also works over IPv4.
RiV-mesh is an implementation of a fully end-to-end encrypted IPv6
network, created in the scope to produce the Transport Layer for RiV Chain Blockchain,
also to facilitate secure conectivity between a wide spectrum of endpoint devices like IoT devices,
desktop computers or even routers.
It is lightweight, self-arranging, supported on multiple
platforms and allows pretty much any IPv6-capable application
to communicate securely with other RiV-mesh nodes.
RiV-mesh does not require you to have IPv6 Internet connectivity - it also works over IPv4.
## Supported Platforms
Yggdrasil works on a number of platforms, including Linux, macOS, Ubiquiti
RiV-mesh works on a number of platforms, including Linux, macOS, Ubiquiti
EdgeRouter, VyOS, Windows, FreeBSD, OpenBSD and OpenWrt.
Please see our [Installation](https://yggdrasil-network.github.io/installation.html)
Please see our [Installation](https://RiV-chain.github.io/installation.html)
page for more information. You may also find other platform-specific wrappers, scripts
or tools in the `contrib` folder.
@ -41,51 +44,50 @@ To generate static configuration, either generate a HJSON file (human-friendly,
complete with comments):
```
./yggdrasil -genconf > /path/to/yggdrasil.conf
./mesh -genconf > /path/to/mesh.conf
```
... or generate a plain JSON file (which is easy to manipulate
programmatically):
```
./yggdrasil -genconf -json > /path/to/yggdrasil.conf
./mesh -genconf -json > /path/to/mesh.conf
```
You will need to edit the `yggdrasil.conf` file to add or remove peers, modify
You will need to edit the `mesh.conf` file to add or remove peers, modify
other configuration such as listen addresses or multicast addresses, etc.
### Run Yggdrasil
### Run RiV-mesh
To run with the generated static configuration:
```
./yggdrasil -useconffile /path/to/yggdrasil.conf
./mesh -useconffile /path/to/mesh.conf
```
To run in auto-configuration mode (which will use sane defaults and random keys
at each startup, instead of using a static configuration file):
```
./yggdrasil -autoconf
./mesh -autoconf
```
You will likely need to run Yggdrasil as a privileged user or under `sudo`,
You will likely need to run RiV-mesh as a privileged user or under `sudo`,
unless you have permission to create TUN/TAP adapters. On Linux this can be done
by giving the Yggdrasil binary the `CAP_NET_ADMIN` capability.
by giving the RiV-mesh binary the `CAP_NET_ADMIN` capability.
## Documentation
Documentation is available [on our website](https://yggdrasil-network.github.io).
Documentation is available [on our website](https://RiV-chain.github.io).
- [Installing Yggdrasil](https://yggdrasil-network.github.io/installation.html)
- [Configuring Yggdrasil](https://yggdrasil-network.github.io/configuration.html)
- [Frequently asked questions](https://yggdrasil-network.github.io/faq.html)
- [Installing RiV-mesh](https://RiV-chain.github.io/installation.html)
- [Configuring RiV-mesh](https://RiV-chain.github.io/configuration.html)
- [Frequently asked questions](https://RiV-chain.github.io/faq.html)
- [Version changelog](CHANGELOG.md)
## Community
Feel free to join us on our [Matrix
channel](https://matrix.to/#/#yggdrasil:matrix.org) at `#yggdrasil:matrix.org`
or in the `#yggdrasil` IRC channel on [libera.chat](https://libera.chat).
Feel free to join us on our [Telegram
channel](https://t.me/rivchain).
## License

View file

@ -5,12 +5,16 @@ os: Visual Studio 2019
shallow_clone: false
environment:
MSYSTEM: MINGW64
MSYS2_PATH_TYPE: inherit
CHERE_INVOKING: enabled_from_arguments
build_script:
- cmd: >-
cd %APPVEYOR_BUILD_FOLDER%
##### MinGW build
- set OPT_PATH=C:\msys64\mingw32\bin;C:\msys64\mingw64\bin;
- set PATH=%OPT_PATH%%PATH%
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x64"
- c:\msys64\usr\bin\bash -lc "./contrib/msi/build-msi.sh x86"

25
build
View file

@ -2,11 +2,14 @@
set -ef
PKGSRC=${PKGSRC:-github.com/yggdrasil-network/yggdrasil-go/src/version}
PKGSRC=${PKGSRC:-github.com/RiV-chain/RiV-mesh/src/version}
PKGNAME=${PKGNAME:-$(sh contrib/semver/name.sh)}
PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)}
LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
if [ "$LDFLAGS" ]; then
LDFLAGS="$LDFLAGS -X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
else
LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
fi
ARGS="-v"
while getopts "uaitc:l:dro:p" option
@ -33,19 +36,19 @@ fi
if [ $IOS ]; then
echo "Building framework for iOS"
go get golang.org/x/mobile/bind
gomobile bind -target ios -tags mobile -o Yggdrasil.framework -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-extras/src/mobile \
github.com/yggdrasil-network/yggdrasil-go/src/config
gomobile bind -target ios -tags mobile -o Mesh.framework -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/RiV-chain/RiV-mesh-extras/src/mobile \
github.com/RiV-chain/RiV-mesh/src/config
elif [ $ANDROID ]; then
echo "Building aar for Android"
go get golang.org/x/mobile/bind
gomobile bind -target android -tags mobile -o yggdrasil.aar -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/yggdrasil-network/yggdrasil-extras/src/mobile \
github.com/yggdrasil-network/yggdrasil-go/src/config
gomobile bind -target android -tags mobile -o mesh.aar -ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
github.com/RiV-chain/RiV-mesh-extras/src/mobile \
github.com/RiV-chain/RiV-mesh/src/config
else
for CMD in yggdrasil yggdrasilctl ; do
for CMD in ./cmd/mesh ./cmd/meshctl ./contrib/ui/mesh-ui ; do
echo "Building: $CMD"
go build $ARGS -ldflags="$LDFLAGS" -gcflags="$GCFLAGS" ./cmd/$CMD
go build $ARGS -ldflags "$LDFLAGS" -gcflags "$GCFLAGS" $CMD
if [ $UPX ]; then
upx --brute $CMD

View file

@ -19,7 +19,7 @@ import (
"net"
"runtime"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
type keySet struct {

View file

@ -23,16 +23,16 @@ import (
"github.com/kardianos/minwinsvc"
"github.com/mitchellh/mapstructure"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"github.com/RiV-chain/RiV-mesh/src/address"
"github.com/RiV-chain/RiV-mesh/src/admin"
"github.com/RiV-chain/RiV-mesh/src/config"
"github.com/RiV-chain/RiV-mesh/src/defaults"
"github.com/yggdrasil-network/yggdrasil-go/src/core"
"github.com/yggdrasil-network/yggdrasil-go/src/ipv6rwc"
"github.com/yggdrasil-network/yggdrasil-go/src/multicast"
"github.com/yggdrasil-network/yggdrasil-go/src/tuntap"
"github.com/yggdrasil-network/yggdrasil-go/src/version"
"github.com/RiV-chain/RiV-mesh/src/core"
"github.com/RiV-chain/RiV-mesh/src/ipv6rwc"
"github.com/RiV-chain/RiV-mesh/src/multicast"
"github.com/RiV-chain/RiV-mesh/src/tuntap"
"github.com/RiV-chain/RiV-mesh/src/version"
)
type node struct {
@ -224,7 +224,7 @@ func getArgs() yggArgs {
}
}
// The main function is responsible for configuring and starting Yggdrasil.
// The main function is responsible for configuring and starting Mesh.
func run(args yggArgs, ctx context.Context, done chan struct{}) {
defer close(done)
// Create a new logger that logs output to stdout.
@ -325,11 +325,11 @@ func run(args yggArgs, ctx context.Context, done chan struct{}) {
default:
}
// Setup the Yggdrasil node itself. The node{} type includes a Core, so we
// Setup the Mesh node itself. The node{} type includes a Core, so we
// don't need to create this manually.
n := node{config: cfg}
// Now start Yggdrasil - this starts the DHT, router, switch and other core
// components needed for Yggdrasil to operate
// Now start Mesh - this starts the DHT, router, switch and other core
// components needed for Mesh to operate
if err = n.core.Start(cfg, logger); err != nil {
logger.Errorln("An error occurred during startup")
panic(err)

View file

@ -11,7 +11,7 @@ import (
"github.com/hjson/hjson-go"
"golang.org/x/text/encoding/unicode"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"github.com/RiV-chain/RiV-mesh/src/defaults"
)
type CmdLineEnv struct {

View file

@ -14,7 +14,7 @@ import (
"strconv"
"strings"
"github.com/yggdrasil-network/yggdrasil-go/src/version"
"github.com/RiV-chain/RiV-mesh/src/version"
)
type admin_info map[string]interface{}
@ -43,7 +43,7 @@ func run() int {
if cmdLineEnv.ver {
fmt.Println("Build name:", version.BuildName())
fmt.Println("Build version:", version.BuildVersion())
fmt.Println("To get the version number of the running Yggdrasil node, run", os.Args[0], "getSelf")
fmt.Println("To get the version number of the running Mesh node, run", os.Args[0], "getSelf")
return 0
}

View file

@ -1,6 +1,6 @@
/*
This file generates crypto keys for [ansible-yggdrasil](https://github.com/jcgruenhage/ansible-yggdrasil/)
This file generates crypto keys for [ansible-mesh](https://github.com/jcgruenhage/ansible-mesh/)
*/
package main
@ -14,7 +14,7 @@ import (
"os"
"github.com/cheggaaa/pb/v3"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
var numHosts = flag.Int("hosts", 1, "number of host vars to generate")
@ -57,8 +57,8 @@ func main() {
return
}
defer file.Close()
file.WriteString(fmt.Sprintf("yggdrasil_public_key: %v\n", hex.EncodeToString(keys[i].pub)))
file.WriteString("yggdrasil_private_key: \"{{ vault_yggdrasil_private_key }}\"\n")
file.WriteString(fmt.Sprintf("mesh_public_key: %v\n", hex.EncodeToString(keys[i].pub)))
file.WriteString("mesh_private_key: \"{{ vault_mesh_private_key }}\"\n")
file.WriteString(fmt.Sprintf("ansible_host: %v\n", keys[i].ip))
file, err = os.Create(fmt.Sprintf("host_vars/%x/vault", i))
@ -66,7 +66,7 @@ func main() {
return
}
defer file.Close()
file.WriteString(fmt.Sprintf("vault_yggdrasil_private_key: %v\n", hex.EncodeToString(keys[i].priv)))
file.WriteString(fmt.Sprintf("vault_mesh_private_key: %v\n", hex.EncodeToString(keys[i].priv)))
bar.Increment()
}
bar.Finish()

View file

@ -1,7 +1,7 @@
# Last Modified: Fri Oct 30 11:33:31 2020
#include <tunables/global>
/usr/bin/yggdrasil {
/usr/bin/mesh {
#include <abstractions/base>
#include <abstractions/nameservice>
@ -12,6 +12,6 @@
/proc/sys/net/core/somaxconn r,
/sys/kernel/mm/transparent_hugepage/hpage_pmd_size r,
/etc/yggdrasil.conf rw,
/run/yggdrasil.sock rw,
/etc/mesh.conf rw,
/run/mesh.sock rw,
}

View file

@ -1,9 +1,9 @@
#!/bin/sh
CONFFILE="/etc/yggdrasil.conf"
CONFFILE="/etc/mesh.conf"
genconf() {
/usr/bin/yggdrasil -genconf > "$1"
/usr/bin/mesh -genconf > "$1"
return $?
}
@ -33,8 +33,8 @@ start() {
fi
fi
printf 'Starting yggdrasil: '
if start-stop-daemon -S -q -b -x /usr/bin/yggdrasil \
printf 'Starting mesh: '
if start-stop-daemon -S -q -b -x /usr/bin/mesh \
-- -useconffile "$CONFFILE"; then
echo "OK"
else
@ -43,8 +43,8 @@ start() {
}
stop() {
printf "Stopping yggdrasil: "
if start-stop-daemon -K -q -x /usr/bin/yggdrasil; then
printf "Stopping mesh: "
if start-stop-daemon -K -q -x /usr/bin/mesh; then
echo "OK"
else
echo "FAIL"
@ -52,8 +52,8 @@ stop() {
}
reload() {
printf "Reloading yggdrasil: "
if start-stop-daemon -K -q -s HUP -x /usr/bin/yggdrasil; then
printf "Reloading mesh: "
if start-stop-daemon -K -q -s HUP -x /usr/bin/mesh; then
echo "OK"
else
echo "FAIL"

68
contrib/deb/generate.sh Normal file → Executable file
View file

@ -1,7 +1,7 @@
#!/bin/sh
# This is a lazy script to create a .deb for Debian/Ubuntu. It installs
# yggdrasil and enables it in systemd. You can give it the PKGARCH= argument
# mesh and enables it in systemd. You can give it the PKGARCH= argument
# i.e. PKGARCH=i386 sh contrib/deb/generate.sh
if [ `pwd` != `git rev-parse --show-toplevel` ]
@ -15,10 +15,10 @@ PKGNAME=$(sh contrib/semver/name.sh)
PKGVERSION=$(sh contrib/semver/version.sh --bare)
PKGARCH=${PKGARCH-amd64}
PKGFILE=$PKGNAME-$PKGVERSION-$PKGARCH.deb
PKGREPLACES=yggdrasil
PKGREPLACES=mesh
if [ $PKGBRANCH = "master" ]; then
PKGREPLACES=yggdrasil-develop
PKGREPLACES=mesh-develop
fi
if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build
@ -41,7 +41,7 @@ mkdir -p /tmp/$PKGNAME/usr/bin/
mkdir -p /tmp/$PKGNAME/etc/systemd/system/
cat > /tmp/$PKGNAME/debian/changelog << EOF
Please see https://github.com/yggdrasil-network/yggdrasil-go/
Please see https://github.com/RiV-chain/RiV-mesh/
EOF
echo 9 > /tmp/$PKGNAME/debian/compat
cat > /tmp/$PKGNAME/debian/control << EOF
@ -53,69 +53,71 @@ Architecture: $PKGARCH
Replaces: $PKGREPLACES
Conflicts: $PKGREPLACES
Maintainer: Neil Alexander <neilalexander@users.noreply.github.com>
Description: Yggdrasil Network
Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6
Description: RiV-mesh Network
RiV-mesh is an early-stage implementation of a fully end-to-end encrypted IPv6
network. It is lightweight, self-arranging, supported on multiple platforms and
allows pretty much any IPv6-capable application to communicate securely with
other Yggdrasil nodes.
other RiV-mesh nodes.
EOF
cat > /tmp/$PKGNAME/debian/copyright << EOF
Please see https://github.com/yggdrasil-network/yggdrasil-go/
Please see https://github.com/RiV-chain/RiV-mesh/
EOF
cat > /tmp/$PKGNAME/debian/docs << EOF
Please see https://github.com/yggdrasil-network/yggdrasil-go/
Please see https://github.com/RiV-chain/RiV-mesh/
EOF
cat > /tmp/$PKGNAME/debian/install << EOF
usr/bin/yggdrasil usr/bin
usr/bin/yggdrasilctl usr/bin
usr/bin/mesh usr/bin
usr/bin/meshctl usr/bin
usr/bin/mesh-ui usr/bin
etc/systemd/system/*.service etc/systemd/system
EOF
cat > /tmp/$PKGNAME/debian/postinst << EOF
#!/bin/sh
if ! getent group yggdrasil 2>&1 > /dev/null; then
groupadd --system --force yggdrasil || echo "Failed to create group 'yggdrasil' - please create it manually and reinstall"
if ! getent group mesh 2>&1 > /dev/null; then
groupadd --system --force mesh || echo "Failed to create group 'mesh' - please create it manually and reinstall"
fi
if [ -f /etc/yggdrasil.conf ];
if [ -f /etc/mesh.conf ];
then
mkdir -p /var/backups
echo "Backing up configuration file to /var/backups/yggdrasil.conf.`date +%Y%m%d`"
cp /etc/yggdrasil.conf /var/backups/yggdrasil.conf.`date +%Y%m%d`
echo "Normalising and updating /etc/yggdrasil.conf"
/usr/bin/yggdrasil -useconf -normaliseconf < /var/backups/yggdrasil.conf.`date +%Y%m%d` > /etc/yggdrasil.conf
chgrp yggdrasil /etc/yggdrasil.conf
echo "Backing up configuration file to /var/backups/mesh.conf.`date +%Y%m%d`"
cp /etc/mesh.conf /var/backups/mesh.conf.`date +%Y%m%d`
echo "Normalising and updating /etc/mesh.conf"
/usr/bin/mesh -useconf -normaliseconf < /var/backups/mesh.conf.`date +%Y%m%d` > /etc/mesh.conf
chgrp mesh /etc/mesh.conf
if command -v systemctl >/dev/null; then
systemctl daemon-reload >/dev/null || true
systemctl enable yggdrasil || true
systemctl start yggdrasil || true
systemctl enable mesh || true
systemctl start mesh || true
fi
else
echo "Generating initial configuration file /etc/yggdrasil.conf"
echo "Please familiarise yourself with this file before starting Yggdrasil"
sh -c 'umask 0027 && /usr/bin/yggdrasil -genconf > /etc/yggdrasil.conf'
chgrp yggdrasil /etc/yggdrasil.conf
echo "Generating initial configuration file /etc/mesh.conf"
echo "Please familiarise yourself with this file before starting Mesh"
sh -c 'umask 0027 && /usr/bin/mesh -genconf > /etc/mesh.conf'
chgrp mesh /etc/mesh.conf
fi
EOF
cat > /tmp/$PKGNAME/debian/prerm << EOF
#!/bin/sh
if command -v systemctl >/dev/null; then
if systemctl is-active --quiet yggdrasil; then
systemctl stop yggdrasil || true
if systemctl is-active --quiet mesh; then
systemctl stop mesh || true
fi
systemctl disable yggdrasil || true
systemctl disable mesh || true
fi
EOF
cp yggdrasil /tmp/$PKGNAME/usr/bin/
cp yggdrasilctl /tmp/$PKGNAME/usr/bin/
cp mesh /tmp/$PKGNAME/usr/bin/
cp meshctl /tmp/$PKGNAME/usr/bin/
cp mesh-ui /tmp/$PKGNAME/usr/bin/
cp contrib/systemd/*.service /tmp/$PKGNAME/etc/systemd/system/
tar -czvf /tmp/$PKGNAME/data.tar.gz -C /tmp/$PKGNAME/ \
usr/bin/yggdrasil usr/bin/yggdrasilctl \
etc/systemd/system/yggdrasil.service \
etc/systemd/system/yggdrasil-default-config.service
usr/bin/mesh usr/bin/meshctl usr/bin/mesh-ui \
etc/systemd/system/mesh.service \
etc/systemd/system/mesh-default-config.service
tar -czvf /tmp/$PKGNAME/control.tar.gz -C /tmp/$PKGNAME/debian .
echo 2.0 > /tmp/$PKGNAME/debian-binary

View file

@ -9,17 +9,17 @@ RUN apk add git && ./build && go build -o /src/genkeys cmd/genkeys/main.go
FROM docker.io/alpine
COPY --from=builder /src/yggdrasil /usr/bin/yggdrasil
COPY --from=builder /src/yggdrasilctl /usr/bin/yggdrasilctl
COPY --from=builder /src/mesh /usr/bin/mesh
COPY --from=builder /src/meshctl /usr/bin/meshctl
COPY --from=builder /src/genkeys /usr/bin/genkeys
COPY contrib/docker/entrypoint.sh /usr/bin/entrypoint.sh
# RUN addgroup -g 1000 -S yggdrasil-network \
# && adduser -u 1000 -S -g 1000 --home /etc/yggdrasil-network yggdrasil-network
# RUN addgroup -g 1000 -S RiV-chain \
# && adduser -u 1000 -S -g 1000 --home /etc/RiV-chain RiV-chain
#
# USER yggdrasil-network
# USER RiV-chain
# TODO: Make running unprivileged work
VOLUME [ "/etc/yggdrasil-network" ]
VOLUME [ "/etc/RiV-chain" ]
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]

View file

@ -2,12 +2,12 @@
set -e
CONF_DIR="/etc/yggdrasil-network"
CONF_DIR="/etc/RiV-chain"
if [ ! -f "$CONF_DIR/config.conf" ]; then
echo "generate $CONF_DIR/config.conf"
yggdrasil --genconf > "$CONF_DIR/config.conf"
mesh --genconf > "$CONF_DIR/config.conf"
fi
yggdrasil --useconf < "$CONF_DIR/config.conf"
mesh --useconf < "$CONF_DIR/config.conf"
exit $?

72
contrib/freebsd/mesh Normal file
View file

@ -0,0 +1,72 @@
#!/bin/sh
#
# Put the mesh and meshctl binaries into /usr/local/bin
# Then copy this script into /etc/rc.d/mesh
# Finally, run:
# 1. chmod +x /etc/rc.d/mesh /usr/local/bin/{mesh,meshctl}
# 2. echo "mesh_enable=yes" >> /etc/rc.d
# 3. service mesh start
#
# PROVIDE: mesh
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="mesh"
rcvar="mesh_enable"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
pidfile="/var/run/mesh/${name}.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -f ${mesh_command}"
mesh_start()
{
test ! -x /usr/local/bin/mesh && (
logger -s -t mesh "Warning: /usr/local/bin/mesh is missing or not executable"
logger -s -t mesh "Copy the mesh binary into /usr/local/bin and then chmod +x /usr/local/bin/mesh"
return 1
)
test ! -f /etc/mesh.conf && (
logger -s -t mesh "Generating new configuration file into /etc/mesh.conf"
/usr/local/bin/mesh -genconf > /etc/mesh.conf
)
tap_path="$(cat /etc/mesh.conf | egrep -o '/dev/tap[0-9]{1,2}$')"
tap_name="$(echo -n ${tap_path} | tr -d '/dev/')"
/sbin/ifconfig ${tap_name} >/dev/null 2>&1 || (
logger -s -t mesh "Creating ${tap_name} adapter"
/sbin/ifconfig ${tap_name} create || logger -s -t mesh "Failed to create ${tap_name} adapter"
)
test ! -d /var/run/mesh && mkdir -p /var/run/mesh
logger -s -t mesh "Starting mesh"
${command} ${command_args} /usr/local/bin/mesh -useconffile /etc/mesh.conf \
1>/var/log/mesh.stdout.log \
2>/var/log/mesh.stderr.log &
}
mesh_stop()
{
logger -s -t mesh "Stopping mesh"
test -f /var/run/mesh/${name}.pid && kill -TERM $(cat /var/run/mesh/${name}.pid)
tap_path="$(cat /etc/mesh.conf | grep /dev/tap | egrep -o '/dev/.*$')"
tap_name="$(echo -n ${tap_path} | tr -d '/dev/')"
/sbin/ifconfig ${tap_name} >/dev/null 2>&1 && (
logger -s -t mesh "Destroying ${tap_name} adapter"
/sbin/ifconfig ${tap_name} destroy || logger -s -t mesh "Failed to destroy ${tap_name} adapter"
)
}
load_rc_config $name
: ${mesh_enable:=no}
run_rc_command "$1"

View file

@ -1,72 +0,0 @@
#!/bin/sh
#
# Put the yggdrasil and yggdrasilctl binaries into /usr/local/bin
# Then copy this script into /etc/rc.d/yggdrasil
# Finally, run:
# 1. chmod +x /etc/rc.d/yggdrasil /usr/local/bin/{yggdrasil,yggdrasilctl}
# 2. echo "yggdrasil_enable=yes" >> /etc/rc.d
# 3. service yggdrasil start
#
# PROVIDE: yggdrasil
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="yggdrasil"
rcvar="yggdrasil_enable"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
pidfile="/var/run/yggdrasil/${name}.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -f ${yggdrasil_command}"
yggdrasil_start()
{
test ! -x /usr/local/bin/yggdrasil && (
logger -s -t yggdrasil "Warning: /usr/local/bin/yggdrasil is missing or not executable"
logger -s -t yggdrasil "Copy the yggdrasil binary into /usr/local/bin and then chmod +x /usr/local/bin/yggdrasil"
return 1
)
test ! -f /etc/yggdrasil.conf && (
logger -s -t yggdrasil "Generating new configuration file into /etc/yggdrasil.conf"
/usr/local/bin/yggdrasil -genconf > /etc/yggdrasil.conf
)
tap_path="$(cat /etc/yggdrasil.conf | egrep -o '/dev/tap[0-9]{1,2}$')"
tap_name="$(echo -n ${tap_path} | tr -d '/dev/')"
/sbin/ifconfig ${tap_name} >/dev/null 2>&1 || (
logger -s -t yggdrasil "Creating ${tap_name} adapter"
/sbin/ifconfig ${tap_name} create || logger -s -t yggdrasil "Failed to create ${tap_name} adapter"
)
test ! -d /var/run/yggdrasil && mkdir -p /var/run/yggdrasil
logger -s -t yggdrasil "Starting yggdrasil"
${command} ${command_args} /usr/local/bin/yggdrasil -useconffile /etc/yggdrasil.conf \
1>/var/log/yggdrasil.stdout.log \
2>/var/log/yggdrasil.stderr.log &
}
yggdrasil_stop()
{
logger -s -t yggdrasil "Stopping yggdrasil"
test -f /var/run/yggdrasil/${name}.pid && kill -TERM $(cat /var/run/yggdrasil/${name}.pid)
tap_path="$(cat /etc/yggdrasil.conf | grep /dev/tap | egrep -o '/dev/.*$')"
tap_name="$(echo -n ${tap_path} | tr -d '/dev/')"
/sbin/ifconfig ${tap_name} >/dev/null 2>&1 && (
logger -s -t yggdrasil "Destroying ${tap_name} adapter"
/sbin/ifconfig ${tap_name} destroy || logger -s -t yggdrasil "Failed to destroy ${tap_name} adapter"
)
}
load_rc_config $name
: ${yggdrasil_enable:=no}
run_rc_command "$1"

View file

@ -17,10 +17,10 @@ command -v mkbom >/dev/null 2>&1 || (
# Check if we can find the files we need - they should
# exist if you are running this script from the root of
# the yggdrasil-go repo and you have ran ./build
test -f yggdrasil || (echo "yggdrasil binary not found"; exit 1)
test -f yggdrasilctl || (echo "yggdrasilctl binary not found"; exit 1)
test -f contrib/macos/yggdrasil.plist || (echo "contrib/macos/yggdrasil.plist not found"; exit 1)
# the RiV-mesh repo and you have ran ./build
test -f mesh || (echo "mesh binary not found"; exit 1)
test -f meshctl || (echo "meshctl binary not found"; exit 1)
test -f contrib/macos/mesh.plist || (echo "contrib/macos/mesh.plist not found"; exit 1)
test -f contrib/semver/version.sh || (echo "contrib/semver/version.sh not found"; exit 1)
# Delete the pkgbuild folder if it already exists
@ -34,37 +34,37 @@ mkdir -p pkgbuild/root/usr/local/bin
mkdir -p pkgbuild/root/Library/LaunchDaemons
# Copy package contents into the pkgbuild root
cp yggdrasil pkgbuild/root/usr/local/bin
cp yggdrasilctl pkgbuild/root/usr/local/bin
cp contrib/macos/yggdrasil.plist pkgbuild/root/Library/LaunchDaemons
cp mesh pkgbuild/root/usr/local/bin
cp meshctl pkgbuild/root/usr/local/bin
cp contrib/macos/mesh.plist pkgbuild/root/Library/LaunchDaemons
# Create the postinstall script
cat > pkgbuild/scripts/postinstall << EOF
#!/bin/sh
# Normalise the config if it exists, generate it if it doesn't
if [ -f /etc/yggdrasil.conf ];
if [ -f /etc/mesh.conf ];
then
mkdir -p /Library/Preferences/Yggdrasil
echo "Backing up configuration file to /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`"
cp /etc/yggdrasil.conf /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d`
echo "Normalising /etc/yggdrasil.conf"
/usr/local/bin/yggdrasil -useconffile /Library/Preferences/Yggdrasil/yggdrasil.conf.`date +%Y%m%d` -normaliseconf > /etc/yggdrasil.conf
mkdir -p /Library/Preferences/Mesh
echo "Backing up configuration file to /Library/Preferences/Mesh/mesh.conf.`date +%Y%m%d`"
cp /etc/mesh.conf /Library/Preferences/Mesh/mesh.conf.`date +%Y%m%d`
echo "Normalising /etc/mesh.conf"
/usr/local/bin/mesh -useconffile /Library/Preferences/Mesh/mesh.conf.`date +%Y%m%d` -normaliseconf > /etc/mesh.conf
else
/usr/local/bin/yggdrasil -genconf > /etc/yggdrasil.conf
/usr/local/bin/mesh -genconf > /etc/mesh.conf
fi
# Unload existing Yggdrasil launchd service, if possible
test -f /Library/LaunchDaemons/yggdrasil.plist && (launchctl unload /Library/LaunchDaemons/yggdrasil.plist || true)
# Unload existing Mesh launchd service, if possible
test -f /Library/LaunchDaemons/mesh.plist && (launchctl unload /Library/LaunchDaemons/mesh.plist || true)
# Load Yggdrasil launchd service and start Yggdrasil
launchctl load /Library/LaunchDaemons/yggdrasil.plist
# Load Mesh launchd service and start Mesh
launchctl load /Library/LaunchDaemons/mesh.plist
EOF
# Set execution permissions
chmod +x pkgbuild/scripts/postinstall
chmod +x pkgbuild/root/usr/local/bin/yggdrasil
chmod +x pkgbuild/root/usr/local/bin/yggdrasilctl
chmod +x pkgbuild/root/usr/local/bin/mesh
chmod +x pkgbuild/root/usr/local/bin/meshctl
# Pack payload and scripts
( cd pkgbuild/scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > pkgbuild/flat/base.pkg/Scripts
@ -78,7 +78,7 @@ PAYLOADSIZE=$(( $(wc -c pkgbuild/flat/base.pkg/Payload | awk '{ print $1 }') / 1
# Create the PackageInfo file
cat > pkgbuild/flat/base.pkg/PackageInfo << EOF
<pkg-info format-version="2" identifier="io.github.yggdrasil-network.pkg" version="${PKGVERSION}" install-location="/" auth="root">
<pkg-info format-version="2" identifier="io.github.RiV-chain.pkg" version="${PKGVERSION}" install-location="/" auth="root">
<payload installKBytes="${PAYLOADSIZE}" numberOfFiles="3"/>
<scripts>
<postinstall file="./postinstall"/>
@ -93,7 +93,7 @@ EOF
cat > pkgbuild/flat/Distribution << EOF
<?xml version="1.0" encoding="utf-8"?>
<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.3" authoringToolBuild="174">
<title>Yggdrasil (${PKGNAME}-${PKGVERSION})</title>
<title>Mesh (${PKGNAME}-${PKGVERSION})</title>
<options customize="never" allow-external-scripts="no"/>
<domains enable_anywhere="true"/>
<installation-check script="pm_install_check();"/>
@ -101,7 +101,7 @@ cat > pkgbuild/flat/Distribution << EOF
function pm_install_check() {
if(!(system.compareVersions(system.version.ProductVersion,'10.10') >= 0)) {
my.result.title = 'Failure';
my.result.message = 'You need at least Mac OS X 10.10 to install Yggdrasil.';
my.result.message = 'You need at least Mac OS X 10.10 to install Mesh.';
my.result.type = 'Fatal';
return false;
}
@ -112,9 +112,9 @@ cat > pkgbuild/flat/Distribution << EOF
<line choice="choice1"/>
</choices-outline>
<choice id="choice1" title="base">
<pkg-ref id="io.github.yggdrasil-network.pkg"/>
<pkg-ref id="io.github.RiV-chain.pkg"/>
</choice>
<pkg-ref id="io.github.yggdrasil-network.pkg" installKBytes="${PAYLOADSIZE}" version="${VERSION}" auth="Root">#base.pkg</pkg-ref>
<pkg-ref id="io.github.RiV-chain.pkg" installKBytes="${PAYLOADSIZE}" version="${VERSION}" auth="Root">#base.pkg</pkg-ref>
</installer-script>
EOF

View file

@ -3,12 +3,12 @@
<plist version="1.0">
<dict>
<key>Label</key>
<string>yggdrasil</string>
<string>mesh</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/usr/local/bin/yggdrasil -useconffile /etc/yggdrasil.conf</string>
<string>/usr/local/bin/mesh -useconffile /etc/mesh.conf</string>
</array>
<key>KeepAlive</key>
<true/>
@ -17,8 +17,8 @@
<key>ProcessType</key>
<string>Interactive</string>
<key>StandardOutPath</key>
<string>/tmp/yggdrasil.stdout.log</string>
<string>/tmp/mesh.stdout.log</string>
<key>StandardErrorPath</key>
<string>/tmp/yggdrasil.stderr.log</string>
<string>/tmp/mesh.stderr.log</string>
</dict>
</plist>

View file

@ -0,0 +1,12 @@
.PHONY: all
all: util mesh-brute-multi-curve25519 mesh-brute-multi-ed25519
util: util.c
gcc -Wall -std=c89 -O3 -c -o util.o util.c
mesh-brute-multi-ed25519: mesh-brute-multi-ed25519.c util.o
gcc -Wall -std=c89 -O3 -o mesh-brute-multi-ed25519 -lsodium mesh-brute-multi-ed25519.c util.o
mesh-brute-multi-curve25519: mesh-brute-multi-curve25519.c util.o
gcc -Wall -std=c89 -O3 -o mesh-brute-multi-curve25519 -lsodium mesh-brute-multi-curve25519.c util.o

View file

@ -1,4 +1,4 @@
# yggdrasil-brute-simple
# mesh-brute-simple
Simple program for finding curve25519 and ed25519 public keys whose sha512 hash has many leading ones.
Because ed25519 private keys consist of a seed that is hashed to find the secret part of the keypair,

View file

@ -13,7 +13,7 @@ if besthash:
besthash = hash
*/
#include "yggdrasil-brute.h"
#include "mesh-brute.h"
void seed(unsigned char sk[32]) {
@ -43,7 +43,7 @@ int main(int argc, char **argv) {
int where;
if (argc != 2) {
fprintf(stderr, "usage: ./yggdrasil-brute-multi-curve25519 <seconds>\n");
fprintf(stderr, "usage: ./mesh-brute-multi-curve25519 <seconds>\n");
return 1;
}
@ -57,7 +57,7 @@ int main(int argc, char **argv) {
requestedtime = atoi(argv[1]);
if (requestedtime < 0) requestedtime = 0;
fprintf(stderr, "Searching for yggdrasil curve25519 keys (this will take slightly longer than %ld seconds)\n", requestedtime);
fprintf(stderr, "Searching for mesh curve25519 keys (this will take slightly longer than %ld seconds)\n", requestedtime);
sodium_memzero(bestsklist, NUMKEYS * 32);
sodium_memzero(bestpklist, NUMKEYS * 32);

View file

@ -20,7 +20,7 @@ if besthash:
besthash = hash
*/
#include "yggdrasil-brute.h"
#include "mesh-brute.h"
int main(int argc, char **argv) {
@ -41,7 +41,7 @@ int main(int argc, char **argv) {
int where;
if (argc != 2) {
fprintf(stderr, "usage: ./yggdrasil-brute-multi-curve25519 <seconds>\n");
fprintf(stderr, "usage: ./mesh-brute-multi-curve25519 <seconds>\n");
return 1;
}
@ -55,7 +55,7 @@ int main(int argc, char **argv) {
requestedtime = atoi(argv[1]);
if (requestedtime < 0) requestedtime = 0;
fprintf(stderr, "Searching for yggdrasil ed25519 keys (this will take slightly longer than %ld seconds)\n", requestedtime);
fprintf(stderr, "Searching for mesh ed25519 keys (this will take slightly longer than %ld seconds)\n", requestedtime);
sodium_memzero(bestsklist, NUMKEYS * 64);
sodium_memzero(besthashlist, NUMKEYS * 64);

View file

@ -1,4 +1,4 @@
#include "yggdrasil-brute.h"
#include "mesh-brute.h"
int find_where(unsigned char hash[64], unsigned char besthashlist[NUMKEYS][64]) {
/* Where to insert hash into sorted hashlist */
@ -28,7 +28,7 @@ void insert_32(unsigned char itemlist[NUMKEYS][32], unsigned char item[32], int
}
void make_addr(unsigned char addr[32], unsigned char hash[64]) {
/* Public key hash to yggdrasil ipv6 address */
/* Public key hash to mesh ipv6 address */
int i;
int offset;
unsigned char mask;

120
contrib/msi/build-msi.sh Normal file → Executable file
View file

@ -1,6 +1,6 @@
#!/bin/sh
# This script generates an MSI file for Yggdrasil for a given architecture. It
# This script generates an MSI file for Mesh for a given architecture. It
# needs to run on Windows within MSYS2 and Go 1.13 or later must be installed on
# the system and within the PATH. This is ran currently by Appveyor (see
# appveyor.yml in the repository root) for both x86 and x64.
@ -47,20 +47,20 @@ then
)
fi
# Build Yggdrasil!
[ "${PKGARCH}" == "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./build
[ "${PKGARCH}" == "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=0 ./build
# Build Mesh!
[ "${PKGARCH}" == "x64" ] && GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ LDFLAGS="-H windowsgui" ./build
[ "${PKGARCH}" == "x86" ] && GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ LDFLAGS="-H windowsgui" ./build
[ "${PKGARCH}" == "arm" ] && GOOS=windows GOARCH=arm CGO_ENABLED=0 ./build
#[ "${PKGARCH}" == "arm64" ] && GOOS=windows GOARCH=arm64 CGO_ENABLED=0 ./build
# Create the postinstall script
cat > updateconfig.bat << EOF
if not exist %ALLUSERSPROFILE%\\Yggdrasil (
mkdir %ALLUSERSPROFILE%\\Yggdrasil
if not exist %ALLUSERSPROFILE%\\RiV-mesh (
mkdir %ALLUSERSPROFILE%\\RiV-mesh
)
if not exist %ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf (
if exist yggdrasil.exe (
yggdrasil.exe -genconf > %ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf
if not exist %ALLUSERSPROFILE%\\RiV-mesh\\mesh.conf (
if exist mesh.exe (
mesh.exe -genconf > %ALLUSERSPROFILE%\\RiV-mesh\\mesh.conf
)
)
EOF
@ -69,6 +69,9 @@ EOF
PKGNAME=$(sh contrib/semver/name.sh)
PKGVERSION=$(sh contrib/msi/msversion.sh --bare)
PKGVERSIONMS=$(echo $PKGVERSION | tr - .)
PKGINDEXFILE=contrib/ui/mesh-ui/index.html
PKGLICENSEFILE=LICENSE.rtf
[ "${PKGARCH}" == "x64" ] && \
PKGGUID="77757838-1a23-40a5-a720-c3b43e0260cc" PKGINSTFOLDER="ProgramFiles64Folder" || \
PKGGUID="54a3294e-a441-4322-aefb-3bb40dd022bb" PKGINSTFOLDER="ProgramFilesFolder"
@ -81,8 +84,12 @@ then
fi
if [ $PKGARCH = "x64" ]; then
PKGWINTUNDLL=wintun/bin/amd64/wintun.dll
PKGWEBVIEWFILE=contrib/ui/mesh-ui/dll/x64/webview.dll
PKGWEBVIEWFILELOADER=contrib/ui/mesh-ui/dll/x64/WebView2Loader.dll
elif [ $PKGARCH = "x86" ]; then
PKGWINTUNDLL=wintun/bin/x86/wintun.dll
PKGWEBVIEWFILE=contrib/ui/mesh-ui/dll/x86/webview.dll
PKGWEBVIEWFILELOADER=contrib/ui/mesh-ui/dll/x86/WebView2Loader.dll
elif [ $PKGARCH = "arm" ]; then
PKGWINTUNDLL=wintun/bin/arm/wintun.dll
#elif [ $PKGARCH = "arm64" ]; then
@ -93,9 +100,9 @@ else
fi
if [ $PKGNAME != "master" ]; then
PKGDISPLAYNAME="Yggdrasil Network (${PKGNAME} branch)"
PKGDISPLAYNAME="RiV-mesh Network (${PKGNAME} branch)"
else
PKGDISPLAYNAME="Yggdrasil Network"
PKGDISPLAYNAME="RiV-mesh Network"
fi
# Generate the wix.xml file
@ -109,14 +116,14 @@ cat > wix.xml << EOF
Language="1033"
Codepage="1252"
Version="${PKGVERSIONMS}"
Manufacturer="github.com/yggdrasil-network">
Manufacturer="github.com/RiV-chain">
<Package
Id="*"
Keywords="Installer"
Description="Yggdrasil Network Installer"
Comments="Yggdrasil Network standalone router for Windows."
Manufacturer="github.com/yggdrasil-network"
Description="RiV-mesh Network Installer"
Comments="RiV-mesh Network standalone router for Windows."
Manufacturer="github.com/RiV-chain"
InstallerVersion="200"
InstallScope="perMachine"
Languages="1033"
@ -134,14 +141,13 @@ cat > wix.xml << EOF
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="${PKGINSTFOLDER}" Name="PFiles">
<Directory Id="YggdrasilInstallFolder" Name="Yggdrasil">
<Directory Id="MeshInstallFolder" Name="RiV-mesh">
<Component Id="MainExecutable" Guid="c2119231-2aa3-4962-867a-9759c87beb24">
<File
Id="Yggdrasil"
Name="yggdrasil.exe"
Id="Mesh"
Name="mesh.exe"
DiskId="1"
Source="yggdrasil.exe"
Source="mesh.exe"
KeyPath="yes" />
<File
@ -151,21 +157,21 @@ cat > wix.xml << EOF
Source="${PKGWINTUNDLL}" />
<ServiceInstall
Id="ServiceInstaller"
Id="MeshServiceInstaller"
Account="LocalSystem"
Description="Yggdrasil Network router process"
DisplayName="Yggdrasil Service"
Description="RiV-mesh Network router process"
DisplayName="RiV-mesh Service"
ErrorControl="normal"
LoadOrderGroup="NetworkProvider"
Name="Yggdrasil"
Name="Mesh"
Start="auto"
Type="ownProcess"
Arguments='-useconffile "%ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.conf" -logto "%ALLUSERSPROFILE%\\Yggdrasil\\yggdrasil.log"'
Arguments='-useconffile "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.conf" -logto "%ALLUSERSPROFILE%\\RiV-mesh\\mesh.log"'
Vital="yes" />
<ServiceControl
Id="ServiceControl"
Name="yggdrasil"
Id="MeshServiceControl"
Name="Mesh"
Start="install"
Stop="both"
Remove="uninstall" />
@ -173,13 +179,42 @@ cat > wix.xml << EOF
<Component Id="CtrlExecutable" Guid="a916b730-974d-42a1-b687-d9d504cbb86a">
<File
Id="Yggdrasilctl"
Name="yggdrasilctl.exe"
Id="Meshctl"
Name="meshctl.exe"
DiskId="1"
Source="yggdrasilctl.exe"
Source="meshctl.exe"
KeyPath="yes"/>
</Component>
<Component Id="UIExecutable" Guid="ef9f30e0-8274-4526-835b-51bc09b5b1b7">
<File
Id="MeshUI"
Name="mesh-ui.exe"
DiskId="1"
Source="mesh-ui.exe"
KeyPath="yes" />
<File
Id="WebViewHtmlFile"
Name="index.html"
DiskId="1"
Source="${PKGINDEXFILE}" />
<File
Id="WebViewDllFile"
Name="webview.dll"
DiskId="1"
Source="${PKGWEBVIEWFILE}" />
<File
Id="WebViewLoaderFile"
Name="WebView2Loader.dll"
DiskId="1"
Source="${PKGWEBVIEWFILELOADER}" />
</Component>
<Component Id="ConfigScript" Guid="64a3733b-c98a-4732-85f3-20cd7da1a785">
<File
Id="Configbat"
@ -192,20 +227,39 @@ cat > wix.xml << EOF
</Directory>
</Directory>
<Feature Id="YggdrasilFeature" Title="Yggdrasil" Level="1">
<Feature Id="MeshFeature" Title="Mesh" Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="UIExecutable" />
<ComponentRef Id="CtrlExecutable" />
<ComponentRef Id="ConfigScript" />
</Feature>
<CustomAction
Id="UpdateGenerateConfig"
Directory="YggdrasilInstallFolder"
Directory="MeshInstallFolder"
ExeCommand="cmd.exe /c updateconfig.bat"
Execute="deferred"
Return="check"
Impersonate="yes" />
<!-- Step 2: Add UI to your installer / Step 4: Trigger the custom action -->
<UI>
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch RiV-mesh" />
<!-- Step 3: Include the custom action -->
<Property Id="WixShellExecTarget" Value="[#MeshUI]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom
Action="UpdateGenerateConfig"
@ -222,4 +276,4 @@ EOF
CANDLEFLAGS="-nologo"
LIGHTFLAGS="-nologo -spdb -sice:ICE71 -sice:ICE61"
wixbin/candle $CANDLEFLAGS -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj -arch ${PKGARCH} wix.xml && \
wixbin/light $LIGHTFLAGS -ext WixUtilExtension.dll -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj
wixbin/light $LIGHTFLAGS -ext WixUIExtension -ext WixUtilExtension -out ${PKGNAME}-${PKGVERSION}-${PKGARCH}.msi ${PKGNAME}-${PKGVERSION}-${PKGARCH}.wixobj

View file

@ -2,10 +2,10 @@
description="An experiment in scalable routing as an encrypted IPv6 overlay network."
CONFFILE="/etc/yggdrasil.conf"
CONFFILE="/etc/mesh.conf"
pidfile="/run/${RC_SVCNAME}.pid"
command="/usr/bin/yggdrasil"
command="/usr/bin/mesh"
extra_started_commands="reload"
depend() {
@ -36,8 +36,8 @@ start() {
--pidfile "${pidfile}" \
--make-pidfile \
--background \
--stdout /var/log/yggdrasil.stdout.log \
--stderr /var/log/yggdrasil.stderr.log \
--stdout /var/log/mesh.stdout.log \
--stderr /var/log/mesh.stderr.log \
--exec "${command}" -- -useconffile "${CONFFILE}"
eend $?
}

View file

@ -5,7 +5,7 @@ BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
# Complain if the git history is not available
if [ $? != 0 ] || [ -z "$BRANCH" ]; then
printf "yggdrasil"
printf "mesh"
exit 0
fi
@ -14,9 +14,9 @@ BRANCH=$(echo $BRANCH | tr -d "/")
# Check if the branch name is not master
if [ "$BRANCH" = "master" ]; then
printf "yggdrasil"
printf "mesh"
exit 0
fi
# If it is something other than master, append it
printf "yggdrasil-%s" "$BRANCH"
printf "mesh-%s" "$BRANCH"

View file

@ -0,0 +1,13 @@
[Unit]
Description=mesh default config generator
ConditionPathExists=|!/etc/mesh.conf
ConditionFileNotEmpty=|!/etc/mesh.conf
Wants=local-fs.target
After=local-fs.target
[Service]
Type=oneshot
Group=mesh
StandardOutput=file:/etc/mesh.conf
ExecStart=/usr/bin/mesh -genconf
ExecStartPost=/usr/bin/chmod 0640 /etc/mesh.conf

View file

@ -1,18 +1,18 @@
[Unit]
Description=yggdrasil
Description=mesh
Wants=network.target
Wants=yggdrasil-default-config.service
Wants=mesh-default-config.service
After=network.target
After=yggdrasil-default-config.service
After=mesh-default-config.service
[Service]
Group=yggdrasil
Group=mesh
ProtectHome=true
ProtectSystem=true
SyslogIdentifier=yggdrasil
SyslogIdentifier=mesh
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE
ExecStartPre=+-/sbin/modprobe tun
ExecStart=/usr/bin/yggdrasil -useconffile /etc/yggdrasil.conf
ExecStart=/usr/bin/mesh -useconffile /etc/mesh.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
TimeoutStopSec=5

View file

@ -1,13 +0,0 @@
[Unit]
Description=yggdrasil default config generator
ConditionPathExists=|!/etc/yggdrasil.conf
ConditionFileNotEmpty=|!/etc/yggdrasil.conf
Wants=local-fs.target
After=local-fs.target
[Service]
Type=oneshot
Group=yggdrasil
StandardOutput=file:/etc/yggdrasil.conf
ExecStart=/usr/bin/yggdrasil -genconf
ExecStartPost=/usr/bin/chmod 0640 /etc/yggdrasil.conf

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

217
contrib/ui/mesh-ui/index.html Executable file
View file

@ -0,0 +1,217 @@
<!DOCTYPE html>
<html class="is-clipped">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Yggdrasil</title>
<link rel="stylesheet" href="https://maxst.icons8.com/vue-static/landings/line-awesome/font-awesome-line-awesome/css/all.min.css" type="text/css">
<link rel="stylesheet" href="https://unpkg.com/bulmaswatch/slate/bulmaswatch.min.css" type="text/css">
<script>
function setFieldValue(id, value){
var field = document.getElementById(id);
field.innerHTML = value;
}
function openTab(element, tabName) {
// Declare all variables
var i, tabContent, tabLinks;
// Get all elements with class="content" and hide them
tabContent = document.getElementsByClassName("tab here");
for (i = 0; i < tabContent.length; i++) {
tabContent[i].className = "tab here is-hidden";
}
// Get all elements with class="tab" and remove the class "is-active"
tabLinks = document.getElementsByClassName("tab is-active");
for (i = 0; i < tabLinks.length; i++) {
tabLinks[i].className = "tab";
}
// Show the current tab, and add an "is-active" class to the button that opened the tab
document.getElementById(tabName).className = "tab here";
element.parentElement.className = "tab is-active";
refreshRecordsList();
}
function copy2clipboard(text){
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
// Ensure it has a small width and height. Setting to 1px / 1em
// doesn't work as this gives a negative w/h on some browsers.
textArea.style.width = '2em';
textArea.style.height = '2em';
// We don't need padding, reducing the size if it does flash render.
textArea.style.padding = 0;
// Clean up any borders.
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
// Avoid flash of the white box if rendered for any reason.
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
} catch (err) {
console.log('Oops, unable to copy');
}
document.body.removeChild(textArea);
showInfo('value copied successfully!');
}
function showInfo(text) {
var info = document.getElementById("notification_info");
var message = document.getElementById("info_text");
message.innerHTML = text;
info.className = "notification is-primary";
var button = document.getElementById("info_close");
button.onclick = function() {
message.value = "";
info.className = "notification is-primary is-hidden";
};
setTimeout(button.onclick, 2000);
}
</script>
<style>
.container-ip {
display: flex;
border: 1px solid #5d656d;
border-radius: 4px;
margin:10px;
}
.push-right {
margin-left: auto;
}
.item {
padding: 10px;
/*border: 1px solid #5d656d;*/
}
.column {
max-height: 350px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.over {
max-height: 150px;
overflow: auto;
}
</style>
</head>
<body onload="onLoad();">
<div style="padding:3px; max-height: 250px;">
<!-- Tabs -->
<div class="tabs is-centered is-boxed">
<ul>
<li class="tab is-active">
<a onclick="openTab(this, 'my_node');">
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 42 42"><path d="M18.5 35.5l-8 2c-.48.04-1 .52-1 1v1c0 .5.47 1 1 1h20c.43 0 1-.41 1-1v-1c-.02-.52-.55-.98-1-1l-8-2h-4zm19-1c2.59 0 3-.529 3-3v-26c0-2.391-.55-3-3-3h-34c-2.43 0-3 .54-3 3v26c0 2.51.529 3 3 3h34zm-2-27v22h-30v-22h30z" fill="white"/></svg>
</span>
<span>My Node</span>
</a>
</li>
<li class="tab">
<a onclick="openTab(this, 'keys');">
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><g fill="none" stroke="white" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M5 15v15h22V15zm4 0C9 9 9 5 16 5s7 4 7 10m-7 5v3"/><circle cx="16" cy="24" r="1"/></g></svg>
</span>
<span>Keys</span>
</a>
</li>
<li class="tab">
<a onclick="openTab(this, 'about');">
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 48 48"><path fill="#2196F3" d="M37 40H11l-6 6V12c0-3.3 2.7-6 6-6h26c3.3 0 6 2.7 6 6v22c0 3.3-2.7 6-6 6z"/><g fill="#fff"><path d="M22 20h4v11h-4z"/><circle cx="24" cy="15" r="2"/></g></svg>
</span>
<span>About</span>
</a>
</li>
</ul>
</div>
<div class="tab here " id="my_node">
<div class="column">
<div class="container-ip">
<div class="item">IPv6</div>
<div id="ipv6" class="item push-right">N/A</div>
<div class="item">
<a class="fas fa-copy" onclick="copy2clipboard(document.getElementById('ipv6').innerHTML);"/></a>
</div>
</div>
<div class="container-ip">
<div class="item">Subnet</div>
<div id="subnet" class="item push-right">N/A</div>
<div class="item">
<a class="fas fa-copy" onclick="copy2clipboard(document.getElementById('subnet').innerHTML);"></a>
</div>
</div>
<div class="container-ip">
<div class="item">Peers</div>
<div id="peers" class="item over">
</div>
<div class="item push-right">
<a class="fas fa-edit"></a>
</div>
</div>
</div>
</div>
<div class="tab here is-hidden" id="keys">
</div>
</div>
</div>
<div style="margin-left: 100px; margin-right: 100px;">
<div class="notification is-primary is-hidden" id="notification_info">
<button class="delete" id="info_close"></button>
<p id="info_text"></p>
</div>
</div>
<!--div style="width: 100%; padding: 20px; box-sizing: border-box;">
<div class="buttons">
<a class="button">Save</a>
</div>
</div-->
</body>
</html>

121
contrib/ui/mesh-ui/webview.go Executable file
View file

@ -0,0 +1,121 @@
package main
import (
"github.com/webview/webview"
"path/filepath"
"io/ioutil"
"net/url"
"runtime"
"strings"
"os/exec"
"log"
"os"
"fmt"
)
func main() {
debug := true
w := webview.New(debug)
defer w.Destroy()
w.SetTitle("RiV-mesh")
w.SetSize(465, 410, webview.HintNone)
path, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
log.Fatal(err)
}
log.Println(path)
w.Bind("onLoad", func() {
log.Println("page loaded")
go run(w)
})
dat, err := ioutil.ReadFile(path+"/index.html")
w.Navigate("data:text/html,"+url.QueryEscape(string(dat)))
w.Run()
}
func run(w webview.WebView){
if runtime.GOOS == "windows" {
program_path := "programfiles"
path, exists := os.LookupEnv(program_path)
if exists {
fmt.Println("Program path: %s", path)
riv_ctrl_path := fmt.Sprintf("%s\\RiV-mesh\\meshctl.exe", path)
get_self(w, riv_ctrl_path)
get_peers(w, riv_ctrl_path)
} else {
fmt.Println("could not find Program Files path")
}
} else {
riv_ctrl_path := fmt.Sprintf("meshctl")
get_self(w, riv_ctrl_path)
get_peers(w, riv_ctrl_path)
}
}
func run_command(riv_ctrl_path string, command string) []string{
cmd := exec.Command(riv_ctrl_path, command)
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
return nil
}
lines := strings.Split(string(out), "\n")
return lines
}
func get_self(w webview.WebView, riv_ctrl_path string){
lines := run_command(riv_ctrl_path, "getSelf")
m := make(map[string]string)
for _, s := range lines {
p := strings.SplitN(s, ":", 2)
if len(p)>1 {
m[p[0]]=strings.TrimSpace(p[1])
}
}
if val, ok := m["IPv6 address"]; ok {
//found ipv6
fmt.Printf("IPv6: %s\n", val)
go setFieldValue(w, "ipv6", val)
}
if val, ok := m["IPv6 subnet"]; ok {
//found subnet
fmt.Printf("Subnet: %s\n", val)
go setFieldValue(w, "subnet", val)
}
}
func get_peers(w webview.WebView, riv_ctrl_path string){
lines := run_command(riv_ctrl_path, "getPeers")
lines = lines[1:] /*remove first element which is a header*/
var m []string
r:=""
for _, s := range lines {
p := strings.SplitN(s, " ", -1)
if len(p)>1 {
for _, t := range p {
if len(strings.TrimSpace(t))>0 {
r=strings.TrimSpace(t)
}
}
index_p := strings.Index(r, "%")
index_b := strings.Index(r, "]")
if index_p>0 && index_b>0 {
r = r[:index_p]+r[index_b:]
}
m=append(m, r)
}
}
for k := range m { // Loop
fmt.Println(k)
}
inner_html := strings.Join(m[:], "<br>")
go setFieldValue(w, "peers", inner_html)
}
func setFieldValue(p webview.WebView, id string, value string) {
p.Dispatch(func() {
p.Eval("setFieldValue('"+id+"','"+value+"');")
})
}

View file

@ -1,12 +0,0 @@
.PHONY: all
all: util yggdrasil-brute-multi-curve25519 yggdrasil-brute-multi-ed25519
util: util.c
gcc -Wall -std=c89 -O3 -c -o util.o util.c
yggdrasil-brute-multi-ed25519: yggdrasil-brute-multi-ed25519.c util.o
gcc -Wall -std=c89 -O3 -o yggdrasil-brute-multi-ed25519 -lsodium yggdrasil-brute-multi-ed25519.c util.o
yggdrasil-brute-multi-curve25519: yggdrasil-brute-multi-curve25519.c util.o
gcc -Wall -std=c89 -O3 -o yggdrasil-brute-multi-curve25519 -lsodium yggdrasil-brute-multi-curve25519.c util.o

3
go.mod
View file

@ -1,4 +1,4 @@
module github.com/yggdrasil-network/yggdrasil-go
module github.com/RiV-chain/RiV-mesh
go 1.16
@ -17,6 +17,7 @@ require (
github.com/mitchellh/mapstructure v1.4.1
github.com/vishvananda/netlink v1.1.0
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273

2
go.sum
View file

@ -38,6 +38,8 @@ github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYp
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA=
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e h1:z780M7mCrdt6KiICeW9SGirvQjxDlrVU+n99FO93nbI=
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=

View file

@ -51,12 +51,12 @@ ip netns exec node4 ip link set lo up
ip netns exec node5 ip link set lo up
ip netns exec node6 ip link set lo up
echo '{AdminListen: "none"}' | ip netns exec node1 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node2 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node3 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node4 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node5 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node6 env PPROFLISTEN=localhost:6060 ./yggdrasil --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node1 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node2 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node3 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node4 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node5 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo '{AdminListen: "none"}' | ip netns exec node6 env PPROFLISTEN=localhost:6060 ./mesh --useconf &> /dev/null &
echo "Started, to continue you should (possibly w/ sudo):"
echo "kill" $(jobs -p)

View file

@ -19,8 +19,8 @@ ip netns exec node2 tc qdisc add dev veth21 root tbf rate 10mbit burst 8192 late
ip netns exec node1 tc qdisc add dev veth12 root tbf rate 100mbit burst 8192 latency 1ms
ip netns exec node2 tc qdisc add dev veth22 root tbf rate 100mbit burst 8192 latency 1ms
echo '{AdminListen: "unix://node1.sock"}' | ip netns exec node1 env PPROFLISTEN=localhost:6060 ./yggdrasil -logging "info,warn,error,debug" -useconf &> node1.log &
echo '{AdminListen: "unix://node2.sock"}' | ip netns exec node2 env PPROFLISTEN=localhost:6060 ./yggdrasil -logging "info,warn,error,debug" -useconf &> node2.log &
echo '{AdminListen: "unix://node1.sock"}' | ip netns exec node1 env PPROFLISTEN=localhost:6060 ./mesh -logging "info,warn,error,debug" -useconf &> node1.log &
echo '{AdminListen: "unix://node2.sock"}' | ip netns exec node2 env PPROFLISTEN=localhost:6060 ./mesh -logging "info,warn,error,debug" -useconf &> node2.log &
echo "Started, to continue you should (possibly w/ sudo):"
echo "kill" $(jobs -p)

View file

@ -1,4 +1,4 @@
// Package address contains the types used by yggdrasil to represent IPv6 addresses or prefixes, as well as functions for working with these types.
// Package address contains the types used by mesh to represent IPv6 addresses or prefixes, as well as functions for working with these types.
// Of particular importance are the functions used to derive addresses or subnets from a NodeID, or to get the NodeID and bitmask of the bits visible from an address, which is needed for DHT searches.
package address
@ -6,18 +6,18 @@ import (
"crypto/ed25519"
)
// Address represents an IPv6 address in the yggdrasil address range.
// Address represents an IPv6 address in the mesh address range.
type Address [16]byte
// Subnet represents an IPv6 /64 subnet in the yggdrasil subnet range.
// Subnet represents an IPv6 /64 subnet in the mesh subnet range.
type Subnet [8]byte
// GetPrefix returns the address prefix used by yggdrasil.
// GetPrefix returns the address prefix used by mesh.
// The current implementation requires this to be a multiple of 8 bits + 7 bits.
// The 8th bit of the last byte is used to signal nodes (0) or /64 prefixes (1).
// Nodes that configure this differently will be unable to communicate with each other using IP packets, though routing and the DHT machinery *should* still work.
func GetPrefix() [1]byte {
return [...]byte{0x02}
return [...]byte{0xfc}
}
// IsValid returns true if an address falls within the range used by nodes in the network.

View file

@ -13,8 +13,8 @@ import (
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/core"
"github.com/RiV-chain/RiV-mesh/src/config"
"github.com/RiV-chain/RiV-mesh/src/core"
)
// TODO: Add authentication

View file

@ -4,7 +4,7 @@ import (
"encoding/hex"
"net"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
type GetDHTRequest struct{}

View file

@ -4,7 +4,7 @@ import (
"encoding/hex"
"net"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
type GetPathsRequest struct {

View file

@ -4,7 +4,7 @@ import (
"encoding/hex"
"net"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
type GetPeersRequest struct {

View file

@ -3,7 +3,7 @@ package admin
import (
"encoding/hex"
"github.com/yggdrasil-network/yggdrasil-go/src/version"
"github.com/RiV-chain/RiV-mesh/src/version"
)
type GetSelfRequest struct{}

View file

@ -4,7 +4,7 @@ import (
"encoding/hex"
"net"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
type GetSessionsRequest struct{}

View file

@ -1,6 +1,6 @@
/*
The config package contains structures related to the configuration of an
Yggdrasil node.
Mesh node.
The configuration contains, amongst other things, encryption keys which are used
to derive a node's identity, information about peerings and node information
@ -11,7 +11,7 @@ In order for a node to maintain the same identity across restarts, you should
persist the configuration onto the filesystem or into some configuration storage
so that the encryption keys (and therefore the node ID) do not change.
Note that Yggdrasil will automatically populate sane defaults for any
Note that Mesh will automatically populate sane defaults for any
configuration option that is not provided.
*/
package config
@ -23,21 +23,21 @@ import (
)
// NodeConfig is the main configuration structure, containing configuration
// options that are necessary for an Yggdrasil node to run. You will need to
// supply one of these structs to the Yggdrasil core when starting a node.
// options that are necessary for an Mesh node to run. You will need to
// supply one of these structs to the Mesh core when starting a node.
type NodeConfig struct {
sync.RWMutex `json:"-"`
Peers []string `comment:"List of connection strings for outbound peer connections in URI format,\ne.g. tls://a.b.c.d:e or socks://a.b.c.d:e/f.g.h.i:j. These connections\nwill obey the operating system routing table, therefore you should\nuse this section when you may connect via different interfaces."`
InterfacePeers map[string][]string `comment:"List of connection strings for outbound peer connections in URI format,\narranged by source interface, e.g. { \"eth0\": [ tls://a.b.c.d:e ] }.\nNote that SOCKS peerings will NOT be affected by this option and should\ngo in the \"Peers\" section instead."`
Listen []string `comment:"Listen addresses for incoming connections. You will need to add\nlisteners in order to accept incoming peerings from non-local nodes.\nMulticast peer discovery will work regardless of any listeners set\nhere. Each listener should be specified in URI format as above, e.g.\ntls://0.0.0.0:0 or tls://[::]:0 to listen on all interfaces."`
AdminListen string `comment:"Listen address for admin connections. Default is to listen for local\nconnections either on TCP/9001 or a UNIX socket depending on your\nplatform. Use this value for yggdrasilctl -endpoint=X. To disable\nthe admin socket, use the value \"none\" instead."`
AdminListen string `comment:"Listen address for admin connections. Default is to listen for local\nconnections either on TCP/9001 or a UNIX socket depending on your\nplatform. Use this value for meshctl -endpoint=X. To disable\nthe admin socket, use the value \"none\" instead."`
MulticastInterfaces []MulticastInterfaceConfig `comment:"Configuration for which interfaces multicast peer discovery should be\nenabled on. Each entry in the list should be a json object which may\ncontain Regex, Beacon, Listen, and Port. Regex is a regular expression\nwhich is matched against an interface name, and interfaces use the\nfirst configuration that they match gainst. Beacon configures whether\nor not the node should send link-local multicast beacons to advertise\ntheir presence, while listening for incoming connections on Port.\nListen controls whether or not the node listens for multicast beacons\nand opens outgoing connections."`
AllowedPublicKeys []string `comment:"List of peer public keys to allow incoming peering connections\nfrom. If left empty/undefined then all connections will be allowed\nby default. This does not affect outgoing peerings, nor does it\naffect link-local peers discovered via multicast."`
PublicKey string `comment:"Your public key. Your peers may ask you for this to put\ninto their AllowedPublicKeys configuration."`
PrivateKey string `comment:"Your private key. DO NOT share this with anyone!"`
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and Yggdrasil version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and Mesh version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`
NodeInfo map[string]interface{} `comment:"Optional node info. This must be a { \"key\": \"value\", ... } map\nor set as null. This is entirely optional but, if set, is visible\nto the whole network on request."`
}

View file

@ -12,8 +12,8 @@ import (
//"time"
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
//"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/RiV-chain/RiV-mesh/src/address"
//"github.com/RiV-chain/RiV-mesh/src/crypto"
//"github.com/Arceliar/phony"
)
@ -122,7 +122,7 @@ func (c *Core) Listen(u *url.URL, sintf string) (*TcpListener, error) {
return c.links.tcp.listenURL(u, sintf)
}
// Address gets the IPv6 address of the Yggdrasil node. This is always a /128
// Address gets the IPv6 address of the Mesh node. This is always a /128
// address. The IPv6 address is only relevant when the node is operating as an
// IP router and often is meaningless when embedded into an application, unless
// that application also implements either VPN functionality or deals with IP
@ -132,7 +132,7 @@ func (c *Core) Address() net.IP {
return addr
}
// Subnet gets the routed IPv6 subnet of the Yggdrasil node. This is always a
// Subnet gets the routed IPv6 subnet of the Mesh node. This is always a
// /64 subnet. The IPv6 subnet is only relevant when the node is operating as an
// IP router and often is meaningless when embedded into an application, unless
// that application also implements either VPN functionality or deals with IP
@ -143,7 +143,7 @@ func (c *Core) Subnet() net.IPNet {
return net.IPNet{IP: subnet, Mask: net.CIDRMask(64, 128)}
}
// SetLogger sets the output logger of the Yggdrasil node after startup. This
// SetLogger sets the output logger of the Mesh node after startup. This
// may be useful if you want to redirect the output later. Note that this
// expects a Logger from the github.com/gologme/log package and not from Go's
// built-in log package.

View file

@ -16,13 +16,13 @@ import (
"github.com/Arceliar/phony"
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
//"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/yggdrasil-network/yggdrasil-go/src/version"
"github.com/RiV-chain/RiV-mesh/src/config"
//"github.com/RiV-chain/RiV-mesh/src/crypto"
"github.com/RiV-chain/RiV-mesh/src/version"
)
// The Core object represents the Yggdrasil node. You should create a Core
// object for each Yggdrasil node you plan to run.
// The Core object represents the Mesh node. You should create a Core
// object for each Mesh node you plan to run.
type Core struct {
// This is the main data structure that holds everything else for a node
// We're going to keep our own copy of the provided config - that way we can
@ -116,7 +116,7 @@ func (c *Core) _addPeerLoop() {
})
}
// Start starts up Yggdrasil using the provided config.NodeConfig, and outputs
// Start starts up Mesh using the provided config.NodeConfig, and outputs
// debug logging through the provided log.Logger. The started stack will include
// TCP and UDP sockets, a multicast discovery socket, an admin socket, router,
// switch and DHT node. A config.NodeState is returned which contains both the
@ -159,7 +159,7 @@ func (c *Core) _start(nc *config.NodeConfig, log *log.Logger) error {
return nil
}
// Stop shuts down the Yggdrasil node.
// Stop shuts down the Mesh node.
func (c *Core) Stop() {
phony.Block(c, func() {
c.log.Infoln("Stopping...")

View file

@ -10,8 +10,8 @@ import (
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"github.com/RiV-chain/RiV-mesh/src/config"
"github.com/RiV-chain/RiV-mesh/src/defaults"
)
// GenerateConfig produces default configuration with suitable modifications for tests.

View file

@ -14,8 +14,8 @@ import (
//"sync/atomic"
"time"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/util"
"github.com/RiV-chain/RiV-mesh/src/address"
"github.com/RiV-chain/RiV-mesh/src/util"
"golang.org/x/net/proxy"
//"github.com/Arceliar/phony" // TODO? use instead of mutexes
)

View file

@ -12,9 +12,9 @@ import (
iwt "github.com/Arceliar/ironwood/types"
"github.com/Arceliar/phony"
//"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/version"
//"github.com/RiV-chain/RiV-mesh/src/crypto"
"github.com/RiV-chain/RiV-mesh/src/address"
"github.com/RiV-chain/RiV-mesh/src/version"
)
// NodeInfoPayload represents a RequestNodeInfo response, in bytes.

View file

@ -12,7 +12,7 @@ import (
iwt "github.com/Arceliar/ironwood/types"
"github.com/Arceliar/phony"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/RiV-chain/RiV-mesh/src/address"
)
const (

View file

@ -26,8 +26,8 @@ import (
"golang.org/x/net/proxy"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
//"github.com/yggdrasil-network/yggdrasil-go/src/util"
"github.com/RiV-chain/RiV-mesh/src/address"
//"github.com/RiV-chain/RiV-mesh/src/util"
)
const default_timeout = 6 * time.Second

View file

@ -20,7 +20,7 @@ type version_metadata struct {
// Gets a base metadata with no keys set, but with the correct version numbers.
func version_getBaseMetadata() version_metadata {
return version_metadata{
meta: [4]byte{'m', 'e', 't', 'a'},
meta: [4]byte{'z', 'e', 't', 'a'},
ver: 0,
minorVer: 4,
}

View file

@ -1,6 +1,6 @@
package defaults
import "github.com/yggdrasil-network/yggdrasil-go/src/config"
import "github.com/RiV-chain/RiV-mesh/src/config"
type MulticastInterfaceConfig = config.MulticastInterfaceConfig
@ -11,7 +11,7 @@ type platformDefaultParameters struct {
// Admin socket
DefaultAdminListen string
// Configuration (used for yggdrasilctl)
// Configuration (used for meshctl)
DefaultConfigFile string
// Multicast interfaces

View file

@ -7,10 +7,10 @@ package defaults
func GetDefaults() platformDefaultParameters {
return platformDefaultParameters{
// Admin
DefaultAdminListen: "unix:///var/run/yggdrasil.sock",
DefaultAdminListen: "unix:///var/run/mesh.sock",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "/etc/yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "/etc/mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{

View file

@ -7,10 +7,10 @@ package defaults
func GetDefaults() platformDefaultParameters {
return platformDefaultParameters{
// Admin
DefaultAdminListen: "unix:///var/run/yggdrasil.sock",
DefaultAdminListen: "unix:///var/run/mesh.sock",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "/usr/local/etc/yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "/usr/local/etc/mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{

View file

@ -7,10 +7,10 @@ package defaults
func GetDefaults() platformDefaultParameters {
return platformDefaultParameters{
// Admin
DefaultAdminListen: "unix:///var/run/yggdrasil.sock",
DefaultAdminListen: "unix:///var/run/mesh.sock",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "/etc/yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "/etc/mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{

View file

@ -7,10 +7,10 @@ package defaults
func GetDefaults() platformDefaultParameters {
return platformDefaultParameters{
// Admin
DefaultAdminListen: "unix:///var/run/yggdrasil.sock",
DefaultAdminListen: "unix:///var/run/mesh.sock",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "/etc/yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "/etc/mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{

View file

@ -9,8 +9,8 @@ func GetDefaults() platformDefaultParameters {
// Admin
DefaultAdminListen: "tcp://localhost:9001",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "/etc/yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "/etc/mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{

View file

@ -9,8 +9,8 @@ func GetDefaults() platformDefaultParameters {
// Admin
DefaultAdminListen: "tcp://localhost:9001",
// Configuration (used for yggdrasilctl)
DefaultConfigFile: "C:\\Program Files\\Yggdrasil\\yggdrasil.conf",
// Configuration (used for meshctl)
DefaultConfigFile: "C:\\Program Files\\Mesh\\mesh.conf",
// Multicast interfaces
DefaultMulticastInterfaces: []MulticastInterfaceConfig{
@ -20,6 +20,6 @@ func GetDefaults() platformDefaultParameters {
// TUN/TAP
MaximumIfMTU: 65535,
DefaultIfMTU: 65535,
DefaultIfName: "Yggdrasil",
DefaultIfName: "Mesh",
}
}

View file

@ -13,8 +13,8 @@ import (
iwt "github.com/Arceliar/ironwood/types"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/core"
"github.com/RiV-chain/RiV-mesh/src/address"
"github.com/RiV-chain/RiV-mesh/src/core"
)
const keyStoreTimeout = 2 * time.Minute

View file

@ -3,7 +3,7 @@ package multicast
import (
"encoding/json"
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
"github.com/RiV-chain/RiV-mesh/src/admin"
)
type GetMulticastInterfacesRequest struct{}

View file

@ -15,14 +15,14 @@ import (
"github.com/Arceliar/phony"
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/core"
"github.com/RiV-chain/RiV-mesh/src/config"
"github.com/RiV-chain/RiV-mesh/src/core"
"golang.org/x/net/ipv6"
)
// Multicast represents the multicast advertisement and discovery mechanism used
// by Yggdrasil to find peers on the same subnet. When a beacon is received on a
// configured multicast interface, Yggdrasil will attempt to peer with that node
// by Mesh to find peers on the same subnet. When a beacon is received on a
// configured multicast interface, Mesh will attempt to peer with that node
// automatically.
type Multicast struct {
phony.Inbox

View file

@ -12,7 +12,7 @@ void StartAWDLBrowsing() {
serviceBrowser = [[NSNetServiceBrowser alloc] init];
serviceBrowser.includesPeerToPeer = YES;
}
[serviceBrowser searchForServicesOfType:@"_yggdrasil._tcp" inDomain:@""];
[serviceBrowser searchForServicesOfType:@"_mesh._tcp" inDomain:@""];
}
void StopAWDLBrowsing() {
if (serviceBrowser == nil) {

View file

@ -3,7 +3,7 @@ package tuntap
import (
"encoding/json"
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
"github.com/RiV-chain/RiV-mesh/src/admin"
)
type GetTUNRequest struct{}

View file

@ -19,18 +19,18 @@ import (
"github.com/gologme/log"
"golang.zx2c4.com/wireguard/tun"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"github.com/yggdrasil-network/yggdrasil-go/src/ipv6rwc"
"github.com/RiV-chain/RiV-mesh/src/address"
"github.com/RiV-chain/RiV-mesh/src/config"
"github.com/RiV-chain/RiV-mesh/src/defaults"
"github.com/RiV-chain/RiV-mesh/src/ipv6rwc"
)
type MTU uint16
// TunAdapter represents a running TUN interface and extends the
// yggdrasil.Adapter type. In order to use the TUN adapter with Yggdrasil, you
// should pass this object to the yggdrasil.SetRouterAdapter() function before
// calling yggdrasil.Start().
// mesh.Adapter type. In order to use the TUN adapter with Mesh, you
// should pass this object to the mesh.SetRouterAdapter() function before
// calling mesh.Start().
type TunAdapter struct {
rwc *ipv6rwc.ReadWriteCloser
config *config.NodeConfig
@ -92,7 +92,7 @@ func MaximumMTU() uint64 {
}
// Init initialises the TUN module. You must have acquired a Listener from
// the Yggdrasil core before this point and it must not be in use elsewhere.
// the Mesh core before this point and it must not be in use elsewhere.
func (tun *TunAdapter) Init(rwc *ipv6rwc.ReadWriteCloser, config *config.NodeConfig, log *log.Logger, options interface{}) error {
tun.rwc = rwc
tun.config = config

View file

@ -8,7 +8,7 @@ import (
"log"
"net"
"github.com/yggdrasil-network/yggdrasil-go/src/defaults"
"github.com/RiV-chain/RiV-mesh/src/defaults"
"golang.org/x/sys/windows"
wgtun "golang.zx2c4.com/wireguard/tun"

View file

@ -1,4 +1,4 @@
// Package util contains miscellaneous utilities used by yggdrasil.
// Package util contains miscellaneous utilities used by mesh.
// In particular, this includes a crypto worker pool, Cancellation machinery, and a sync.Pool used to reuse []byte.
package util