mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	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:
		
							parent
							
								
									cfa293d189
								
							
						
					
					
						commit
						d8a4000141
					
				
					 198 changed files with 8589 additions and 697 deletions
				
			
		
							
								
								
									
										10
									
								
								contrib/ui/nas-terramaster/mesh/config.ini
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								contrib/ui/nas-terramaster/mesh/config.ini
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{
 | 
			
		||||
"path": "/module/?mod=4.Application/21.mesh.php&t=0",
 | 
			
		||||
"id": "mesh",
 | 
			
		||||
"exec": 1,
 | 
			
		||||
"hideTitle": 1,
 | 
			
		||||
"width": 900,
 | 
			
		||||
"height": 580,
 | 
			
		||||
"icon": "/images/icons/mesh.svg",
 | 
			
		||||
"content": "core.appNormal();"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										74
									
								
								contrib/ui/nas-terramaster/mesh/etc/init.d/mesh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										74
									
								
								contrib/ui/nas-terramaster/mesh/etc/init.d/mesh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
BASE="/usr"
 | 
			
		||||
CONFIG_DIR="/etc"
 | 
			
		||||
config_file="$CONFIG_DIR/mesh.conf"
 | 
			
		||||
LOG_FILE="$BASE/var/log/mesh.log"
 | 
			
		||||
 | 
			
		||||
service_status()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    pid=`pidof -s mesh`
 | 
			
		||||
 | 
			
		||||
    if [[ ! -z "${pid}" ]] && [ -d /proc/${pid} ]; then
 | 
			
		||||
        echo "mesh running"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
    echo "mesh stopped"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service_start(){
 | 
			
		||||
 | 
			
		||||
    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}/bin/mesh -useconf -normaliseconf < /var/backups/mesh.conf.`date +%Y%m%d` > $config_file
 | 
			
		||||
    else
 | 
			
		||||
       echo "Generating initial configuration file $config_file"
 | 
			
		||||
       echo "Please familiarise yourself with this file before starting RiV-mesh"
 | 
			
		||||
       sh -c "umask 0027 && ${BASE}/bin/mesh -genconf > '$config_file'"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Launch the server in the background.
 | 
			
		||||
    ${BASE}/bin/mesh -useconffile "$config_file" \
 | 
			
		||||
    -httpaddress "http://127.0.0.1:19019" \
 | 
			
		||||
    -wwwroot "/usr/local/mesh/www" \
 | 
			
		||||
    -logto "$BASE/var/log/mesh.log" &
 | 
			
		||||
 | 
			
		||||
    service nginx reload
 | 
			
		||||
    sleep 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service_stop(){
 | 
			
		||||
    pid=`pidof -s mesh`
 | 
			
		||||
    if [ -z "$pid" ]; then
 | 
			
		||||
      echo "mesh was not running"
 | 
			
		||||
      exit 0
 | 
			
		||||
    fi
 | 
			
		||||
    kill "$pid"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
service_restart(){
 | 
			
		||||
	service_stop
 | 
			
		||||
	service_start
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
case $1 in
 | 
			
		||||
        start)
 | 
			
		||||
                service_start
 | 
			
		||||
                exit 0 ;;
 | 
			
		||||
        stop)
 | 
			
		||||
                service_stop
 | 
			
		||||
                exit 0 ;;
 | 
			
		||||
        restart)
 | 
			
		||||
                service_restart
 | 
			
		||||
                exit 0 ;;
 | 
			
		||||
        status)
 | 
			
		||||
                service_status
 | 
			
		||||
                exit 0 ;;
 | 
			
		||||
        *)
 | 
			
		||||
                echo "Usage: `basename $0` {start|stop|restart|status}"
 | 
			
		||||
                exit 1 ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
