yuze-vlan 0.0.0-stage → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/bin/cli.mjs +65 -0
- package/bin/join.mjs +52 -0
- package/native/darwin-arm64/manifest.json +4 -0
- package/native/darwin-arm64/vlan +0 -0
- package/native/darwin-arm64/xray +0 -0
- package/native/licenses/Go-LICENSE +27 -0
- package/native/licenses/Xray-LICENSE +373 -0
- package/native/licenses/github.com_andybalholm_brotli-LICENSE +19 -0
- package/native/licenses/github.com_apernet_hysteria_core_v2-LICENSE.md +7 -0
- package/native/licenses/github.com_apernet_hysteria_extras_v2-LICENSE.md +7 -0
- package/native/licenses/github.com_apernet_quic-go-LICENSE +21 -0
- package/native/licenses/github.com_ghodss_yaml-LICENSE +50 -0
- package/native/licenses/github.com_google_gopacket-LICENSE +28 -0
- package/native/licenses/github.com_google_uuid-LICENSE +27 -0
- package/native/licenses/github.com_gorilla_websocket-LICENSE +22 -0
- package/native/licenses/github.com_huin_goupnp-LICENSE +23 -0
- package/native/licenses/github.com_jackpal_go-nat-pmp-LICENSE +13 -0
- package/native/licenses/github.com_juju_ratelimit-LICENSE +191 -0
- package/native/licenses/github.com_klauspost_compress-LICENSE +304 -0
- package/native/licenses/github.com_klauspost_cpuid_v2-LICENSE +22 -0
- package/native/licenses/github.com_koron_go-ssdp-LICENSE +21 -0
- package/native/licenses/github.com_libp2p_go-nat-LICENSE +191 -0
- package/native/licenses/github.com_libp2p_go-netroute-LICENSE +29 -0
- package/native/licenses/github.com_miekg_dns-LICENSE +29 -0
- package/native/licenses/github.com_molecule-man_go-brrr-LICENSE +21 -0
- package/native/licenses/github.com_pelletier_go-toml-LICENSE +247 -0
- package/native/licenses/github.com_pion_dtls_v3-LICENSE +9 -0
- package/native/licenses/github.com_pion_logging-LICENSE +9 -0
- package/native/licenses/github.com_pion_stun_v3-LICENSE +9 -0
- package/native/licenses/github.com_pion_transport_v4-LICENSE +9 -0
- package/native/licenses/github.com_pires_go-proxyproto-LICENSE +201 -0
- package/native/licenses/github.com_quic-go_go-ossfuzz-seeds-LICENSE +7 -0
- package/native/licenses/github.com_quic-go_qpack-LICENSE.md +7 -0
- package/native/licenses/github.com_refraction-networking_utls-LICENSE +27 -0
- package/native/licenses/github.com_robfig_cron_v3-LICENSE +21 -0
- package/native/licenses/github.com_songgao_water-LICENSE +27 -0
- package/native/licenses/github.com_stretchr_objx-LICENSE +22 -0
- package/native/licenses/github.com_stretchr_testify-LICENSE +21 -0
- package/native/licenses/github.com_vishvananda_netlink-LICENSE +192 -0
- package/native/licenses/github.com_vishvananda_netns-LICENSE +192 -0
- package/native/licenses/github.com_wlynxg_anet-LICENSE +28 -0
- package/native/licenses/github.com_xtls_reality-LICENSE +375 -0
- package/native/licenses/github.com_yuin_gopher-lua-LICENSE +21 -0
- package/native/licenses/go.uber.org_goleak-LICENSE +21 -0
- package/native/licenses/go.uber.org_mock-LICENSE +202 -0
- package/native/licenses/go.yaml.in_yaml_v3-LICENSE +50 -0
- package/native/licenses/go4.org_netipx-LICENSE +27 -0
- package/native/licenses/golang.org_x_crypto-LICENSE +27 -0
- package/native/licenses/golang.org_x_crypto_x509roots_fallback-LICENSE +27 -0
- package/native/licenses/golang.org_x_exp-LICENSE +27 -0
- package/native/licenses/golang.org_x_net-LICENSE +27 -0
- package/native/licenses/golang.org_x_sync-LICENSE +27 -0
- package/native/licenses/golang.org_x_sys-LICENSE +27 -0
- package/native/licenses/golang.org_x_text-LICENSE +27 -0
- package/native/licenses/golang.zx2c4.com_wireguard-LICENSE +17 -0
- package/native/licenses/google.golang.org_genproto_googleapis_rpc-LICENSE +202 -0
- package/native/licenses/google.golang.org_grpc-LICENSE +202 -0
- package/native/licenses/google.golang.org_protobuf-LICENSE +27 -0
- package/native/licenses/gopkg.in_yaml.v2-LICENSE +201 -0
- package/native/licenses/layeh.com_gopher-luar-LICENSE +373 -0
- package/native/licenses/lukechampine.com_blake3-LICENSE +21 -0
- package/native/linux-x64/manifest.json +4 -0
- package/native/linux-x64/vlan +0 -0
- package/native/linux-x64/xray +0 -0
- package/native/source/BUILD.md +14 -0
- package/native/source/transports.lock.json +16 -0
- package/native/source/xray-core-v26.11.9-vlan-security1.tar.gz +0 -0
- package/node_modules/yuze-vlan-recovery/README.md +9 -0
- package/node_modules/yuze-vlan-recovery/bin/cli.mjs +31 -0
- package/node_modules/yuze-vlan-recovery/native/darwin-arm64/manifest.json +1 -0
- package/node_modules/yuze-vlan-recovery/native/darwin-arm64/vlan-recovery +0 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/Go-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/Xray-LICENSE +373 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_andybalholm_brotli-LICENSE +19 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_apernet_hysteria_core_v2-LICENSE.md +7 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_apernet_hysteria_extras_v2-LICENSE.md +7 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_apernet_quic-go-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_ghodss_yaml-LICENSE +50 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_google_gopacket-LICENSE +28 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_google_uuid-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_gorilla_websocket-LICENSE +22 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_huin_goupnp-LICENSE +23 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_jackpal_go-nat-pmp-LICENSE +13 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_juju_ratelimit-LICENSE +191 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_klauspost_compress-LICENSE +304 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_klauspost_cpuid_v2-LICENSE +22 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_koron_go-ssdp-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_libp2p_go-nat-LICENSE +191 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_libp2p_go-netroute-LICENSE +29 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_miekg_dns-LICENSE +29 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_molecule-man_go-brrr-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pelletier_go-toml-LICENSE +247 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pion_dtls_v3-LICENSE +9 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pion_logging-LICENSE +9 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pion_stun_v3-LICENSE +9 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pion_transport_v4-LICENSE +9 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_pires_go-proxyproto-LICENSE +201 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_quic-go_go-ossfuzz-seeds-LICENSE +7 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_quic-go_qpack-LICENSE.md +7 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_refraction-networking_utls-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_robfig_cron_v3-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_songgao_water-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_stretchr_objx-LICENSE +22 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_stretchr_testify-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_vishvananda_netlink-LICENSE +192 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_vishvananda_netns-LICENSE +192 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_wlynxg_anet-LICENSE +28 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_xtls_reality-LICENSE +375 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/github.com_yuin_gopher-lua-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/go.uber.org_goleak-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/go.uber.org_mock-LICENSE +202 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/go.yaml.in_yaml_v3-LICENSE +50 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/go4.org_netipx-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_crypto-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_crypto_x509roots_fallback-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_exp-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_net-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_sync-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_sys-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.org_x_text-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/golang.zx2c4.com_wireguard-LICENSE +17 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/google.golang.org_genproto_googleapis_rpc-LICENSE +202 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/google.golang.org_grpc-LICENSE +202 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/google.golang.org_protobuf-LICENSE +27 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/gopkg.in_yaml.v2-LICENSE +201 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/layeh.com_gopher-luar-LICENSE +373 -0
- package/node_modules/yuze-vlan-recovery/native/licenses/lukechampine.com_blake3-LICENSE +21 -0
- package/node_modules/yuze-vlan-recovery/native/linux-x64/manifest.json +1 -0
- package/node_modules/yuze-vlan-recovery/native/linux-x64/vlan-recovery +0 -0
- package/node_modules/yuze-vlan-recovery/package.json +26 -0
- package/package.json +39 -4
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# yuze-vlan
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node 22+;支持 macOS arm64 / Linux x64,后台运行原生核心。
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g yuze-vlan
|
|
7
|
+
yuze-vlan join --server 200398.xyz --ports 443,64332
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
在管理页面生成一次性 Token,在隐藏输入提示中输入即可。服务器分配固定 `10.100.0.x` IP,自动配置主通道、备用端口及独立恢复服务,无需 SSH 登录 VPS。不把 Token 写入命令行;自动化可用 `--token-file FILE`。
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
yuze-vlan status
|
|
14
|
+
yuze-vlan version
|
|
15
|
+
yuze-vlan service upgrade
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
主服务升级保留设备身份和旧版本,不更新独立 `yuze-vlan-recovery` 服务。主包捆绑恢复包,仅在首次接入时安装;恢复进程、配置和版本与主程序分离。详情见 https://cnb.cool/yuze75/VLAN 。独立恢复命令也可通过 `npm install -g yuze-vlan-recovery` 安装;已有恢复服务不会因为 npm 安装而重启。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Third-party components
|
|
2
|
+
|
|
3
|
+
- Xray-core v26.11.9 — MPL-2.0. Source: https://github.com/XTLS/Xray-core/tree/v26.11.9. Built from upstream commit 676eaf66f8f05d4d558ee7a74b4736623d3feeb9 with patched dependencies and Go 1.27.4. The exact corresponding Xray source (including updated go.mod/go.sum) is included in native/source/xray-core-v26.11.9-vlan-security1.tar.gz. Build instructions and dependency pins are included in native/source/BUILD.md and transports.lock.json. Upstream source files are unchanged; dependency versions and build metadata are changed. License included under native/licenses/.
|
|
4
|
+
- Hysteria core v2.14.0 — MIT. Source: https://github.com/apernet/hysteria. Linked into the native VLAN binary.
|
|
5
|
+
- songgao/water — BSD-3-Clause. Source: https://github.com/songgao/water. Generic TUN interface; no WireGuard protocol.
|
|
6
|
+
- Go standard library — BSD-3-Clause. https://go.dev/LICENSE
|
|
7
|
+
- Other Go modules and precise versions are listed in the source go.mod/go.sum. License files are included in the npm artifact's native/licenses directory.
|
|
8
|
+
|
|
9
|
+
VLAN repository: https://cnb.cool/yuze75/VLAN (private). Original VLAN components retain their proprietary license status; third-party components retain their respective licenses. The corresponding Xray source is distributed under MPL-2.0 and is available directly in this package, without access to the private repository.
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {join} from './join.mjs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import crypto from 'node:crypto';
|
|
6
|
+
import {fileURLToPath} from 'node:url';
|
|
7
|
+
import {spawnSync} from 'node:child_process';
|
|
8
|
+
const here=path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const root=path.dirname(here),version=JSON.parse(fs.readFileSync(path.join(root,'package.json'))).version;
|
|
10
|
+
const platform=process.platform+'-'+process.arch;
|
|
11
|
+
const native=path.join(root,'native',platform);
|
|
12
|
+
const base=process.platform==='darwin'?'/Library/Application Support/YuzeVLAN':'/opt/yuze-vlan';
|
|
13
|
+
const release=path.join(base,'versions',version);
|
|
14
|
+
const config=path.join(base,'config.json');
|
|
15
|
+
const args=process.argv.slice(2),command=args[0];
|
|
16
|
+
function run(program,argv){const r=spawnSync(program,argv,{stdio:'inherit'});if(r.error)throw r.error;if(r.status!==0)throw Error(program+' exited '+r.status);}
|
|
17
|
+
function elevated(){if(process.getuid?.()===0)return;run('/usr/bin/sudo',[process.execPath,fileURLToPath(import.meta.url),...args]);process.exit(0);}
|
|
18
|
+
function write(file,value,mode=0o600){fs.writeFileSync(file,value,{mode});fs.chmodSync(file,mode);}
|
|
19
|
+
function plist(label,program,argv){const esc=s=>s.replaceAll('&','&').replaceAll('<','<').replaceAll('>','>');return '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>'+label+'</string><key>ProgramArguments</key><array>'+[program,...argv].map(s=>'<string>'+esc(s)+'</string>').join('')+'</array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>StandardOutPath</key><string>'+esc(base)+'/service.log</string><key>StandardErrorPath</key><string>'+esc(base)+'/service.log</string><key>EnvironmentVariables</key><dict><key>PATH</key><string>/usr/bin:/bin:/usr/sbin:/sbin</string></dict></dict></plist>';}
|
|
20
|
+
async function stop(name){
|
|
21
|
+
if(process.platform==='darwin'){
|
|
22
|
+
const label='com.yuze.vlan.'+name;
|
|
23
|
+
const check=spawnSync('/bin/launchctl',['print','system/'+label],{encoding:'utf8'});
|
|
24
|
+
if(check.status!==0)return;
|
|
25
|
+
const pid=Number(check.stdout.match(/\n\s*pid = (\d+)/)?.[1]||0);
|
|
26
|
+
run('/bin/launchctl',['bootout','system/'+label]);
|
|
27
|
+
for(let i=0;i<80;i++){
|
|
28
|
+
const removed=spawnSync('/bin/launchctl',['print','system/'+label],{stdio:'ignore'}).status!==0;
|
|
29
|
+
let alive=false;
|
|
30
|
+
if(pid){try{process.kill(pid,0);alive=true}catch(e){if(e.code!=='ESRCH')throw e}}
|
|
31
|
+
if(removed&&!alive){await new Promise(r=>setTimeout(r,500));return}
|
|
32
|
+
await new Promise(r=>setTimeout(r,250));
|
|
33
|
+
}
|
|
34
|
+
throw Error('Service did not finish unloading: '+label);
|
|
35
|
+
}else{const s=spawnSync('systemctl',['is-active','--quiet','yuze-vlan-'+name]);if(s.status===0)run('systemctl',['stop','yuze-vlan-'+name]);}
|
|
36
|
+
}
|
|
37
|
+
async function installServices(directory=release){const c=JSON.parse(fs.readFileSync(config));const services=[['xray',path.join(directory,'xray'),['run','-config',path.join(base,'xray.json')]],['agent',path.join(directory,'vlan'),['run','--config',config]]];if(c.role!=='agent')throw Error('npm setup currently installs clients; deploy relay using scripts and documented server configuration');for(const [name,bin,argv] of services){await stop(name);if(process.platform==='darwin'){const p='/Library/LaunchDaemons/com.yuze.vlan.'+name+'.plist';write(p,plist('com.yuze.vlan.'+name,bin,argv),0o644);run('/bin/launchctl',['bootstrap','system',p]);}else{const unit='yuze-vlan-'+name;write('/etc/systemd/system/'+unit+'.service','[Unit]\nDescription=Yuze VLAN '+name+'\nAfter=network-online.target\n[Service]\nExecStart='+[bin,...argv].map(s=>'"'+s.replaceAll('"','\\"')+'"').join(' ')+'\nRestart=on-failure\nRestartSec=3\nUMask=0077\n[Install]\nWantedBy=multi-user.target\n',0o644);run('systemctl',['daemon-reload']);run('systemctl',['enable','--now',unit]);}}}
|
|
38
|
+
function armRecovery(previous){
|
|
39
|
+
if(process.platform!=='darwin')return null;
|
|
40
|
+
const dir=path.join(base,'upgrade-recovery-'+Date.now()),label='com.yuze.vlan.recovery.'+Date.now();
|
|
41
|
+
fs.mkdirSync(dir,{mode:0o700});
|
|
42
|
+
for(const name of ['agent','xray'])fs.copyFileSync('/Library/LaunchDaemons/com.yuze.vlan.'+name+'.plist',path.join(dir,name+'.plist'));
|
|
43
|
+
fs.copyFileSync(config,path.join(dir,'config.json'));
|
|
44
|
+
const flag=path.join(dir,'armed'),script=path.join(dir,'recover.sh');write(flag,'armed\n');
|
|
45
|
+
const quote=s=>"'"+s.replaceAll("'","'\\''")+"'";
|
|
46
|
+
const lines=['#!/bin/sh','set -eu','i=0',`while [ "$i" -lt 60 ]; do [ -f ${quote(flag)} ] || exit 0; sleep 2; i=$((i+1)); done`,`[ -f ${quote(flag)} ] || exit 0`];
|
|
47
|
+
for(const name of ['agent','xray'])lines.push(`/bin/launchctl bootout system/com.yuze.vlan.${name} 2>/dev/null || true`);
|
|
48
|
+
lines.push('sleep 3',`/bin/cp ${quote(path.join(dir,'config.json'))} ${quote(config)}`);
|
|
49
|
+
for(const name of ['xray','agent']){const dest='/Library/LaunchDaemons/com.yuze.vlan.'+name+'.plist';lines.push(`/bin/cp ${quote(path.join(dir,name+'.plist'))} ${quote(dest)}`,`/bin/launchctl bootstrap system ${quote(dest)}`);}
|
|
50
|
+
lines.push(`printf '%s\\n' ${quote(previous)} > ${quote(path.join(base,'current-version'))}`,`/bin/mv ${quote(flag)} ${quote(path.join(dir,'recovered'))}`);
|
|
51
|
+
write(script,lines.join('\n')+'\n',0o700);
|
|
52
|
+
const job=path.join(dir,'recovery.plist');write(job,plist(label,'/bin/sh',[script]).replace('<key>KeepAlive</key><true/>','<key>KeepAlive</key><false/>'),0o644);run('/bin/launchctl',['bootstrap','system',job]);
|
|
53
|
+
return {flag,label};
|
|
54
|
+
}
|
|
55
|
+
function disarmRecovery(recovery){if(!recovery)return;if(!fs.existsSync(recovery.flag))throw Error('Independent recovery has already run; inspect service state');fs.unlinkSync(recovery.flag);run('/bin/launchctl',['bootout','system/'+recovery.label]);}
|
|
56
|
+
function copyNative(){if(!['darwin-arm64','linux-x64'].includes(platform))throw Error('Supported builds: macOS arm64 and Linux x64; received '+platform);const manifest=JSON.parse(fs.readFileSync(path.join(native,'manifest.json')));fs.mkdirSync(release,{recursive:true,mode:0o755});for(const name of ['vlan','xray']){const b=fs.readFileSync(path.join(native,name));if(crypto.createHash('sha256').update(b).digest('hex')!==manifest[name])throw Error('artifact digest mismatch: '+name);const target=path.join(release,name);if(fs.existsSync(target)){if(crypto.createHash('sha256').update(fs.readFileSync(target)).digest('hex')!==manifest[name])throw Error('Installed version contains different artifacts; use a new package version');continue;}write(target,b,0o755);}}
|
|
57
|
+
try{
|
|
58
|
+
if(command==='version'){console.log('CLI '+version+' ('+platform+')');if(fs.existsSync(path.join(base,'current-version')))console.log('Service '+fs.readFileSync(path.join(base,'current-version'),'utf8').trim());}
|
|
59
|
+
else if(command==='status'){elevated();const c=JSON.parse(fs.readFileSync(config));const state=JSON.parse(fs.readFileSync(c.stateFile));const age=Date.now()-Date.parse(state.updated);console.log(JSON.stringify({...state,stateAgeSeconds:Math.round(age/1000)},null,2));if(age>10000)process.exitCode=1;}
|
|
60
|
+
else if(command==='join'){elevated();const enrolled=await join(args,base);run(process.execPath,[fileURLToPath(import.meta.url),'setup','--profile',enrolled.file]);fs.unlinkSync(enrolled.pending);fs.unlinkSync(enrolled.file);}
|
|
61
|
+
else if(command==='setup'){const index=args.indexOf('--profile');if(index<0||!args[index+1])throw Error('Usage: yuze-vlan setup --profile /absolute/path/device-profile.json');elevated();const profile=JSON.parse(fs.readFileSync(path.resolve(args[index+1])));if(profile.config?.role!=='agent'||!profile.xray)throw Error('invalid client profile');if(fs.existsSync(config)){if(fs.existsSync(path.join(base,'current-version')))throw Error('already configured; use service upgrade (existing identity is preserved)');const old=JSON.parse(fs.readFileSync(config));if(old.id!==profile.config.id||old.key!==profile.config.key)throw Error('Incomplete setup belongs to another identity');fs.copyFileSync(config,config+'.before-setup-retry-'+Date.now());}fs.mkdirSync(base,{recursive:true,mode:0o700});copyNative();profile.config.stateFile=path.join(base,'state.json');write(config,JSON.stringify(profile.config,null,2));write(path.join(base,'xray.json'),JSON.stringify(profile.xray,null,2));run(path.join(release,'vlan'),['check','--config',config]);run(path.join(release,'xray'),['run','-test','-config',path.join(base,'xray.json')]);if(profile.recovery){const recoveryBase=process.platform==='darwin'?'/Library/Application Support/YuzeVLANRecovery':'/opt/yuze-vlan-recovery';if(!fs.existsSync(path.join(recoveryBase,'config.json')))run(process.execPath,[path.join(root,'node_modules/yuze-vlan-recovery/bin/cli.mjs'),'setup','--profile',path.resolve(args[index+1])]);}await installServices();write(path.join(base,'current-version'),version+'\n');console.log('Services installed. Run yuze-vlan status after the health probes complete.');}
|
|
62
|
+
else if(command==='service'&&args[1]==='upgrade'){elevated();if(!fs.existsSync(config))throw Error('run setup first');const previous=fs.existsSync(path.join(base,'current-version'))?fs.readFileSync(path.join(base,'current-version'),'utf8').trim():null;if(previous===version)throw Error('service already uses '+version);if(!previous)throw Error('missing current service version');copyNative();run(path.join(release,'vlan'),['check','--config',config]);fs.copyFileSync(config,config+'.before-'+version);const recovery=armRecovery(previous);const started=Date.now();try{await installServices();let healthy=false;for(let i=0;i<45;i++){await new Promise(r=>setTimeout(r,1000));const c=JSON.parse(fs.readFileSync(config));if(fs.existsSync(c.stateFile)){const state=JSON.parse(fs.readFileSync(c.stateFile));if(Date.parse(state.updated)>started&&state.active&&state.paths?.[state.active]?.healthy){healthy=true;break;}}}if(!healthy)throw Error('new service did not become healthy within 45 seconds');write(path.join(base,'current-version'),version+'\n');disarmRecovery(recovery);console.log('Upgraded and health checked; retained '+previous+' for rollback.');}catch(error){await installServices(path.join(base,'versions',previous));write(path.join(base,'current-version'),previous+'\n');disarmRecovery(recovery);throw Error('Upgrade failed; restored '+previous+': '+error.message);}}
|
|
63
|
+
else if(command==='service'&&args[1]==='uninstall'){elevated();for(const name of ['agent','xray']){await stop(name);if(process.platform==='darwin'){const p='/Library/LaunchDaemons/com.yuze.vlan.'+name+'.plist';if(fs.existsSync(p))fs.unlinkSync(p);}else{run('systemctl',['disable','yuze-vlan-'+name]);const p='/etc/systemd/system/yuze-vlan-'+name+'.service';if(fs.existsSync(p))fs.unlinkSync(p);}}if(process.platform==='linux')run('systemctl',['daemon-reload']);console.log('Services removed. Identity and version files retained in '+base);}
|
|
64
|
+
else {console.log('yuze-vlan join --server DOMAIN --ports 443,64332 [--token-file FILE]\nyuze-vlan setup --profile FILE\nyuze-vlan status\nyuze-vlan version\nyuze-vlan service upgrade\nyuze-vlan service uninstall');}
|
|
65
|
+
}catch(e){console.error(e.message);process.exitCode=1;}
|
package/bin/join.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import crypto from 'node:crypto';
|
|
5
|
+
import https from 'node:https';
|
|
6
|
+
|
|
7
|
+
function secretInput(){
|
|
8
|
+
if(!process.stdin.isTTY)throw Error('Non-interactive enrollment requires --token-file FILE');
|
|
9
|
+
return new Promise((resolve,reject)=>{
|
|
10
|
+
let value='';process.stdout.write('接入 Token(输入隐藏): ');process.stdin.setRawMode(true);process.stdin.resume();
|
|
11
|
+
const done=()=>{process.stdin.off('data',read);process.stdin.setRawMode(false);process.stdin.pause();process.stdout.write('\n')};
|
|
12
|
+
const read=b=>{for(const c of b.toString()){if(c==='\r'||c==='\n'){done();resolve(value.trim());return}if(c==='\u0003'){done();reject(Error('Cancelled'));return}if(c==='\u007f'){value=value.slice(0,-1)}else if(/[a-fA-F0-9]/.test(c)){value+=c}}};
|
|
13
|
+
process.stdin.on('data',read);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function enrollmentRequest(server,port,claim){
|
|
17
|
+
return new Promise((resolve,reject)=>{
|
|
18
|
+
// A private agent ignores OS system proxies and environment proxy variables.
|
|
19
|
+
const agent=new https.Agent({keepAlive:false,proxyEnv:{}});
|
|
20
|
+
const req=https.request({hostname:server,port,path:'/api/enroll',method:'POST',agent,timeout:10000,headers:{'Content-Type':'application/json'}},res=>{
|
|
21
|
+
let size=0;const chunks=[];res.on('data',b=>{size+=b.length;if(size>128*1024){res.destroy(Error('Enrollment response too large'));return}chunks.push(b)});
|
|
22
|
+
res.on('error',reject);res.on('end',()=>{agent.destroy();const body=Buffer.concat(chunks).toString();if(res.statusCode!==200){reject(Error('Server rejected enrollment: '+body.slice(0,200)));return}try{resolve(JSON.parse(body))}catch{reject(Error('Invalid enrollment response'))}});
|
|
23
|
+
});
|
|
24
|
+
req.on('timeout',()=>req.destroy(Error('Connection timed out')));req.on('error',e=>{agent.destroy();reject(e)});req.end(JSON.stringify(claim));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export async function join(args,base){
|
|
28
|
+
const option=name=>{const i=args.indexOf(name);return i<0?undefined:args[i+1]};
|
|
29
|
+
const server=option('--server');if(!server||!/^([a-zA-Z0-9.-]+)$/.test(server))throw Error('Use --server DOMAIN (the HTTPS certificate must match)');
|
|
30
|
+
const ports=(option('--ports')||'443').split(',').map(Number);
|
|
31
|
+
if(!ports.length||ports.length>16||new Set(ports).size!==ports.length||ports.some(p=>!Number.isInteger(p)||p<1||p>65535))throw Error('Invalid --ports list');
|
|
32
|
+
if(fs.existsSync(path.join(base,'current-version')))throw Error('This device is already enrolled; existing identity was preserved');
|
|
33
|
+
fs.mkdirSync(base,{recursive:true,mode:0o700});
|
|
34
|
+
const pending=path.join(base,'enrollment-pending.json');let claim;
|
|
35
|
+
if(fs.existsSync(pending)){
|
|
36
|
+
const p=JSON.parse(fs.readFileSync(pending));if(p.server!==server||JSON.stringify(p.ports)!==JSON.stringify(ports))throw Error('A pending enrollment uses another server or port list');claim=p.claim;
|
|
37
|
+
}else{
|
|
38
|
+
const tokenFile=option('--token-file');const token=tokenFile?fs.readFileSync(path.resolve(tokenFile),'utf8').trim():await secretInput();
|
|
39
|
+
if(!/^[a-fA-F0-9]{64}$/.test(token))throw Error('Invalid Token');
|
|
40
|
+
const name=option('--name')||os.hostname().replace(/[^a-zA-Z0-9_-]/g,'-').slice(0,41)+'-'+crypto.randomBytes(3).toString('hex');
|
|
41
|
+
if(!/^[a-zA-Z0-9_-]{1,48}$/.test(name))throw Error('Device name must contain 1..48 letters, digits, _ or -');
|
|
42
|
+
claim={token,nonce:crypto.randomBytes(32).toString('hex'),name};
|
|
43
|
+
fs.writeFileSync(pending,JSON.stringify({server,ports,claim}),{mode:0o600,flag:'wx'});
|
|
44
|
+
}
|
|
45
|
+
let profile;const failures=[];
|
|
46
|
+
for(const port of ports){try{profile=await enrollmentRequest(server,port,claim);break}catch(e){failures.push(port+': '+e.message)}}
|
|
47
|
+
if(!profile)throw Error(failures.join('\n')+'\nRetry the same command to resume without allocating another IP.');
|
|
48
|
+
if(profile.config?.role!=='agent'||!profile.xray||typeof profile.config.ip!=='string')throw Error('Invalid server profile');
|
|
49
|
+
const file=path.join(base,'enrolled-profile.json');fs.writeFileSync(file,JSON.stringify(profile),{mode:0o600});
|
|
50
|
+
console.log('服务器已分配固定地址 '+profile.config.ip+',设备 '+profile.config.id);
|
|
51
|
+
return {file,pending};
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright 2009 The Go Authors.
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are
|
|
5
|
+
met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright
|
|
8
|
+
notice, this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above
|
|
10
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
in the documentation and/or other materials provided with the
|
|
12
|
+
distribution.
|
|
13
|
+
* Neither the name of Google LLC nor the names of its
|
|
14
|
+
contributors may be used to endorse or promote products derived from
|
|
15
|
+
this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Mozilla Public License Version 2.0
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
1. Definitions
|
|
5
|
+
--------------
|
|
6
|
+
|
|
7
|
+
1.1. "Contributor"
|
|
8
|
+
means each individual or legal entity that creates, contributes to
|
|
9
|
+
the creation of, or owns Covered Software.
|
|
10
|
+
|
|
11
|
+
1.2. "Contributor Version"
|
|
12
|
+
means the combination of the Contributions of others (if any) used
|
|
13
|
+
by a Contributor and that particular Contributor's Contribution.
|
|
14
|
+
|
|
15
|
+
1.3. "Contribution"
|
|
16
|
+
means Covered Software of a particular Contributor.
|
|
17
|
+
|
|
18
|
+
1.4. "Covered Software"
|
|
19
|
+
means Source Code Form to which the initial Contributor has attached
|
|
20
|
+
the notice in Exhibit A, the Executable Form of such Source Code
|
|
21
|
+
Form, and Modifications of such Source Code Form, in each case
|
|
22
|
+
including portions thereof.
|
|
23
|
+
|
|
24
|
+
1.5. "Incompatible With Secondary Licenses"
|
|
25
|
+
means
|
|
26
|
+
|
|
27
|
+
(a) that the initial Contributor has attached the notice described
|
|
28
|
+
in Exhibit B to the Covered Software; or
|
|
29
|
+
|
|
30
|
+
(b) that the Covered Software was made available under the terms of
|
|
31
|
+
version 1.1 or earlier of the License, but not also under the
|
|
32
|
+
terms of a Secondary License.
|
|
33
|
+
|
|
34
|
+
1.6. "Executable Form"
|
|
35
|
+
means any form of the work other than Source Code Form.
|
|
36
|
+
|
|
37
|
+
1.7. "Larger Work"
|
|
38
|
+
means a work that combines Covered Software with other material, in
|
|
39
|
+
a separate file or files, that is not Covered Software.
|
|
40
|
+
|
|
41
|
+
1.8. "License"
|
|
42
|
+
means this document.
|
|
43
|
+
|
|
44
|
+
1.9. "Licensable"
|
|
45
|
+
means having the right to grant, to the maximum extent possible,
|
|
46
|
+
whether at the time of the initial grant or subsequently, any and
|
|
47
|
+
all of the rights conveyed by this License.
|
|
48
|
+
|
|
49
|
+
1.10. "Modifications"
|
|
50
|
+
means any of the following:
|
|
51
|
+
|
|
52
|
+
(a) any file in Source Code Form that results from an addition to,
|
|
53
|
+
deletion from, or modification of the contents of Covered
|
|
54
|
+
Software; or
|
|
55
|
+
|
|
56
|
+
(b) any new file in Source Code Form that contains any Covered
|
|
57
|
+
Software.
|
|
58
|
+
|
|
59
|
+
1.11. "Patent Claims" of a Contributor
|
|
60
|
+
means any patent claim(s), including without limitation, method,
|
|
61
|
+
process, and apparatus claims, in any patent Licensable by such
|
|
62
|
+
Contributor that would be infringed, but for the grant of the
|
|
63
|
+
License, by the making, using, selling, offering for sale, having
|
|
64
|
+
made, import, or transfer of either its Contributions or its
|
|
65
|
+
Contributor Version.
|
|
66
|
+
|
|
67
|
+
1.12. "Secondary License"
|
|
68
|
+
means either the GNU General Public License, Version 2.0, the GNU
|
|
69
|
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
70
|
+
Public License, Version 3.0, or any later versions of those
|
|
71
|
+
licenses.
|
|
72
|
+
|
|
73
|
+
1.13. "Source Code Form"
|
|
74
|
+
means the form of the work preferred for making modifications.
|
|
75
|
+
|
|
76
|
+
1.14. "You" (or "Your")
|
|
77
|
+
means an individual or a legal entity exercising rights under this
|
|
78
|
+
License. For legal entities, "You" includes any entity that
|
|
79
|
+
controls, is controlled by, or is under common control with You. For
|
|
80
|
+
purposes of this definition, "control" means (a) the power, direct
|
|
81
|
+
or indirect, to cause the direction or management of such entity,
|
|
82
|
+
whether by contract or otherwise, or (b) ownership of more than
|
|
83
|
+
fifty percent (50%) of the outstanding shares or beneficial
|
|
84
|
+
ownership of such entity.
|
|
85
|
+
|
|
86
|
+
2. License Grants and Conditions
|
|
87
|
+
--------------------------------
|
|
88
|
+
|
|
89
|
+
2.1. Grants
|
|
90
|
+
|
|
91
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
92
|
+
non-exclusive license:
|
|
93
|
+
|
|
94
|
+
(a) under intellectual property rights (other than patent or trademark)
|
|
95
|
+
Licensable by such Contributor to use, reproduce, make available,
|
|
96
|
+
modify, display, perform, distribute, and otherwise exploit its
|
|
97
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
|
98
|
+
as part of a Larger Work; and
|
|
99
|
+
|
|
100
|
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
101
|
+
for sale, have made, import, and otherwise transfer either its
|
|
102
|
+
Contributions or its Contributor Version.
|
|
103
|
+
|
|
104
|
+
2.2. Effective Date
|
|
105
|
+
|
|
106
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
|
107
|
+
become effective for each Contribution on the date the Contributor first
|
|
108
|
+
distributes such Contribution.
|
|
109
|
+
|
|
110
|
+
2.3. Limitations on Grant Scope
|
|
111
|
+
|
|
112
|
+
The licenses granted in this Section 2 are the only rights granted under
|
|
113
|
+
this License. No additional rights or licenses will be implied from the
|
|
114
|
+
distribution or licensing of Covered Software under this License.
|
|
115
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
116
|
+
Contributor:
|
|
117
|
+
|
|
118
|
+
(a) for any code that a Contributor has removed from Covered Software;
|
|
119
|
+
or
|
|
120
|
+
|
|
121
|
+
(b) for infringements caused by: (i) Your and any other third party's
|
|
122
|
+
modifications of Covered Software, or (ii) the combination of its
|
|
123
|
+
Contributions with other software (except as part of its Contributor
|
|
124
|
+
Version); or
|
|
125
|
+
|
|
126
|
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
127
|
+
its Contributions.
|
|
128
|
+
|
|
129
|
+
This License does not grant any rights in the trademarks, service marks,
|
|
130
|
+
or logos of any Contributor (except as may be necessary to comply with
|
|
131
|
+
the notice requirements in Section 3.4).
|
|
132
|
+
|
|
133
|
+
2.4. Subsequent Licenses
|
|
134
|
+
|
|
135
|
+
No Contributor makes additional grants as a result of Your choice to
|
|
136
|
+
distribute the Covered Software under a subsequent version of this
|
|
137
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
138
|
+
permitted under the terms of Section 3.3).
|
|
139
|
+
|
|
140
|
+
2.5. Representation
|
|
141
|
+
|
|
142
|
+
Each Contributor represents that the Contributor believes its
|
|
143
|
+
Contributions are its original creation(s) or it has sufficient rights
|
|
144
|
+
to grant the rights to its Contributions conveyed by this License.
|
|
145
|
+
|
|
146
|
+
2.6. Fair Use
|
|
147
|
+
|
|
148
|
+
This License is not intended to limit any rights You have under
|
|
149
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
|
150
|
+
equivalents.
|
|
151
|
+
|
|
152
|
+
2.7. Conditions
|
|
153
|
+
|
|
154
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
155
|
+
in Section 2.1.
|
|
156
|
+
|
|
157
|
+
3. Responsibilities
|
|
158
|
+
-------------------
|
|
159
|
+
|
|
160
|
+
3.1. Distribution of Source Form
|
|
161
|
+
|
|
162
|
+
All distribution of Covered Software in Source Code Form, including any
|
|
163
|
+
Modifications that You create or to which You contribute, must be under
|
|
164
|
+
the terms of this License. You must inform recipients that the Source
|
|
165
|
+
Code Form of the Covered Software is governed by the terms of this
|
|
166
|
+
License, and how they can obtain a copy of this License. You may not
|
|
167
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
|
168
|
+
Form.
|
|
169
|
+
|
|
170
|
+
3.2. Distribution of Executable Form
|
|
171
|
+
|
|
172
|
+
If You distribute Covered Software in Executable Form then:
|
|
173
|
+
|
|
174
|
+
(a) such Covered Software must also be made available in Source Code
|
|
175
|
+
Form, as described in Section 3.1, and You must inform recipients of
|
|
176
|
+
the Executable Form how they can obtain a copy of such Source Code
|
|
177
|
+
Form by reasonable means in a timely manner, at a charge no more
|
|
178
|
+
than the cost of distribution to the recipient; and
|
|
179
|
+
|
|
180
|
+
(b) You may distribute such Executable Form under the terms of this
|
|
181
|
+
License, or sublicense it under different terms, provided that the
|
|
182
|
+
license for the Executable Form does not attempt to limit or alter
|
|
183
|
+
the recipients' rights in the Source Code Form under this License.
|
|
184
|
+
|
|
185
|
+
3.3. Distribution of a Larger Work
|
|
186
|
+
|
|
187
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
|
188
|
+
provided that You also comply with the requirements of this License for
|
|
189
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
|
190
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
|
191
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
|
192
|
+
License permits You to additionally distribute such Covered Software
|
|
193
|
+
under the terms of such Secondary License(s), so that the recipient of
|
|
194
|
+
the Larger Work may, at their option, further distribute the Covered
|
|
195
|
+
Software under the terms of either this License or such Secondary
|
|
196
|
+
License(s).
|
|
197
|
+
|
|
198
|
+
3.4. Notices
|
|
199
|
+
|
|
200
|
+
You may not remove or alter the substance of any license notices
|
|
201
|
+
(including copyright notices, patent notices, disclaimers of warranty,
|
|
202
|
+
or limitations of liability) contained within the Source Code Form of
|
|
203
|
+
the Covered Software, except that You may alter any license notices to
|
|
204
|
+
the extent required to remedy known factual inaccuracies.
|
|
205
|
+
|
|
206
|
+
3.5. Application of Additional Terms
|
|
207
|
+
|
|
208
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
|
209
|
+
indemnity or liability obligations to one or more recipients of Covered
|
|
210
|
+
Software. However, You may do so only on Your own behalf, and not on
|
|
211
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
|
212
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
|
213
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
|
214
|
+
liability incurred by such Contributor as a result of warranty, support,
|
|
215
|
+
indemnity or liability terms You offer. You may include additional
|
|
216
|
+
disclaimers of warranty and limitations of liability specific to any
|
|
217
|
+
jurisdiction.
|
|
218
|
+
|
|
219
|
+
4. Inability to Comply Due to Statute or Regulation
|
|
220
|
+
---------------------------------------------------
|
|
221
|
+
|
|
222
|
+
If it is impossible for You to comply with any of the terms of this
|
|
223
|
+
License with respect to some or all of the Covered Software due to
|
|
224
|
+
statute, judicial order, or regulation then You must: (a) comply with
|
|
225
|
+
the terms of this License to the maximum extent possible; and (b)
|
|
226
|
+
describe the limitations and the code they affect. Such description must
|
|
227
|
+
be placed in a text file included with all distributions of the Covered
|
|
228
|
+
Software under this License. Except to the extent prohibited by statute
|
|
229
|
+
or regulation, such description must be sufficiently detailed for a
|
|
230
|
+
recipient of ordinary skill to be able to understand it.
|
|
231
|
+
|
|
232
|
+
5. Termination
|
|
233
|
+
--------------
|
|
234
|
+
|
|
235
|
+
5.1. The rights granted under this License will terminate automatically
|
|
236
|
+
if You fail to comply with any of its terms. However, if You become
|
|
237
|
+
compliant, then the rights granted under this License from a particular
|
|
238
|
+
Contributor are reinstated (a) provisionally, unless and until such
|
|
239
|
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
240
|
+
ongoing basis, if such Contributor fails to notify You of the
|
|
241
|
+
non-compliance by some reasonable means prior to 60 days after You have
|
|
242
|
+
come back into compliance. Moreover, Your grants from a particular
|
|
243
|
+
Contributor are reinstated on an ongoing basis if such Contributor
|
|
244
|
+
notifies You of the non-compliance by some reasonable means, this is the
|
|
245
|
+
first time You have received notice of non-compliance with this License
|
|
246
|
+
from such Contributor, and You become compliant prior to 30 days after
|
|
247
|
+
Your receipt of the notice.
|
|
248
|
+
|
|
249
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
|
250
|
+
infringement claim (excluding declaratory judgment actions,
|
|
251
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
252
|
+
directly or indirectly infringes any patent, then the rights granted to
|
|
253
|
+
You by any and all Contributors for the Covered Software under Section
|
|
254
|
+
2.1 of this License shall terminate.
|
|
255
|
+
|
|
256
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
257
|
+
end user license agreements (excluding distributors and resellers) which
|
|
258
|
+
have been validly granted by You or Your distributors under this License
|
|
259
|
+
prior to termination shall survive termination.
|
|
260
|
+
|
|
261
|
+
************************************************************************
|
|
262
|
+
* *
|
|
263
|
+
* 6. Disclaimer of Warranty *
|
|
264
|
+
* ------------------------- *
|
|
265
|
+
* *
|
|
266
|
+
* Covered Software is provided under this License on an "as is" *
|
|
267
|
+
* basis, without warranty of any kind, either expressed, implied, or *
|
|
268
|
+
* statutory, including, without limitation, warranties that the *
|
|
269
|
+
* Covered Software is free of defects, merchantable, fit for a *
|
|
270
|
+
* particular purpose or non-infringing. The entire risk as to the *
|
|
271
|
+
* quality and performance of the Covered Software is with You. *
|
|
272
|
+
* Should any Covered Software prove defective in any respect, You *
|
|
273
|
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
274
|
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
275
|
+
* essential part of this License. No use of any Covered Software is *
|
|
276
|
+
* authorized under this License except under this disclaimer. *
|
|
277
|
+
* *
|
|
278
|
+
************************************************************************
|
|
279
|
+
|
|
280
|
+
************************************************************************
|
|
281
|
+
* *
|
|
282
|
+
* 7. Limitation of Liability *
|
|
283
|
+
* -------------------------- *
|
|
284
|
+
* *
|
|
285
|
+
* Under no circumstances and under no legal theory, whether tort *
|
|
286
|
+
* (including negligence), contract, or otherwise, shall any *
|
|
287
|
+
* Contributor, or anyone who distributes Covered Software as *
|
|
288
|
+
* permitted above, be liable to You for any direct, indirect, *
|
|
289
|
+
* special, incidental, or consequential damages of any character *
|
|
290
|
+
* including, without limitation, damages for lost profits, loss of *
|
|
291
|
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
292
|
+
* and all other commercial damages or losses, even if such party *
|
|
293
|
+
* shall have been informed of the possibility of such damages. This *
|
|
294
|
+
* limitation of liability shall not apply to liability for death or *
|
|
295
|
+
* personal injury resulting from such party's negligence to the *
|
|
296
|
+
* extent applicable law prohibits such limitation. Some *
|
|
297
|
+
* jurisdictions do not allow the exclusion or limitation of *
|
|
298
|
+
* incidental or consequential damages, so this exclusion and *
|
|
299
|
+
* limitation may not apply to You. *
|
|
300
|
+
* *
|
|
301
|
+
************************************************************************
|
|
302
|
+
|
|
303
|
+
8. Litigation
|
|
304
|
+
-------------
|
|
305
|
+
|
|
306
|
+
Any litigation relating to this License may be brought only in the
|
|
307
|
+
courts of a jurisdiction where the defendant maintains its principal
|
|
308
|
+
place of business and such litigation shall be governed by laws of that
|
|
309
|
+
jurisdiction, without reference to its conflict-of-law provisions.
|
|
310
|
+
Nothing in this Section shall prevent a party's ability to bring
|
|
311
|
+
cross-claims or counter-claims.
|
|
312
|
+
|
|
313
|
+
9. Miscellaneous
|
|
314
|
+
----------------
|
|
315
|
+
|
|
316
|
+
This License represents the complete agreement concerning the subject
|
|
317
|
+
matter hereof. If any provision of this License is held to be
|
|
318
|
+
unenforceable, such provision shall be reformed only to the extent
|
|
319
|
+
necessary to make it enforceable. Any law or regulation which provides
|
|
320
|
+
that the language of a contract shall be construed against the drafter
|
|
321
|
+
shall not be used to construe this License against a Contributor.
|
|
322
|
+
|
|
323
|
+
10. Versions of the License
|
|
324
|
+
---------------------------
|
|
325
|
+
|
|
326
|
+
10.1. New Versions
|
|
327
|
+
|
|
328
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
|
329
|
+
10.3, no one other than the license steward has the right to modify or
|
|
330
|
+
publish new versions of this License. Each version will be given a
|
|
331
|
+
distinguishing version number.
|
|
332
|
+
|
|
333
|
+
10.2. Effect of New Versions
|
|
334
|
+
|
|
335
|
+
You may distribute the Covered Software under the terms of the version
|
|
336
|
+
of the License under which You originally received the Covered Software,
|
|
337
|
+
or under the terms of any subsequent version published by the license
|
|
338
|
+
steward.
|
|
339
|
+
|
|
340
|
+
10.3. Modified Versions
|
|
341
|
+
|
|
342
|
+
If you create software not governed by this License, and you want to
|
|
343
|
+
create a new license for such software, you may create and use a
|
|
344
|
+
modified version of this License if you rename the license and remove
|
|
345
|
+
any references to the name of the license steward (except to note that
|
|
346
|
+
such modified license differs from this License).
|
|
347
|
+
|
|
348
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
349
|
+
Licenses
|
|
350
|
+
|
|
351
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
|
352
|
+
Secondary Licenses under the terms of this version of the License, the
|
|
353
|
+
notice described in Exhibit B of this License must be attached.
|
|
354
|
+
|
|
355
|
+
Exhibit A - Source Code Form License Notice
|
|
356
|
+
-------------------------------------------
|
|
357
|
+
|
|
358
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
|
359
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
360
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
361
|
+
|
|
362
|
+
If it is not possible or desirable to put the notice in a particular
|
|
363
|
+
file, then You may include the notice in a location (such as a LICENSE
|
|
364
|
+
file in a relevant directory) where a recipient would be likely to look
|
|
365
|
+
for such a notice.
|
|
366
|
+
|
|
367
|
+
You may add additional accurate notices of copyright ownership.
|
|
368
|
+
|
|
369
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
370
|
+
---------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
373
|
+
defined by the Mozilla Public License, v. 2.0.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Toby
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2023 Toby
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 the quic-go authors & Google, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|