1. added multipath protocol and schema suport

2. added SCTP protocol and schema support
3. added set of NAS models support (Asustor, ReadyNAS, Drobo, QNAP, WD, Synology, Terramaster)
4. moved to fc00::/7 private segment
5. added Windows, MacOS and Linux UI for peers edit and current status
This commit is contained in:
vadym 2022-10-27 22:03:37 +03:00
parent cfa293d189
commit d8a4000141
198 changed files with 8589 additions and 697 deletions

View file

@ -0,0 +1,4 @@
#!/bin/sh
. $(dirname $0)/scripts.sh
_install

View file

@ -0,0 +1,20 @@
RedirectMatch 301 ^/mesh$ /mesh/
LoadModule proxy_http_module modules/mod_proxy_http.so
<Location /mesh/>
AuthType Form
AuthName "DroboApps"
AuthUserFile /tmp/DroboApps/apache/htpasswd
AuthFormProvider file
ErrorDocument 401 /login/index.html
Session On
SessionCookieName session path=/
SessionCryptoPassphrase "exec:/mnt/DroboFS/Shares/DroboApps/apache/libexec/cookie.sh"
Require valid-user
ProxyPreserveHost On
ProxyPass "http://127.0.0.1:19019/"
ProxyPassReverse "http://127.0.0.1:19019/"
</Location>

View file

@ -0,0 +1,40 @@
#!/usr/bin/env sh
tmpdir="/tmp/DroboApps/mesh"
errorfile="${tmpdir}/error.txt"
base_dir="/mnt/DroboFS/Shares/DroboApps/mesh"
config_dir="$base_dir/config"
config_file="$config_dir/mesh.conf"
prog_dir="$(dirname "$(realpath "${0}")")"
_install() {
if [ ! -f "${errorfile}" ]
then
mkdir -p "${tmpdir}"
if [ ! -f "$config_file" ]; then
echo 3 > "${errorfile}"
fi
fi
ln -s $base_dir/var/log/mesh.log $base_dir/www/log
# install apache 2.x
/usr/bin/DroboApps.sh install_version apache 2
}
_uninstall() {
pid=`pidof -s mesh`
if [ -z "$pid" ]; then
echo "mesh was not running"
else
kill "$pid"
fi
}
_update() {
/bin/sh "${prog_dir}/service.sh" stop
cd "$base_dir"
rm -rf $(ls | grep -v 'host_uid.txt\|var\|config')
echo 'update successful' > "${prog_dir}/update.log"
}

View file

@ -0,0 +1,121 @@
#!/bin/sh
#
##!!
. /etc/service.subr
prog_dir=`dirname \`realpath $0\``
base_dir=/mnt/DroboFS/Shares/DroboApps/mesh
config_dir="$base_dir/config"
config_file="$config_dir/mesh.conf"
name="mesh"
framework_version="2.1"
description="RiV-mesh is an implementation of a fully end-to-end encrypted IPv6 network"
depends=""
webui="WebUI"
errorfile=/tmp/DroboApps/mesh/error.txt
pidfile=/tmp/DroboApps/mesh/pid.txt
statusfile=/tmp/DroboApps/mesh/status.txt
edstatusfile=$base_dir/var/lib/mesh/status
start()
{
mkdir -p /tmp/DroboApps/mesh
# delete edstatufile before starting daemon to delete previous status
rm -f $edstatusfile
rm -f $errorfile
if [ -f $config_file ]; then
mkdir -p /var/backups
echo "Backing up configuration file to /var/backups/mesh.conf.`date +%Y%m%d`"
cp $config_file /var/backups/mesh.conf.`date +%Y%m%d`
echo "Normalising and updating /etc/mesh.conf"
$base_dir/bin/mesh -useconf -normaliseconf < /var/backups/mesh.conf.`date +%Y%m%d` > $config_file
else
mkdir -p $config_dir
echo "Generating initial configuration file $config_file"
echo "Please familiarise yourself with this file before starting RiV-mesh"
sh -c "umask 0027 && $base_dir/bin/mesh -genconf > '$config_file'"
fi
# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
if ( [ ! -d /dev/net ] ); then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
chmod 0755 /dev/net/tun
fi
# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
KERNEL_VERSION=$(/bin/uname -r)
insmod $base_dir/lib/modules/$KERNEL_VERSION/tun.ko
fi
# Launch the mesh in the background.
${base_dir}/bin/mesh -useconffile "$config_file" \
-httpaddress "http://localhost:19019" \
-wwwroot "$base_dir/www" \
-logto "$base_dir/var/log/mesh.log" &
sleep 1
update_status
}
update_status()
{
# wait until file appears
i=30
while [ -z $(pidof -s mesh) ]
do
sleep 1
i=$((i-1))
if [ $i -eq 0 ]
then
break
fi
done
# if we don't have file here. throw error into status and return
if [ -z $(pidof -s mesh) ]
then
echo "" > "$pidfile"
echo 1 > "${errorfile}"
echo "Configuration required" > $statusfile
else
echo $(pidof -s mesh) > "$pidfile"
echo 0 > "${errorfile}"
echo "Application is running" > $statusfile
fi
}
stop()
{
pid=`pidof -s mesh`
if [ -z "$pid" ]; then
echo 1 > "${errorfile}"
echo "mesh was not running" > $statusfile
else
kill "$pid"
echo 0 > "${errorfile}"
echo "Application is stopped" > $statusfile
fi
echo "" > "$pidfile"
}
case "$1" in
update_status)
update_status
exit $?
;;
esac
main "$@"

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
#
. $(dirname $0)/scripts.sh
_uninstall

View file

@ -0,0 +1,3 @@
#!/bin/sh
. $(dirname $0)/scripts.sh
_update

View file

@ -0,0 +1,16 @@
#!/bin/sh
echo vendor=Drobo
# get device model, e.g., "5N"
_get_device_model() {
for f in /sys/devices/dri_dnas_primary/dnas_adp_1/host*/target*/*:*:*:*/model; do
if [ -e "$f" ]; then
cat "$f"
return
fi
done
}
echo serial=$(cat /mnt/DroboFS/Shares/DroboApps/mesh/host_uid.txt)
echo firmwareVersion=$(/usr/bin/esa vxver)
echo model=$(_get_device_model)

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View file

@ -0,0 +1,25 @@
body {
color: gray;
background: black;
}
.nas-apps-config-form-message.nas-apps-config-form-message-error {
color: white;
}
/* bottom */
.nas-apps-config-form-partner-logo {
width: 200px;
height: 82px;
margin: 0 auto;
}
.nas-apps-config-form-auth-id,
.nas-apps-config-form-location-name {
color: white;
}
.nas-apps-config-form-field input,
.nas-apps-config-form-field select {
color: white;
}
.nas-apps-config-form-field select:focus option {
background: white;
}

View file

@ -0,0 +1,9 @@
var ed = {
partnerId: 1046,
brand: 'RiV Mesh',
applicationName: "RiV Mesh Drobo App",
nasOSName: "Drobo",
nasVisitEDWebsiteLogin: "https://github.com/RiV-chain/RiV-mesh",
nasVisitEDWebsiteSignup: "https://github.com/RiV-chain/RiV-mesh",
nasVisitEDWebsiteLoggedin: "https://github.com/RiV-chain/RiV-mesh"
};