<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts on 便利屋68 の home page</title><link>https://rikaaa0928.github.io/posts/</link><description>Recent content in Posts on 便利屋68 の home page</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Tue, 16 Sep 2025 13:51:14 +0800</lastBuildDate><atom:link href="https://rikaaa0928.github.io/posts/index.xml" rel="self" type="application/rss+xml"/><item><title>将R2S打造成支持IPv6的WireGuard透明网关</title><link>https://rikaaa0928.github.io/posts/r2s-gateway-with-debian/</link><pubDate>Tue, 16 Sep 2025 13:51:14 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/r2s-gateway-with-debian/</guid><description>前言 本文记录了将一台搭载Debian系统的R2S设备配置为高性能旁路网关的过程。最终目标是实现一个可以为局域网内所有设备提供WireGuard VPN服务的透明网关，同时支持IPv4和IPv6，并具备智能DNS分流功能。
最终方案的核心组件包括：
Debian 12: 作为主操作系统。 WireGuard: 用于建立VPN连接。 uog: 一个流量混淆工具，用于将WireGuard的UDP流量伪装成其他协议（本文为HTTPS），以适应复杂的网络环境。 dnsproxy: AdGuard出品的高性能DNS代理，用于实现DNS-over-HTTPS (DoH)以及基于域名的DNS分流。 iptables/ip6tables: 用于配置网络地址转换（NAT），实现VPN共享。 准备工作 1. 安装系统与基础软件 首先，为R2S安装最新版本的Debian系统。您可以从FriendlyELEC的官方Wiki获取镜像和相关说明：
官方镜像下载: NanoPi R2S - Official Image Debian系统使用指南: NanoPi R2S - Work with Debian Core 安装过程略过，系统启动后，请执行以下操作：
# 更新系统并安装必要工具 sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y sudo apt install -y zsh wireguard-tools dnsutils # (可选) 更换为您喜欢的shell chsh -s /bin/zsh 2. 启用IP转发 作为旁路网关，设备需要能够转发网络包。编辑 /etc/sysctl.conf 文件：
sudo vim /etc/sysctl.conf 找到并取消以下两行的注释（如果它们被注释了的话），确保值为 1：
net.ipv4.ip_forward=1 net.ipv6.conf.all.forwarding=1 保存文件后，应用设置：</description></item><item><title>Helix Keymap</title><link>https://rikaaa0928.github.io/posts/helix-keymap/</link><pubDate>Sun, 06 Apr 2025 13:26:05 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/helix-keymap/</guid><description>================================================================= = CHAPTER 1 RECAP = Use the h,j,k,l keys to move the cursor.
Type : to enter Command mode.
The q / quit and q! / quit! commands will exit Helix. The former fails when there are unsaved changes. The latter discards them. The w / write command will save the file. The wq / write-quit command will do both. Type d to delete the character at the cursor.</description></item><item><title>Rust tokio: Send与Sync</title><link>https://rikaaa0928.github.io/posts/rust-tokio-learn-send-sync/</link><pubDate>Sun, 27 Oct 2024 19:15:00 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/rust-tokio-learn-send-sync/</guid><description>tokio中，返回的future无脑实现Send，因为tokio异步框架并不能保证单个异步任务绑定某个真实线程执行，实现Send表示这个future可以安全的跨线程执行。
Sync表示并发安全，需要跨异步任务调用的必须是Sync，可以套Mutex实现非Sync转Sync，再套Arc实现clone。
// Sync 类型:
Arc // 当 T: Sync
Mutex // 当 T: Send
RwLock // 当 T: Send
AtomicBool
AtomicI32
Vec // 当 T: Sync
String
&amp;amp;T // 当 T: Sync
// 非 Sync 类型:
RefCell // 内部可变性不是线程安全的
Cell // 同上
Rc // 引用计数不是线程安全的
*mut T // 裸指针</description></item><item><title>生成排除置顶ip段后的新ip段</title><link>https://rikaaa0928.github.io/posts/gen-exclude-ip/</link><pubDate>Thu, 25 Jan 2024 18:06:41 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/gen-exclude-ip/</guid><description>from ipaddress import ip_network start = &amp;#39;0.0.0.0/0&amp;#39; exclude = [&amp;#39;1.1.1.1/32&amp;#39;, &amp;#39;10.0.0.0/8&amp;#39;] result = [ip_network(start)] for x in exclude: n = ip_network(x) new = [] for y in result: if y.overlaps(n): new.extend(y.address_exclude(n)) else: new.append(y) result = new print(&amp;#39;,&amp;#39;.join(str(x) for x in sorted(result)))</description></item><item><title>Rust: 可变和引用</title><link>https://rikaaa0928.github.io/posts/rust-learn-mut-ref/</link><pubDate>Wed, 10 Jan 2024 09:40:00 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/rust-learn-mut-ref/</guid><description>mut a: &amp;amp;mut i32 mut a表示a可变，可以被重新绑定
&amp;amp;表示(不可变)引用 &amp;amp;mut表示可变引用，即*a可变，可以被重新绑定
测试验证代码 fn change_i_mut_ref(i:&amp;amp;mut i32){ *i=2; // 给引用绑定新值，i 不可变，*i 指向的变量可变 } // fn change_i_mut_ref_err(i:&amp;amp;mut i32){ // i=xxxx; // i 不可变，不可重新绑定，等于什么都不行 // } fn change_mut_i(mut i:i32){ i=4; } fn change_mut_i_ref(mut i:&amp;amp;i32){ i=&amp;amp;5; } fn change_mut_i_mut_ref_change_i(mut i:&amp;amp;mut i32){ // i=&amp;amp;5; //会报错，因为 &amp;amp;5 的类型是 &amp;amp;i32, &amp;amp;mut 5 的类型是 &amp;amp;mut i32 // i=&amp;amp;mut 5; //一样会报错，因为 &amp;amp;mut 5 生命周期仅在函数内，函数返回后，i引用的值会被回收 } fn change_mut_i_mut_ref_change_ref(mut i:&amp;amp;mut i32){ *i=7; } #[tokio::test] async fn my_test1()-&amp;gt; crate::Result&amp;lt;()&amp;gt; { let mut i=1i32; println!</description></item><item><title>Dubbo 2.7.14 With Java 17</title><link>https://rikaaa0928.github.io/posts/dubbo-2.7.14-with-java-17/</link><pubDate>Mon, 22 Nov 2021 15:37:08 +0800</pubDate><guid>https://rikaaa0928.github.io/posts/dubbo-2.7.14-with-java-17/</guid><description>java 17是java目前最新的长期支持(LTS)版本，但是由于其强封装 JDK 的内部 API的新特性，导致dubbo项目无法直接使用jdk17编译运行。通过参考openjdk的说明，可以发现只需要添加相应参数即可绕开java 17的限制
对于普通的dubbo项目，只需要在运行时添加
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED
如上参数即可。如果项目的其它依赖也有类似问题则可能需要加入更多参数，参数的获得方式和详细示例将在下面给出
本解决方案只能解决由于java 17强封装 JDK 的内部 API的特性造成的问题，其他的兼容性问题请寻找其它方案
参数的获得方法和示例 我们以dubbo官方仓库中的demo为例 首先使用java 17作为我们的开发环境，通过
git clone git@github.com:apache/dubbo.git git checkout dubbo-2.7.14 cd dubbo-demo/dubbo-demo-annotation 获得dubbo官方仓库的代码中的demo，然后可以尝试直接使用java 17编译dubbo的demo
mvn -U clean package --no-transfer-progress -D maven.test.skip=true 启动zookeeper docker run --name some-zookeepep -p 2181:2181 -it --rm zookeeper 作为注册中心 尝试运行provider
java -jar dubbo-demo-annotation-provider/target/dubbo-demo-annotation-provider-2.7.14.jar 可以看到类似的报错:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.</description></item></channel></rss>