mirror of
https://github.com/snltty/linker.git
synced 2025-09-26 21:15:57 +08:00
kvm
This commit is contained in:
19
README.md
19
README.md
@@ -11,7 +11,7 @@
|
||||
<div align="center">
|
||||
<p><img src="./readme/logo.png" height="150"></p>
|
||||
|
||||
# .NET8.0、linker、link anywhere
|
||||
# NET8.0、linker、link anywhere
|
||||
|
||||
[](https://github.com/snltty/linker)
|
||||
[](https://github.com/snltty/linker)
|
||||
@@ -19,12 +19,15 @@
|
||||
[](https://github.com/snltty/linker/releases)
|
||||
[](https://mit-license.org/)
|
||||
|
||||
|
||||
<a href="https://linker.snltty.com">官方网站</a>、<a href="https://linker-doc.snltty.com">使用说明文档</a>、<a href="https://jq.qq.com/?_wv=1027&k=ucoIVfz4" target="_blank">加入组织:1121552990</a>
|
||||
|
||||
</div>
|
||||
|
||||
## [😡]免责声明
|
||||
## [⭐]星星历史
|
||||
|
||||
[](https://www.star-history.com/#snltty/linker&Date)
|
||||
|
||||
## [🚫]免责声明
|
||||
|
||||
本软件基于 [GPL-2.0 License](https://opensource.org/licenses/GPL-2.0) 发布,完全免费提供,旨在“按现状”供用户使用。作者及贡献者不对使用本软件所产生的任何直接或间接后果承担责任,包括但不限于性能下降、数据丢失、服务中断、或任何其他类型的损害。
|
||||
|
||||
@@ -32,7 +35,7 @@
|
||||
|
||||
**用户责任**:使用本软件即表示您理解并同意承担由此产生的一切风险及责任,使用人员有责任和义务遵守当地法律条规,请勿用于违法犯罪。
|
||||
|
||||
## [😇]大概意思
|
||||
## [🪂]大概意思
|
||||
|
||||
使用p2p或者中继转发,让你的各个局域网连通起来,让各个局域网内的任意联网设备都可以相互连通
|
||||
|
||||
@@ -40,7 +43,7 @@
|
||||
<p><img src="./readme/linker.jpg"></p>
|
||||
</div>
|
||||
|
||||
## [🤩]主要功能
|
||||
## [🎖️]主要功能
|
||||
|
||||
##### 私有部署
|
||||
- **私有部署:** 私有部署服务端,信息更安全。
|
||||
@@ -71,12 +74,12 @@
|
||||
- **CDKEY:** 可以临时解锁一些限制,中继,内外穿透什么的,方便你分享服务器给朋友使用。
|
||||
- **使用文档:** 更多功能请阅读<a href="https://linker-doc.snltty.com">使用说明文档</a>
|
||||
|
||||
## [😂]管理页面
|
||||
## [🖼️]管理页面
|
||||
<p><img src="./readme/full.jpg"></p>
|
||||
<p><img src="./readme/plan.jpg"></p>
|
||||
<p><img src="./readme/firewall.jpg"></p>
|
||||
|
||||
## [😍]为爱发电
|
||||
## [🎁]为爱发电
|
||||
|
||||
若此项目对您有用,可以考虑通过 **[🔋为爱发电](https://afdian.com/a/snltty)** 对作者稍加支持,让作者更有动力,在项目上投入更多时间和精力
|
||||
|
||||
@@ -91,7 +94,7 @@
|
||||
</div>
|
||||
</details>
|
||||
|
||||
## [😎]特别说明
|
||||
## [👏]特别说明
|
||||
|
||||
本项目已加入 [DotNetGuide](https://github.com/YSGStudyHards/DotNetGuide) 列表。<br/>
|
||||
本项目已加入 [dotNET China](https://gitee.com/dotnetchina) 组织。<br/>
|
||||
|
@@ -37,8 +37,7 @@ do
|
||||
fi
|
||||
if [ $p = "kvm" ]
|
||||
then
|
||||
cp -rf src/linker/linker-kvm.sh public/publish/docker/linux-${p}-${r}/${f}/linker-kvm.sh
|
||||
cp -rf src/linker/linker-kvm-__init__.py public/publish/docker/linux-${p}-${r}/${f}/__init__.py
|
||||
cp -rf src/linker/kvm/ public/publish/docker/linux-${p}-${r}/${f}/kvm/
|
||||
fi
|
||||
done
|
||||
cd public/publish/docker/linux-${p}-x64/${f}
|
||||
|
@@ -29,8 +29,8 @@ chmod +x linker-install.sh
|
||||
2. 客户端端口 `1804`、`1803` TCP
|
||||
3. 配置文件夹 `./configs`
|
||||
4. 日志文件夹 `./logs`
|
||||
5. 镜像清单 `snltty/linker-debian`、`snltty/linker-musl`
|
||||
6. 特定平台 `snltty/linker-debian-{arch}`、`snltty/linker-musl-{arch}`,`{arch}`可以是`x64`、`arm64`、`arm`
|
||||
5. 镜像清单 `snltty/linker-debian`、`snltty/linker-musl`、`snltty/linker-kvm`
|
||||
6. 特定平台 `snltty/linker-debian-{arch}`、`snltty/linker-musl-{arch}`、`snltty/linker-kvm-{arch}`,`{arch}`可以是`x64`、`arm64`、`arm`
|
||||
7. `bridge`模式,需要映射一些端口比如`-p 18000-18010:18000-18010`,用于端口转发
|
||||
8. `host`模式,或者直接使用host`--network host`,**建议使用host,点对网,网对网,端口转发都方便**
|
||||
|
||||
|
@@ -128,21 +128,7 @@ namespace linker.snat
|
||||
if (item.Trim().StartsWith("0.0.0.0"))
|
||||
{
|
||||
string[] arr = Regex.Replace(item.Trim(), @"\s+", " ").Split(' ');
|
||||
IPAddress ip = IPAddress.Parse(arr[arr.Length - 2]);
|
||||
|
||||
foreach (var inter in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ip.Equals(inter.GetIPProperties().UnicastAddresses.FirstOrDefault(c => c.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).Address))
|
||||
{
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
return IPAddress.Parse(arr[arr.Length - 2]);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -281,7 +267,7 @@ namespace linker.snat
|
||||
/// <param name="p"></param>
|
||||
/// <param name="ptr"></param>
|
||||
/// <returns></returns>
|
||||
private unsafe bool InjectIcmp( WinDivertParseResult p, byte* ptr)
|
||||
private unsafe bool InjectIcmp(WinDivertParseResult p, byte* ptr)
|
||||
{
|
||||
//只操作response 和 request
|
||||
if (p.ICMPv4Hdr->Type != 0 && p.ICMPv4Hdr->Type != 8) return false;
|
||||
@@ -354,7 +340,7 @@ namespace linker.snat
|
||||
/// <param name="p"></param>
|
||||
/// <param name="ptr"></param>
|
||||
/// <returns></returns>
|
||||
private unsafe bool InjectTcp( WinDivertParseResult p, byte* ptr)
|
||||
private unsafe bool InjectTcp(WinDivertParseResult p, byte* ptr)
|
||||
{
|
||||
IPV4Packet ipv4 = new IPV4Packet(ptr);
|
||||
|
||||
|
BIN
src/linker.web/public/logo2.png
Normal file
BIN
src/linker.web/public/logo2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@@ -35,11 +35,19 @@ EXPOSE 623/udp
|
||||
|
||||
|
||||
COPY . /linker/
|
||||
COPY __init__.py /kvmd/plugins/hid/ch9329/__init__.py
|
||||
COPY kvm/__init__.py /kvmd/plugins/hid/ch9329/__init__.py
|
||||
|
||||
RUN chmod +x /linker/linker-kvm.sh
|
||||
COPY kvm/index.html /usr/share/kvmd/web/linker/index.html
|
||||
COPY kvm/logo-linker.png /usr/share/kvmd/web/share/svg/logo-linker.png
|
||||
COPY kvm/logo.svg /usr/share/kvmd/web/share/svg/logo.svg
|
||||
COPY kvm/favicon-16x16.png /usr/share/kvmd/web/share/favicon-16x16.png
|
||||
COPY kvm/favicon-32x32.png /usr/share/kvmd/web/share/favicon-32x32.png
|
||||
COPY kvm/apple-touch-icon.png /usr/share/kvmd/web/share/apple-touch-icon.png
|
||||
COPY kvm/android-chrome-192x192.png /usr/share/kvmd/web/share/android-chrome-192x192.png
|
||||
|
||||
RUN chmod +x /linker/kvm/linker-kvm.sh
|
||||
|
||||
ENV SNLTTY_LINKER_IS_DOCKER="linker"
|
||||
ENV DOTNET_ThreadPool_UnfairSemaphoreSpinLimit=0
|
||||
|
||||
ENTRYPOINT ["/linker/linker-kvm.sh"]
|
||||
ENTRYPOINT ["/linker/kvm/linker-kvm.sh"]
|
BIN
src/linker/kvm/android-chrome-192x192.png
Normal file
BIN
src/linker/kvm/android-chrome-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
src/linker/kvm/apple-touch-icon.png
Normal file
BIN
src/linker/kvm/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
src/linker/kvm/favicon-16x16.png
Normal file
BIN
src/linker/kvm/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
src/linker/kvm/favicon-32x32.png
Normal file
BIN
src/linker/kvm/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
122
src/linker/kvm/index.html
Normal file
122
src/linker/kvm/index.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
==============================================================================
|
||||
# #
|
||||
# KVMD - The main PiKVM daemon. #
|
||||
# #
|
||||
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
|
||||
# Copyright (C) 2023-2025 SilentWind <mofeng654321@hotmail.com> #
|
||||
# #
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
==============================================================================
|
||||
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>One-KVM IPMI Info</title>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/share/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/share/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/share/favicon-16x16.png">
|
||||
<link rel="manifest" href="/share/site.webmanifest">
|
||||
<link rel="mask-icon" href="/share/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#2b5797">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<link rel="stylesheet" href="/share/css/vars.css">
|
||||
<link rel="stylesheet" href="/share/css/main.css">
|
||||
<link rel="stylesheet" href="/share/css/start.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="start-box">
|
||||
<div class="start" style="max-width:none;"><a style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/" i18n="index"> ← [ One-KVM Index ]</a>
|
||||
<hr>
|
||||
<div id="apps-box">
|
||||
<ul id="apps">
|
||||
<li><div class="app"><a href="https://linker.snltty.com" target="_blank">🌍<br>官网</a></div></li>
|
||||
<li><div class="app"><a href="https://linker-doc.snltty.com" target="_blank">💼<br>文档</a></div></li>
|
||||
<li><div class="app"><a id="manager" href="#" target="_blank">💻<br>管理</a></div></li>
|
||||
<li><div class="app"><a href="https://afdian.com/a/snltty" target="_blank">🔋<br>发电</a></div></li>
|
||||
<li><div class="app"><a href="https://jq.qq.com/?_wv=1027&k=ucoIVfz4" target="_blank">📱<br>QQ群</a></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('manager').href = `http://${window.location.hostname}:1804`;
|
||||
</script>
|
||||
<style>
|
||||
div#apps-box {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li {
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li div.app {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
background-color: var(--cs-control-default-bg);
|
||||
box-shadow: var(--shadow-micro);
|
||||
border: var(--border-key-thin);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li div:hover.app {
|
||||
border: var(--border-intensive-thin);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li div:active.app {
|
||||
color: var(--cs-control-pressed-fg) !important;
|
||||
background-color: var(--cs-control-pressed-bg) !important;
|
||||
border: var(--border-key-thin);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li div.app img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
height: 50px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
div#apps-box ul#apps li div.app a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
65
src/linker/kvm/linker-kvm.sh
Normal file
65
src/linker/kvm/linker-kvm.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f /linker/supervisord.conf ]; then
|
||||
cat >> /linker/supervisord.conf << EOF
|
||||
|
||||
[supervisord]
|
||||
logfile = /linker/supervisord.log
|
||||
logfile_maxbytes = 50MB
|
||||
pidfile = /linker/supervisord.pid
|
||||
daemon = true
|
||||
|
||||
[unix_http_server]
|
||||
file = /linker/supervisor.sock
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///linker/supervisor.sock
|
||||
|
||||
[program:linker]
|
||||
command=/linker/linker
|
||||
directory=/linker/
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=12
|
||||
stopasgroup=true
|
||||
stdout_logfile=/linker/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
redirect_stderr=true
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /usr/share/kvmd/extras/linker/manifest.yaml ]; then
|
||||
cat >> /usr/share/kvmd/extras/linker/manifest.yaml << EOF
|
||||
name: linker
|
||||
description: linker network
|
||||
icon: share/svg/logo-linker.png
|
||||
path: linker
|
||||
daemon: kvmd-linker
|
||||
place: 21
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
python3 - <<END
|
||||
import json
|
||||
|
||||
with open("/usr/share/kvmd/web/share/i18n/i18n_zh.json", "r", encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
data["copyright"] = "<22><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD> © 2018-2024 Maxim Devaev | <20><> SilentWind <20><><EFBFBD>ο<EFBFBD><CEBF><EFBFBD> | snltty <20><><EFBFBD>ΰ<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>Linker<65><72><EFBFBD><EFBFBD>"
|
||||
data["kvm_text2"] = "//<a href=\"https://linker-doc.snltty.com/docs/14%E3%80%81%E4%B8%BA%E7%88%B1%E5%8F%91%E7%94%B5\"><3E><>Щ<EFBFBD><D0A9></a><3E><> Linker <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD>乤<EFBFBD><E4B9A4><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD>л<EFBFBD><D0BB><EFBFBD>ǵİ<C7B5><C4B0><EFBFBD><EFBFBD><EFBFBD><br>//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>֧<EFBFBD><D6A7> Linker <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <a target=\"_blank\" href=\"https://afdian.com/a/snltty\"> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </a><3E>Ͼ<EFBFBD><CFBE><EFBFBD></a><3E><><br><br>//<a href=\"https://one-kvm.mofeng.run/thanks/#_2\"><3E><>Щ<EFBFBD><D0A9></a><3E><> One-KVM <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD>乤<EFBFBD><E4B9A4><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD>л<EFBFBD><D0BB><EFBFBD>ǵİ<C7B5><C4B0><EFBFBD><EFBFBD><EFBFBD><br>//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>֧<EFBFBD><D6A7> One-KVM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <a target=\"_blank\" href=\"https://afdian.com/a/silentwind\"> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </a><3E>Ͼ<EFBFBD><CFBE><EFBFBD></a><3E><><br><br>//<a href=\"https://github.com/pikvm/pikvm?tab=readme-ov-file#special-thanks\"><3E><>Щ<EFBFBD><D0A9></a><3E><> PiKVM <20><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD>乤<EFBFBD><E4B9A4><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD>л<EFBFBD><D0BB><EFBFBD>ǵİ<C7B5><C4B0><EFBFBD><EFBFBD><EFBFBD><br>//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>֧<EFBFBD><D6A7> PiKVM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <a target=\"_blank\" href=\"https://www.patreon.com/pikvm\"> Patreon</a> <20><> <a target=\"_blank\" href=\"https://paypal.me/pikvm\"> PayPal <20>Ͼ<EFBFBD><CFBE><EFBFBD></a><3E><>";
|
||||
|
||||
with open("/usr/share/kvmd/web/share/i18n/i18n_zh.json", "w", encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
supervisord -c /linker/supervisord.conf &
|
||||
|
||||
/kvmd/init.sh
|
8
src/linker/kvm/logo.svg
Normal file
8
src/linker/kvm/logo.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 44 KiB |
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f /linker/supervisord.conf ]; then
|
||||
cat >> /linker/supervisord.conf << EOF
|
||||
|
||||
[supervisord]
|
||||
logfile = /linker/supervisord.log
|
||||
logfile_maxbytes = 50MB
|
||||
pidfile = /linker/supervisord.pid
|
||||
daemon = true
|
||||
|
||||
[unix_http_server]
|
||||
file = /linker/supervisor.sock
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///linker/supervisor.sock
|
||||
|
||||
[program:linker]
|
||||
command=/linker/linker
|
||||
directory=/linker/
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=12
|
||||
stopasgroup=true
|
||||
stdout_logfile=/linker/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
redirect_stderr=true
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
supervisord -c /linker/supervisord.conf &
|
||||
|
||||
/kvmd/init.sh
|
@@ -1,4 +1,4 @@
|
||||
v1.8.2
|
||||
2025-06-02 22:03:32
|
||||
2025-06-03 15:47:12
|
||||
1. 一些累计更新
|
||||
2. 测试发布,请使用1.8.2
|
@@ -37,8 +37,7 @@ do
|
||||
fi
|
||||
if [ $p = "kvm" ]
|
||||
then
|
||||
cp -rf src/linker/linker-kvm.sh public/publish/docker/linux-${p}-${r}/${f}/linker-kvm.sh
|
||||
cp -rf src/linker/linker-kvm-__init__.py public/publish/docker/linux-${p}-${r}/${f}/__init__.py
|
||||
cp -rf src/linker/kvm/ public/publish/docker/linux-${p}-${r}/${f}/kvm/
|
||||
fi
|
||||
done
|
||||
cd public/publish/docker/linux-${p}-x64/${f}
|
||||
|
Reference in New Issue
Block a user