diff --git a/README.md b/README.md index 1dd96ad..13f26f8 100644 --- a/README.md +++ b/README.md @@ -46,17 +46,19 @@ Install dependencies, then start the Tauri development window: npm run tauri dev The portable build creates `release/super-n2n-portable.zip`. It contains -`n2n/edge.exe` and `n2n/supernode.exe`; on Windows Super N2N starts them with -the relative paths `./n2n/edge.exe` and `./n2n/supernode.exe`. +`n2n/edge.exe`, `n2n/supernode.exe`, and the official TAP-Windows installer in +`drivers/tap-windows-9.24.7-I601-Win10.exe`; on Windows Super N2N starts the n2n +programs with the relative paths `./n2n/edge.exe` and `./n2n/supernode.exe`. ### Windows TAP requirement N2N uses an installed TAP-Windows virtual adapter; it does not create a new -adapter itself. Super N2N automatically selects an available TAP-Windows -adapter before starting Edge and reports a clear error when none is installed. -The optional TAP device field is only needed to select a specific existing -adapter. Connection settings, including advanced settings, are restored on the -next application launch. +adapter itself. Super N2N checks for an adapter on first launch, offers the +bundled installer when one is missing, and automatically selects an available +adapter before starting Edge. The optional TAP device field is only needed to +select a specific existing adapter. Connection settings, including advanced +settings, are stored beside `super-n2n.exe` in `super-n2n.config.json` and are +restored on the next application launch. ## Gitea Actions diff --git a/scripts/PORTABLE-README.txt b/scripts/PORTABLE-README.txt index 68a75b0..4e071ba 100644 --- a/scripts/PORTABLE-README.txt +++ b/scripts/PORTABLE-README.txt @@ -10,7 +10,15 @@ Windows 11 installations. N2N requires a TAP-Windows virtual network adapter installed on the computer. Super N2N automatically selects an available adapter when connecting. It does -not install or create a TAP adapter itself; install the TAP-Windows driver once -if the application reports that no TAP adapter is available. +not create a TAP adapter itself. On the first launch it checks for a TAP-Windows +adapter and shows an install prompt when one is missing. The official installer +is included at drivers\tap-windows-9.24.7-I601-Win10.exe. Click the install +button in the app (or run the installer as Administrator), complete the wizard, +and restart Super N2N. + +The app stores connection settings beside super-n2n.exe as +super-n2n.config.json. Its absence is used to identify the first launch. Do not +add this file to a release archive if you want the first-launch check to run. The bundled n2n programs are distributed under n2n\LICENSE-n2n.txt. +The bundled TAP-Windows installer and its license information are in drivers\. diff --git a/scripts/package-portable.ps1 b/scripts/package-portable.ps1 index 5d2512a..78626dc 100644 --- a/scripts/package-portable.ps1 +++ b/scripts/package-portable.ps1 @@ -46,6 +46,11 @@ try { 'n2n\edge.exe' = Join-Path $n2nRoot 'edge.exe' 'n2n\supernode.exe' = Join-Path $n2nRoot 'supernode.exe' 'n2n\LICENSE-n2n.txt' = Join-Path $n2nRoot 'LICENSE' + 'drivers\tap-windows-9.24.7-I601-Win10.exe' = Join-Path $projectRoot 'third_party\tap-windows\tap-windows-9.24.7-I601-Win10.exe' + 'drivers\TAP-WINDOWS-README.txt' = Join-Path $projectRoot 'third_party\tap-windows\README.txt' + 'drivers\TAP-WINDOWS-SHA256SUMS.txt' = Join-Path $projectRoot 'third_party\tap-windows\SHA256SUMS.txt' + 'drivers\TAP-WINDOWS-LICENSE.txt' = Join-Path $projectRoot 'third_party\tap-windows\LICENSE.txt' + 'drivers\TAP-WINDOWS-GPLv2.txt' = Join-Path $projectRoot 'third_party\tap-windows\COPYRIGHT.GPL.txt' 'README.txt' = Join-Path $projectRoot 'scripts\PORTABLE-README.txt' } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 483ffe9..7706f4b 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -89,6 +89,19 @@ struct TapAdapter { guid: String, } +const CONFIG_FILE_NAME: &str = "super-n2n.config.json"; +const TAP_INSTALLER_FILE_NAME: &str = "tap-windows-9.24.7-I601-Win10.exe"; + +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +struct StartupStatus { + config_exists: bool, + first_launch: bool, + config_path: String, + tap_driver_present: bool, + tap_installer_path: Option, +} + fn now_epoch() -> u64 { SystemTime::now() .duration_since(UNIX_EPOCH) @@ -122,6 +135,30 @@ fn app_directory() -> Result { .ok_or_else(|| "application executable has no parent directory".to_string()) } +fn config_file_path() -> Result { + Ok(app_directory()?.join(CONFIG_FILE_NAME)) +} + +fn bundled_tap_installer_path() -> Result { + Ok(app_directory()? + .join("drivers") + .join(TAP_INSTALLER_FILE_NAME)) +} + +fn tap_driver_present() -> bool { + #[cfg(target_os = "windows")] + { + return windows_tap_adapters() + .map(|adapters| !adapters.is_empty()) + .unwrap_or(false); + } + + #[cfg(not(target_os = "windows"))] + { + true + } +} + fn downloads_directory() -> PathBuf { #[cfg(target_os = "windows")] if let Some(profile) = std::env::var_os("USERPROFILE") { @@ -257,8 +294,14 @@ fn windows_tap_adapters() -> Result, String> { } #[tauri::command] -fn start_service(request: StartRequest, state: State<'_, AppState>) -> Result { - let mut processes = state.processes.lock().map_err(|_| "process state is unavailable".to_string())?; +fn start_service( + request: StartRequest, + state: State<'_, AppState>, +) -> Result { + let mut processes = state + .processes + .lock() + .map_err(|_| "process state is unavailable".to_string())?; if let Some(existing) = processes.get_mut(&request.service) { if existing.try_wait().map_err(|e| e.to_string())?.is_none() { return Ok(ServiceStatus { @@ -279,7 +322,10 @@ fn start_service(request: StartRequest, state: State<'_, AppState>) -> Result) -> Result) -> Result { - let mut processes = state.processes.lock().map_err(|_| "process state is unavailable".to_string())?; + let mut processes = state + .processes + .lock() + .map_err(|_| "process state is unavailable".to_string())?; if let Some(mut child) = processes.remove(&service) { - child.kill().map_err(|e| format!("unable to stop {}: {}", service, e))?; + child + .kill() + .map_err(|e| format!("unable to stop {}: {}", service, e))?; let _ = child.wait(); return Ok(empty_status(&service, "stopped")); } @@ -321,7 +372,10 @@ fn stop_service(service: String, state: State<'_, AppState>) -> Result) -> Result { - let mut processes = state.processes.lock().map_err(|_| "process state is unavailable".to_string())?; + let mut processes = state + .processes + .lock() + .map_err(|_| "process state is unavailable".to_string())?; if let Some(child) = processes.get_mut(&service) { if child.try_wait().map_err(|e| e.to_string())?.is_none() { return Ok(ServiceStatus { @@ -366,7 +420,8 @@ fn management_query(request: ManagementRequest) -> Result, String> { if let Ok(text) = std::str::from_utf8(&buffer[..size]) { for line in text.lines() { if let Ok(value) = serde_json::from_str::(line) { - let finished = value.get("_type").and_then(Value::as_str) == Some("end"); + let finished = + value.get("_type").and_then(Value::as_str) == Some("end"); packets.push(value); if finished { return Ok(packets); @@ -375,7 +430,10 @@ fn management_query(request: ManagementRequest) -> Result, String> { } } } - Err(error) if error.kind() == std::io::ErrorKind::WouldBlock || error.kind() == std::io::ErrorKind::TimedOut => { + Err(error) + if error.kind() == std::io::ErrorKind::WouldBlock + || error.kind() == std::io::ErrorKind::TimedOut => + { break; } Err(error) => return Err(error.to_string()), @@ -406,7 +464,11 @@ fn run_ping(request: PingRequest) -> Result { let stderr = String::from_utf8_lossy(&output.stderr).to_string(); Ok(ToolResult { ok: output.status.success(), - summary: if output.status.success() { "目标可达".to_string() } else { "目标不可达".to_string() }, + summary: if output.status.success() { + "目标可达".to_string() + } else { + "目标不可达".to_string() + }, output: if stdout.is_empty() { stderr } else { stdout }, latency_ms: Some(started.elapsed().as_millis()), }) @@ -420,11 +482,15 @@ fn run_tcping(request: TcpingRequest) -> Result { let started = Instant::now(); match TcpStream::connect_timeout(&address, Duration::from_millis(request.timeout_ms.max(100))) { Ok(_) => Ok(ToolResult { - ok: true, - summary: "TCP 端口可连接".to_string(), - output: format!("connected to {} in {} ms", address, started.elapsed().as_millis()), - latency_ms: Some(started.elapsed().as_millis()), - }), + ok: true, + summary: "TCP 端口可连接".to_string(), + output: format!( + "connected to {} in {} ms", + address, + started.elapsed().as_millis() + ), + latency_ms: Some(started.elapsed().as_millis()), + }), Err(error) => Ok(ToolResult { ok: false, summary: "TCP 端口不可连接".to_string(), @@ -451,7 +517,9 @@ fn tap_traffic(request: TapTrafficRequest) -> Result { #[cfg(target_os = "linux")] { - let path = std::path::Path::new("/sys/class/net").join(tap_device).join("statistics"); + let path = std::path::Path::new("/sys/class/net") + .join(tap_device) + .join("statistics"); let received_bytes = fs::read_to_string(path.join("rx_bytes")) .map_err(|error| format!("unable to read TAP adapter {tap_device}: {error}"))? .trim() @@ -514,6 +582,71 @@ fn resolve_tap_adapter(request: TapAdapterRequest) -> Result } } +#[tauri::command] +fn startup_status() -> Result { + let config_path = config_file_path()?; + let installer_path = bundled_tap_installer_path()?; + let config_exists = config_path.is_file(); + Ok(StartupStatus { + config_exists, + first_launch: !config_exists, + config_path: config_path.display().to_string(), + tap_driver_present: tap_driver_present(), + tap_installer_path: installer_path + .is_file() + .then(|| installer_path.display().to_string()), + }) +} + +#[tauri::command] +fn read_config() -> Result, String> { + let path = config_file_path()?; + if !path.is_file() { + return Ok(None); + } + fs::read_to_string(&path) + .map(Some) + .map_err(|error| format!("unable to read configuration {}: {error}", path.display())) +} + +#[tauri::command] +fn write_config(contents: String) -> Result { + let path = config_file_path()?; + if contents.len() > 64 * 1024 { + return Err("configuration is too large".to_string()); + } + serde_json::from_str::(&contents) + .map_err(|error| format!("configuration must be valid JSON: {error}"))?; + fs::write(&path, contents) + .map_err(|error| format!("unable to write configuration {}: {error}", path.display()))?; + Ok(path.display().to_string()) +} + +#[tauri::command] +fn open_tap_installer() -> Result { + let path = bundled_tap_installer_path()?; + if !path.is_file() { + return Err(format!( + "随包 TAP-Windows 安装程序不存在:{}", + path.display() + )); + } + + #[cfg(target_os = "windows")] + { + Command::new(&path) + .spawn() + .map_err(|error| format!("无法打开 TAP-Windows 安装程序:{error}"))?; + return Ok(path.display().to_string()); + } + + #[cfg(not(target_os = "windows"))] + { + let _ = path; + Err("TAP-Windows 安装程序仅支持 Windows".to_string()) + } +} + #[tauri::command] fn firewall_status() -> Result { #[cfg(target_os = "windows")] @@ -523,7 +656,10 @@ fn firewall_status() -> Result { .map_err(|e| e.to_string())?; #[cfg(target_os = "linux")] let output = Command::new("sh") - .args(["-c", "ufw status verbose 2>/dev/null || firewall-cmd --state 2>/dev/null || true"]) + .args([ + "-c", + "ufw status verbose 2>/dev/null || firewall-cmd --state 2>/dev/null || true", + ]) .output() .map_err(|e| e.to_string())?; #[cfg(target_os = "macos")] @@ -544,10 +680,16 @@ fn firewall_status() -> Result { || normalized.contains("status: active") || normalized.contains("firewall is enabled") || normalized.contains("state = 1") - || normalized.split_whitespace().any(|token| token == "running"); + || normalized + .split_whitespace() + .any(|token| token == "running"); Ok(ToolResult { ok: output.status.success(), - summary: if enabled { "本地防火墙已开启".to_string() } else { "未检测到防火墙开启".to_string() }, + summary: if enabled { + "本地防火墙已开启".to_string() + } else { + "未检测到防火墙开启".to_string() + }, output: stdout, latency_ms: None, }) @@ -619,6 +761,10 @@ pub fn run() { run_tcping, tap_traffic, resolve_tap_adapter, + startup_status, + read_config, + write_config, + open_tap_installer, firewall_status, export_log ]) diff --git a/src/lib/tauri.js b/src/lib/tauri.js index d97c29b..b1c8b76 100644 --- a/src/lib/tauri.js +++ b/src/lib/tauri.js @@ -39,4 +39,16 @@ export const tapTraffic = (tapDevice) => nativeCall('tap_traffic', { request: { export const resolveTapAdapter = (tapDevice) => nativeCall('resolve_tap_adapter', { request: { tapDevice } }, () => { throw new Error('浏览器预览无法识别 TAP 网卡') }) +export const startupStatus = () => nativeCall('startup_status', {}, () => ({ + configExists: false, + firstLaunch: false, + configPath: '', + tapDriverPresent: true, + tapInstallerPath: null, +})) +export const readConfig = () => nativeCall('read_config', {}, () => null) +export const writeConfig = (contents) => nativeCall('write_config', { contents }, () => null) +export const openTapInstaller = () => nativeCall('open_tap_installer', {}, () => { + throw new Error('浏览器预览无法打开 TAP-Windows 安装程序') +}) export const exportLog = (contents) => nativeCall('export_log', { contents }, () => null) diff --git a/src/main.jsx b/src/main.jsx index 2b8f565..f58700b 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -4,7 +4,10 @@ import { ArrowDown, ArrowUp, CheckCircle2, ChevronDown, CircleAlert, Gauge, Globe2, Network, Play, Download, Router, ScrollText, Server, Settings2, Square, Wifi, } from 'lucide-react' -import { exportLog, isTauri, resolveTapAdapter, serviceStatus, startService, stopService, tapTraffic } from './lib/tauri' +import { + exportLog, isTauri, openTapInstaller, readConfig, resolveTapAdapter, serviceStatus, startService, + startupStatus, stopService, tapTraffic, writeConfig, +} from './lib/tauri' import './styles.css' const initialEdge = { @@ -20,22 +23,28 @@ const initialEdge = { const edgeConfigStorageKey = 'super-n2n.edge-config.v1' -function loadEdgeConfig() { +function parseEdgeConfig(value) { const fallback = { ...initialEdge } - if (typeof window === 'undefined') return fallback - try { - const saved = JSON.parse(window.localStorage.getItem(edgeConfigStorageKey) || 'null') - if (!saved || typeof saved !== 'object' || Array.isArray(saved)) return fallback - for (const [field, defaultValue] of Object.entries(initialEdge)) { - if (typeof saved[field] === typeof defaultValue) fallback[field] = saved[field] - } - } catch { - // A damaged or unavailable browser store must not block the connection form. + const saved = value && typeof value === 'object' && !Array.isArray(value) && value.edge + && typeof value.edge === 'object' ? value.edge : value + if (!saved || typeof saved !== 'object' || Array.isArray(saved)) return fallback + for (const [field, defaultValue] of Object.entries(initialEdge)) { + if (typeof saved[field] === typeof defaultValue) fallback[field] = saved[field] } return fallback } -function saveEdgeConfig(config) { +function loadBrowserEdgeConfig() { + if (typeof window === 'undefined') return { ...initialEdge } + try { + return parseEdgeConfig(JSON.parse(window.localStorage.getItem(edgeConfigStorageKey) || 'null')) + } catch { + // A damaged or unavailable browser store must not block the connection form. + return { ...initialEdge } + } +} + +function saveBrowserEdgeConfig(config) { try { window.localStorage.setItem(edgeConfigStorageKey, JSON.stringify(config)) } catch { @@ -43,9 +52,13 @@ function saveEdgeConfig(config) { } } +function serializeEdgeConfig(config) { + return JSON.stringify({ version: 1, edge: config }, null, 2) +} + function App() { const [home, setHome] = useState('edge') - const [edge, setEdge] = useState(loadEdgeConfig) + const [edge, setEdge] = useState(loadBrowserEdgeConfig) const [edgeRunning, setEdgeRunning] = useState(false) const [activeTapDevice, setActiveTapDevice] = useState('') const [advancedOpen, setAdvancedOpen] = useState(false) @@ -53,7 +66,10 @@ function App() { const [logs, setLogs] = useState([]) const [traffic, setTraffic] = useState(null) const [message, setMessage] = useState(null) + const [startupInfo, setStartupInfo] = useState(null) + const [configReady, setConfigReady] = useState(!isTauri) const lastTapSample = useRef(null) + const configWriteFailed = useRef(false) const appendLog = (text, level = 'info') => { const time = new Date().toLocaleTimeString('zh-CN', { hour12: false }) @@ -61,8 +77,47 @@ function App() { } useEffect(() => { - saveEdgeConfig(edge) - }, [edge]) + if (!configReady) return + if (!isTauri) { + saveBrowserEdgeConfig(edge) + return + } + writeConfig(serializeEdgeConfig(edge)).catch((error) => { + if (configWriteFailed.current) return + configWriteFailed.current = true + appendLog('配置保存失败:' + error.message, 'warning') + }) + }, [edge, configReady]) + + useEffect(() => { + let active = true + const loadStartup = async () => { + try { + const status = await startupStatus() + if (!active) return + setStartupInfo(status) + if (isTauri && status.configExists) { + const contents = await readConfig() + if (active && contents) setEdge(parseEdgeConfig(JSON.parse(contents))) + } + if (active) { + setConfigReady(true) + if (status.firstLaunch) { + appendLog( + status.tapDriverPresent ? '首次启动:已检测到 TAP-Windows 网卡' : '首次启动:未检测到 TAP-Windows 网卡', + status.tapDriverPresent ? 'success' : 'warning', + ) + } + } + } catch (error) { + if (!active) return + setConfigReady(true) + appendLog('读取启动配置失败:' + error.message, 'warning') + } + } + loadStartup() + return () => { active = false } + }, []) useEffect(() => { let active = true @@ -163,6 +218,17 @@ function App() { } } + const installTapDriver = async () => { + try { + const path = await openTapInstaller() + appendLog('已打开 TAP-Windows 安装程序:' + path, 'info') + notify('请按安装向导完成驱动安装,然后重新打开应用', 'neutral') + } catch (error) { + appendLog('打开 TAP-Windows 安装程序失败:' + error.message, 'error') + notify('无法打开驱动安装程序:' + error.message) + } + } + return
Super N2N
@@ -180,7 +246,7 @@ function App() { {home === 'edge' - ? exportLogs(logs, notify)} /> + ? exportLogs(logs, notify)} /> : } @@ -189,7 +255,7 @@ function App() {
} -function EdgeHome({ edge, updateEdge, running, traffic, activeTapDevice, advancedOpen, setAdvancedOpen, logOpen, setLogOpen, logs, onToggle, onExportLog }) { +function EdgeHome({ edge, updateEdge, running, traffic, activeTapDevice, startupInfo, advancedOpen, setAdvancedOpen, setLogOpen, logOpen, logs, onToggle, onInstallTap, onExportLog }) { const toggleAdvanced = () => { setLogOpen(false) setAdvancedOpen((current) => !current) @@ -232,6 +298,8 @@ function EdgeHome({ edge, updateEdge, running, traffic, activeTapDevice, advance + + } + +} + function TrafficStrip({ traffic, tapDevice }) { if (!traffic || traffic.error) { return
diff --git a/src/styles.css b/src/styles.css index f0a55f3..d7ee383 100644 --- a/src/styles.css +++ b/src/styles.css @@ -64,6 +64,15 @@ h1 { margin: 0; color: var(--ink); font-size: 24px; line-height: 1.2; letter-spa .ip-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; } .input-group small { color: var(--muted); font-size: 12px; line-height: 1.4; } +.tap-setup { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0 22px 10px; padding: 8px 9px; color: #855f16; background: #fff8e8; border: 1px solid #ecd59c; border-radius: 5px; } +.tap-setup-copy { min-width: 0; display: flex; align-items: flex-start; gap: 7px; } +.tap-setup-copy > svg { flex: 0 0 auto; margin-top: 1px; } +.tap-setup-copy > span { min-width: 0; display: grid; gap: 2px; } +.tap-setup-copy strong { color: #76500d; font-size: 12px; line-height: 1.2; } +.tap-setup-copy small { overflow: hidden; color: #927642; font-size: 11px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; } +.tap-install { min-height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; color: #76500d; background: #fff; border: 1px solid #dfc57d; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; } +.tap-install:hover { background: #fffdf5; border-color: #caa64d; } + .dhcp-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; } .dhcp-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; } .toggle-track { position: relative; width: 36px; height: 22px; flex: 0 0 auto; background: #a8b7ba; border-radius: 14px; transition: background 180ms ease; } @@ -153,6 +162,7 @@ h1 { margin: 0; color: var(--ink); font-size: 24px; line-height: 1.2; letter-spa .input-group { padding: 12px 0; } .server-inputs { grid-template-columns: minmax(0, 1fr) auto 74px; gap: 5px; } .input-group input { height: 38px; font-size: 14px; } + .tap-setup { margin: 0 16px 8px; } .connect-button { width: calc(100% - 32px); margin: 10px 16px 14px; } .connection-summary { grid-template-columns: 1fr; } .connection-summary div { grid-template-columns: 80px 1fr; align-items: baseline; padding: 9px 14px; border-right: 0; border-bottom: 1px solid var(--line); } @@ -194,6 +204,13 @@ h1 { margin: 0; color: var(--ink); font-size: 24px; line-height: 1.2; letter-spa .field-title { gap: 0; font-size: 12px; } .field-title svg { display: none; } .input-group input { height: 30px; padding: 0 7px; border-radius: 4px; font-size: 12px; } + .tap-setup { gap: 5px; margin: 0 8px 3px; padding: 6px 7px; border-radius: 4px; } + .tap-setup-copy { gap: 5px; } + .tap-setup-copy > svg { width: 14px; height: 14px; } + .tap-setup-copy strong { font-size: 10px; } + .tap-setup-copy small { font-size: 9px; } + .tap-install { min-height: 24px; gap: 3px; padding: 0 6px; font-size: 10px; } + .tap-install svg { width: 12px; height: 12px; } .server-inputs { grid-template-columns: minmax(0, 1fr) auto 58px; gap: 4px; } .port-separator { font-size: 15px; } .input-group small { display: none; } diff --git a/third_party/tap-windows/COPYRIGHT.GPL.txt b/third_party/tap-windows/COPYRIGHT.GPL.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/third_party/tap-windows/COPYRIGHT.GPL.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/third_party/tap-windows/LICENSE.txt b/third_party/tap-windows/LICENSE.txt new file mode 100644 index 0000000..742e272 --- /dev/null +++ b/third_party/tap-windows/LICENSE.txt @@ -0,0 +1,25 @@ +tap-windows6 license +-------------------- + +The source and object code of the tap-windows6 project +is Copyright (C) 2002-2014 OpenVPN Technologies, Inc. The +NSIS installer is Copyright (C) 2014 OpenVPN Technologies, +Inc. and (C) 2012 Alon Bar-Lev. The installer.dll MSI helper +is Copyright (C) 2018-2019 WireGuard LLC. All are released +under the GPL version 2. See COPYRIGHT.GPL for the full GPL +license. The licensors also make the following statement +borrowed from the SPICE project: + +With respect to binaries built using the Microsoft(R) +Windows Driver Kit (WDK), GPLv2 does not extend to any code +contained in or derived from the WDK ("WDK Code"). As to +WDK Code, by using or distributing such binaries you agree +to be bound by the Microsoft Software License Terms for the +WDK. All WDK Code is considered by the GPLv2 licensors to +qualify for the special exception stated in section 3 of +GPLv2 (commonly known as the system library exception). + +The tap-windows.h file has been released under the MIT +license (see COPYRIGHT.MIT) as well as under GPLv2 (see +COPYRIGHT.GPL). This has been done to allow the use of the +header file in non-GPLv2 compatible projects. diff --git a/third_party/tap-windows/README.txt b/third_party/tap-windows/README.txt new file mode 100644 index 0000000..1a99f41 --- /dev/null +++ b/third_party/tap-windows/README.txt @@ -0,0 +1,13 @@ +TAP-Windows driver installer + +File: tap-windows-9.24.7-I601-Win10.exe +Version: 9.24.7-I601 +Official source: https://build.openvpn.net/downloads/releases/tap-windows-9.24.7-I601-Win10.exe +SHA-256: 1C44E77AB148DDFB174DE8041100EFC38C4F23500183FAFF88F9BADAC5782E3C + +The installer is distributed unchanged from the official OpenVPN release +directory. Windows may request administrator approval during installation. +After installation completes, restart Super N2N so it can detect the adapter. + +The TAP-Windows6 project is released under GPLv2. See LICENSE.txt for its +license notice and COPYRIGHT.GPL.txt for the complete GPLv2 text. diff --git a/third_party/tap-windows/SHA256SUMS.txt b/third_party/tap-windows/SHA256SUMS.txt new file mode 100644 index 0000000..45883bb --- /dev/null +++ b/third_party/tap-windows/SHA256SUMS.txt @@ -0,0 +1 @@ +1C44E77AB148DDFB174DE8041100EFC38C4F23500183FAFF88F9BADAC5782E3C tap-windows-9.24.7-I601-Win10.exe diff --git a/third_party/tap-windows/tap-windows-9.24.7-I601-Win10.exe b/third_party/tap-windows/tap-windows-9.24.7-I601-Win10.exe new file mode 100644 index 0000000..814f61e Binary files /dev/null and b/third_party/tap-windows/tap-windows-9.24.7-I601-Win10.exe differ