location ~ ^/mesh/ { 
 | 
			
		||||
	rewrite    ^/mesh/(.*) /$1 break;    
 | 
			
		||||
	proxy_pass http://127.0.0.1:19019;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								contrib/ui/nas-terramaster/mesh/mesh.lang
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								contrib/ui/nas-terramaster/mesh/mesh.lang
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
[zh-cn]
 | 
			
		||||
name = "RiV Mesh"
 | 
			
		||||
auth = "mesh"
 | 
			
		||||
version = "%%VERSION%%"
 | 
			
		||||
descript = "RiV-mesh is an implementation of a fully end-to-end encrypted IPv6 network."
 | 
			
		||||
 | 
			
		||||
[en-us]
 | 
			
		||||
name = "RiV Mesh"
 | 
			
		||||
auth = "mesh"
 | 
			
		||||
version = "%%VERSION%%"
 | 
			
		||||
descript = "RiV-mesh is an implementation of a fully end-to-end encrypted IPv6 network."
 | 
			
		||||
							
								
								
									
										1
									
								
								contrib/ui/nas-terramaster/mesh/remove_list
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								contrib/ui/nas-terramaster/mesh/remove_list
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
/usr/www/mesh
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
echo vendor=TerraMaster
 | 
			
		||||
echo vendorOperatingSystemName=TerraMaster TOS
 | 
			
		||||
echo firmwareVersion=$(awk -F= '$1 ~ /version/ {print $2}' /etc/tos.conf)
 | 
			
		||||
#echo model=
 | 
			
		||||
#echo serial=
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 313 B  | 
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
var ed = {
 | 
			
		||||
	partnerId: 1599,
 | 
			
		||||
	brand: 'RiV Mesh',
 | 
			
		||||
	applicationName: 'RiV Mesh TerraMaster App',
 | 
			
		||||
	nasOSName: 'TerraMaster NAS',
 | 
			
		||||
	nasVisitEDWebsiteLogin: "https://github.com/RiV-chain/RiV-mesh",
 | 
			
		||||
	nasVisitEDWebsiteSignup: "https://github.com/RiV-chain/RiV-mesh",
 | 
			
		||||
	nasVisitEDWebsiteLoggedin: "https://github.com/RiV-chain/RiV-mesh",
 | 
			
		||||
	signingUpMessageHtml: "",
 | 
			
		||||
	signingUpPropositionMessageHtml: ""
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										17
									
								
								contrib/ui/nas-terramaster/mesh/usr/www/css/style-mesh.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								contrib/ui/nas-terramaster/mesh/usr/www/css/style-mesh.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
.plex{}
 | 
			
		||||
.plex .header{border:none;height:150px;padding:20px 0 30px;box-sizing:border-box;}
 | 
			
		||||
.plex .header .logo{margin:0px auto;width:300px;height:100px;display:block;outline:none;background: url(../images/ext/plex-logo.svg) #8B6161 center center no-repeat;background-size:90%;}
 | 
			
		||||
.plex .introduce{width:520px;margin:0 auto;line-height:24px;font-size:16px;}
 | 
			
		||||
.plex .introduce *{line-height:24px;font-size:16px;}
 | 
			
		||||
.plex .introduce i{display: table-row;font-size:24px;font-style: normal;line-height:40px;}
 | 
			
		||||
.heder-info{display: table;width: 85%;margin: 0 auto;}
 | 
			
		||||
.logo-info{display: table-cell;width: 70%;vertical-align: middle;}
 | 
			
		||||
.logo-info img{width: 10%;float: left;}
 | 
			
		||||
.logo-info figcaption{height: 45px;float: left;line-height: 45px;font-size: 30px;margin-left: 10px;}
 | 
			
		||||
.v-info{display: table-cell;}
 | 
			
		||||
.v-info p{margin: 0;padding: 0;}
 | 
			
		||||
.intr{display: table;width: 85%;margin: 0 auto;margin-top: 8px;margin-bottom: 50px;}
 | 
			
		||||
.btn-info-no{line-height: 1;height: 30px;padding: 0 15px;background-color: rgb(255,255,255);border: 1px solid rgb(210,210,210); color: rgb(120,120,120);position: relative;z-index: 200;}
 | 
			
		||||
.btn-info-no:active{color: rgb(60,60,60);border-color: rgb(138,138,138);}
 | 
			
		||||
.btn-info-no:hover{color: rgb(60,60,60);border-color: rgb(138,138,138);}
 | 
			
		||||
.fieldset:first-child{padding-top: 0 !important;}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
class mesh extends core{
 | 
			
		||||
    private static $execute = "/etc/init.d/mesh";
 | 
			
		||||
 | 
			
		||||
    function _status()
 | 
			
		||||
    {
 | 
			
		||||
        if(file_exists(self::$execute)){
 | 
			
		||||
            $ret = $this->fun->_exec(self::$execute." status");
 | 
			
		||||
            if(strstr($ret, "running")){
 | 
			
		||||
                return 1;
 | 
			
		||||
            }else{
 | 
			
		||||
                return 0;
 | 
			
		||||
            }
 | 
			
		||||
        }else{
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function _switch($stat)
 | 
			
		||||
    {
 | 
			
		||||
        if($stat == 1){
 | 
			
		||||
            $this->_sysAutoEvent(basename(self::$execute), true);
 | 
			
		||||
            $this->fun->_backexec(self::$execute." start");
 | 
			
		||||
        }else{
 | 
			
		||||
            $this->_sysAutoEvent(basename(self::$execute), false);
 | 
			
		||||
            $this->fun->_exec(self::$execute." stop");
 | 
			
		||||
        }
 | 
			
		||||
        sleep(1);
 | 
			
		||||
        $ret = $this->_status();
 | 
			
		||||
        return $ret;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								contrib/ui/nas-terramaster/mesh/usr/www/lang/ext/mesh.lang
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								contrib/ui/nas-terramaster/mesh/usr/www/lang/ext/mesh.lang
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
[zh-cn]
 | 
			
		||||
mesh = "RiV Mesh"
 | 
			
		||||
auth = "Riv Chain ltd"
 | 
			
		||||
tos_mesh_note = "RiV-mesh 是完全端到端加密 IPv6 網絡的實現"
 | 
			
		||||
enter = "进入"
 | 
			
		||||
 | 
			
		||||
[en-us]
 | 
			
		||||
mesh = "RiV Mesh"
 | 
			
		||||
auth = "Riv Chain ltd"
 | 
			
		||||
tos_mesh_note = "RiV-mesh is an implementation of a fully end-to-end encrypted IPv6 network."
 | 
			
		||||
enter = "Enter"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,93 @@
 | 
			
		|||
<?php
 | 
			
		||||
include_once "../../include/app.php";
 | 
			
		||||
$mesh = new mesh();
 | 
			
		||||
$status = $mesh->_status();
 | 
			
		||||
$app_info = $mesh->get_app_info('mesh');
 | 
			
		||||
$L = $La->extlanguage("mesh");
 | 
			
		||||
$url = "http://".$_SERVER['SERVER_ADDR'].":8181/mesh/";
 | 
			
		||||
?>
 | 
			
		||||
<!DOCTYPE HTML>
 | 
			
		||||
<html>
 | 
			
		||||
<!--head>
 | 
			
		||||
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
 | 
			
		||||
    <title>mesh</title>
 | 
			
		||||
    <link href="../../css/base.css?v=<?=mt_rand()?>" rel="stylesheet" type="text/css">
 | 
			
		||||
    <link href="../../css/style-mesh.css?v=<?=mt_rand()?>" rel="stylesheet" type="text/css">
 | 
			
		||||
    <script src="../../js/jquery.js"></script>
 | 
			
		||||
    <script src="../../js/common.js?v=<?=mt_rand()?>"></script>
 | 
			
		||||
    <script>
 | 
			
		||||
        $.getScript("/js/lib/cTools.js", function () {
 | 
			
		||||
            var ajaxload_callback = new cTools();
 | 
			
		||||
        });
 | 
			
		||||
    </script>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
<header class="heder-info">
 | 
			
		||||
    <div class="logo-info">
 | 
			
		||||
        <figure>
 | 
			
		||||
            <img src="../../images/icons/mesh.png">
 | 
			
		||||
            <figcaption><?=$L['mesh']?></figcaption>
 | 
			
		||||
        </figure>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="v-info">
 | 
			
		||||
        <p><span style="display:inline-block;text-align:right;padding-right:10px;"><?php echo $root['meto']['app_version']?>:</span><span><?php echo $app_info['version']?></span></p>
 | 
			
		||||
        <p><span style="display:inline-block;text-align:right;padding-right:10px;"><?php echo $root['meto']['app_auth']?>:</span><span><?php echo $app_info['auth']?></span></p>
 | 
			
		||||
        <p><span style="display:inline-block;text-align:right;padding-right:10px;"><?php echo $root['meto']['app_publisher']?>:</span><span>TerraMaster</span></p>
 | 
			
		||||
    </div>
 | 
			
		||||
</header>
 | 
			
		||||
<div class="intr">
 | 
			
		||||
    <p><?=$L["tos_mesh_note"]?></p>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="mainbox" style="width: 85%;margin: 0 auto;">
 | 
			
		||||
    <div class="conLine">
 | 
			
		||||
        <div class="item col-select">
 | 
			
		||||
            <input  type="checkbox" name="is_check" mode="tos"  <?php if ($status == 1){echo 'checked';}?> />
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="item col-main"><?php echo $root['basic']['basic_enable']?> mesh</div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <?php if ($status ==1){?>
 | 
			
		||||
    <p style="padding-left: 30px;margin-top: 15px;"><button id="_location" class="btn-info-no"><?=$L["enter"]?> mesh</button></p>
 | 
			
		||||
    <?php }?>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="buttons">
 | 
			
		||||
    <span class="showAction"></span>
 | 
			
		||||
    <button class="button"><?=$root["common"]["save"]?></button>
 | 
			
		||||
</div-->
 | 
			
		||||
<iframe src="<?=$url?>" width="100%" height="500" align="left" style="
 | 
			
		||||
    border-top-width: 0px;
 | 
			
		||||
    border-left-width: 0px;
 | 
			
		||||
    border-right-width: 0px;
 | 
			
		||||
    border-bottom-width: 0px;
 | 
			
		||||
">
 | 
			
		||||
	 Floating frames is not supported by you browser
 | 
			
		||||
</iframe>
 | 
			
		||||
<script>
 | 
			
		||||
(function(){
 | 
			
		||||
    function ajaxrequest(data, callback, obj) {
 | 
			
		||||
        $.ajax({type:"POST",url:"/include/core/index.php",data:data, timeout:50000,success: $.proxy(callback, obj)});
 | 
			
		||||
    }
 | 
			
		||||
    var switch_button = ["<?=$root["basic"]["basic_enable"]?>", "<?=$root["basic"]["basic_disable"]?>"], savebox = [],
 | 
			
		||||
        obj = $(".buttons"), status = $('[name=is_check]').prop('checked') ? 1:0, btnbox = obj.find("button");
 | 
			
		||||
    btnbox.eq(0).click(function(){
 | 
			
		||||
        status = $('[name=is_check]').prop('checked') ? 1:0;
 | 
			
		||||
        var show_msg = new waitbox();
 | 
			
		||||
        show_msg._init("<?=$root["pt"]["waiting"]?>");
 | 
			
		||||
        ajaxrequest({mod:"mesh",act:'_switch',opt:status}, function(ret){
 | 
			
		||||
            if(ret == 0){
 | 
			
		||||
                $("#manager").hide();
 | 
			
		||||
            }else{
 | 
			
		||||
                $("#manager").show();
 | 
			
		||||
            }
 | 
			
		||||
            window.location.reload();
 | 
			
		||||
        },this);
 | 
			
		||||
    }), status==1 ? $("#manager").show() : $("#manager").hide();
 | 
			
		||||
 | 
			
		||||
    $("#_location").click(function () {
 | 
			
		||||
        window.open('<?php echo $url;?>');
 | 
			
		||||
    });
 | 
			
		||||
})($);    
 | 
			
		||||
</script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue